5 ms·
To go beyond generic Wiki syntax, SGML lets you define context-specific token replacement rules. For example, to make SGML format a simplistic markdown fragment
by tannhaeuser 8y ago
To go beyond generic Wiki syntax, SGML lets you define context-specific token replacement rules. For example, to make SGML format a simplistic markdown fragment into HTML, you could use an SGML prolog like this:
<!DOCTYPE p [
<!ELEMENT p - - ANY>
<!ELEMENT em - - (#PCDATA)>
<!ENTITY start-em '<em>'>
<!ENTITY end-em '</em>'>
<!SHORTREF in-p '*' start-em>
<!SHORTREF in-em '*' end-em>
<!USEMAP in-p p>
<!USEMAP in-em em>
]>
<p>The following text:
*this*
will be put into EM
element tags</p>
- agumonkey 8y agoso XML removed the best part of SGML..
- JadeNB 8y agoXML was always intended more for machine than for human consumption. It's easier for machines to consume extremely regular syntax, so that's what XML has.
- agumonkey 8y agounfortunately it had its time as a pseudo programming language period..
- JadeNB 8y ago> unfortunately it had its time as a pseudo programming language period.. You are quite right. I should probably have said something more like "XML was intended by its creators more for machine than human consumption" (and, incidentally, creation; I think I have read that XML construction wasn't really intended to be done by humans either).
- quink 8y agoThere’s XSLT Markdown to HTML converters out there. And while XSL isn’t XML, it is in every browser and available next to XML in near enough everything else.
- Mikhail_Edoshin 8y agoYes, it's not only everywhere, it's nothing less than a second programming language for the web, although very much neglected :)
- eponeponepon 8y agoHow does the parser distinguish between in-p and in-em to substitute in the corresponding entities? It seems to me that when it reaches the second asterisk it's not going to be able to know whether to open or close the em element. Is this one of those pieces of occult witchery that SGML excels at..?
- tannhaeuser 8y agoIf the context (top-most) element is "em", the "in-em" shortref map is current (as per the second USEMAP declaration), which defines the replacement text for "*" to be "</em>", ending the emphasized text span. Whereas within "p", it's "<em>", starting an emphasized text span, and making "em" the context element.