A Conversation for The GuideML Editor Writers' Caffeine Machine

GuideMLPreview

Post 1

Jonny

Hi MaW,

Could you add my project which should be finished and available soon. (I've just got a few more tags to work out). I know that people keep saying it'd work a lot better using XML templates, but this seemed easier somehow.

GuideMLGuide:
Is a C++ project which takes GuideML code and translates to HTML. The user can enter GuideML into a notepad style textview, and then select "Preview in Alabaster" or "Preview in Classic Goo". This allows people to learn GuideML whilst offline, so they can see what they're doing.

Thanks,
Jonny


GuideMLPreview

Post 2

Jonny

smiley - doh, forgot to mention the entry here:
http://www.bbc.co.uk/h2g2/guide/A618077


GuideMLPreview

Post 3

MaW

Added it. Do you want to be listed in the authors section too? If so, can you provide a little something you want to be said about you? I don't want to make it up, because I'll get it wrong.


GuideMLPreview

Post 4

Jonny

OK, yes please:
I'm a 16 year old AS level student studying Further Maths, Physics and Electronics. I write C++ projects in my spare time. GuideMLPreview is my first real project, so please be nice to me!

Thanks,

Jonny


GuideMLPreview

Post 5

Frankie Roberto

Interesting project.

When GuideML 1.0 is released, we'll all be able to write our own XSLTs for the language for offline-use (effectively creating our own skins). Parsing these isn't the easiest thing to do at the moment (you need a patch from microsfot, MSXML 3.0) - maybe your programme could incorporate this?

Forgive me if I'm chatting b*****x (that the right number of asterixes?), I'm new to all this stuff.


GuideMLPreview

Post 6

MaW

Yes, you seem to have the right end of the stick, but I hasten to point out that if you have a POSIX API on your operating system (Linux, other UNIX flavours, Mac OS X, Windows with Cygwin or other things too), you can use non-Microsoft XML parsers. If you want to...

You don't have to of course, but I'm told libxml and libxslt are quite good. Haven't tried them myself yet though.


GuideMLPreview

Post 7

Jonny

I'm not really sure about XML (I've not really had the time to do much research to be honest). I just thought that if the parser converts from GuideML to HTML, then logically each tag must have an HTML equivalent. I've had to view each tag and save an example of each tag to find out what it does and then work out a way of making the program convert from GuideML to HTML. It's just about working, I've still got a few final tags to do, and then I'll release it.


GuideMLPreview

Post 8

Frankie Roberto

It might not just be one equivilent tag though, there might be a whole host of tags associated with it, like FONT tags and Javascripts.


GuideMLPreview

Post 9

Jonny

Very true, for example the header tag in goo incorporates several images, a font, and a table. And you don't want to know the tags I've got for FOOTNOTE!smiley - biggrin


GuideMLPreview

Post 10

MaW

* shudders *

Footnotes normally need some kind of structure in memory to shove them all in while you finish parsing the document, then spit them all out at the end...

* shudders again *


GuideMLPreview

Post 11

Jonny

Yes, I've had to have a CString variable to hold the data of all the footnotes which is added to the bottom of the finished page. Problem is, the routine that handles can only read what's inside the footnote tag, but that becomes a problem if there's another tag inside the FOOTNOTE tag, such as:
This is very difficult
The real problem is something like:
This is very difficultBecause of all the footnote tags.
smiley - headhurts Mind Taxing time again!
I think the FOOTNOTE tag is the only one that still needs a lot of work doing.

Jonny


GuideMLPreview

Post 12

Felonious Monk - h2g2s very own Bogeyman

Seriously Jonny, consider using a standard XML parser for converting the GuideML to HTML. It'll save you a hell of a lot of work. And it'll save the footnotes in memory for you to write them out later. If you have an ideological problem with Microsoft (as many people do) then you can use another parser. They all use the same XML document object model so once you've learned one you've effectively learned them all. I use the thing most days in my job.

FM


GuideMLPreview

Post 13

Jonny

smiley - erm I'm not sure, I'm willing to be swayed here. But won't the XML parser need more data than is available. The italics are keeping a lot of things close to their chest, such as the DTD.


GuideMLPreview

Post 14

Felonious Monk - h2g2s very own Bogeyman

I'm just approaching it from the standpoint of handling the problems you mentioned earlier, such as having tags embedded inside footnotes. The XML parser will handle that without any problem, as it builds up a tree (the Document Object Model) in memory which you then traverse in code. You also don't need a DTD to use it, just make sure that the XML is well formed. If you are feeling brave you can also use the SAX parser, which is event driven and builds no data structures.

Mercifully, all footnotes come right at the end of the article and not on the bottom of each page. So what I suggest you do is:
1: Parse and render the main body of the article, replacing each footnote with a mark in the text
2: Print out (in order) each of the footnotes embedded within the main body.
3: Apply steps 1 and 2 to each *footnote* recursively.


GuideMLPreview

Post 15

Jonny

smiley - ok I've just downloaded Microsoft's XML SDK. I'll see what I can do!

Jonny


GuideMLPreview

Post 16

MaW

A DTD is only necessary for validating XML to see if it conforms to the spec for whatever language the DTD is for (i.e. GuideML). And since the Towers don't have a DTD anyway...

What they're keeping close is the XSLT style sheet which turns GuideML into a beautiful Goo page or a garish Alabaster one. And to be honest, I don't really blame them - yes, I believe in Open Source, but there's no real need for anyone outside h2g2 to parse GuideML into exact lookalikes of h2g2 pages... that could be potentially problem-causing for h2g2.

I do have plans for a new improved GuidePost, but at the moment I have no time to execute them... smiley - sadface so I'll just hang around and provide moral support.

Except right now I have to go to work and battle the evil Microsoft demons (ever written for Windows CE? Don't!)


GuideMLPreview

Post 17

Felonious Monk - h2g2s very own Bogeyman

I'd suggest that whatever plans TPTB have for the XSLT, that you do what you want to do anyway. I don't see much point in pouring cold water over a keen young programmer's plans. You're doing this for intellectual interest and the best of luck to you. You will have to accept, of course, that it may never get used in anger.

As I said to MaW, I'm looking into producing a WYSIWYG editor for GuideML. I'm coming around to the idea that the easiest way of doing this is to use Word 2000 to save a raw HTML file, then parse the HTML file using the MSHTML library and recast it as GuideML using MSXML. Should be fun :-|


GuideMLPreview

Post 18

MaW

And as I said at the time, that seems like a bit of a long way around, but it will probably work...

I still have no time smiley - sadface

Oh well, when this big website I'm working on is up and running I can turn my attentions once more to GuidePost.


GuideMLPreview

Post 19

Jonny

Yes, I've been looking at the XML SDK and I think it looks quite possible. It does seem that the key is the XSLT. I'll keep looking at it, with the data I've got for the original idea, I might be able to develop it from their.

Jonny


GuideMLPreview

Post 20

MaW

XSLT does seem to be remarkably powerful, useful and an all-round Good Thing to know. I must learn it some day...


Key: Complain about this post