Page 1 of 1
Syntax mark-up for documenting code?
Posted: Wed Apr 26, 2006 9:34 am
by dmoc
I'm looking for a util that can take PB source and produce xml for syntax highlighting. I'd like then to import sections into an OpenOffice doc and also into html. I'd like to do this without wasting significant portion of my life

All suggestions welcome!
Posted: Wed Apr 26, 2006 10:27 am
by freak
What exactly should this xml output look like ?
Posted: Wed Apr 26, 2006 11:15 am
by dmoc
I imagine it would just enclose each chunk according to type, ie, "comment", "PB-keyword", "constant", "variable", etc. For inclusion in a web page it would be nice to preserve tabs. The tool-chain (if that's the right way to describe it) would be:
PB-Source -> PARSE-TO-XML -> [PARSE-TO-HTML | PARSE-TO-OODOC]
First requirement is a way to tokenise PB src and I though there may already be a way to do this. I'm pretty sure someone has already done something similar. Wasn't there a web site for PB source that featured syntax highlighting and preserved spacing?
FYI - I have a large amount of PB source that I want to document so I can dump some on my web site and also include in a pdf (via OpenOfficeDoc).
Posted: Thu Apr 27, 2006 4:48 pm
by freak
We have decided to provide the syntax coloring engine of the PureBasic IDE as
a separate dll with the library sdk, to ease tasks like this one.
I have put it up for download here if you want to try it:
http://freak.purearea.net/v4/SyntaxHighlightning.zip
Should be very easy to do the stuff you want with that.
Posted: Thu Apr 27, 2006 6:31 pm
by Flype
very nice freak - thank you.
and if it's possible, can you provide the .lib, please ?
Posted: Thu Apr 27, 2006 7:32 pm
by ts-soft
@freak
thx

Posted: Fri Apr 28, 2006 11:14 am
by dmoc
Freak u r freaking great!

Posted: Wed May 31, 2006 11:34 am
by Flype
Hi Freak,
1
the SyntaxHighlightning DLL doesn't work when in UNICODE mode.
Maybe you can provide 2 internals functions :
SyntaxHighlightA(*hBuf.l, lBuf.l, type.l, *userData)
SyntaxHighlightW(*hBuf.l, lBuf.l, type.l, *userData)
2
And it would be very handy to let the user specify
a *userData field in order to NOT deal with global vars.
Cheers.
Posted: Wed May 31, 2006 1:01 pm
by freak
Yes, unicode input is not supported, but utf8 input is. So you can convert the whole
buffer to utf8, then use the dll and convert the result back to unicode.
I can add a wrapper to do that automatically though.
For the userdata field: Yes, i can add that as well.
But keep in mind, that the dll is not threadsafe, so you can process only one
source at a time anyway, so you may just as well use global variables.
Posted: Thu Jun 01, 2006 10:50 pm
by Flype
thank you freak for the answer.
about userdata, yes, it would be nice. even if it's not threadsafe (not a problem in my case).
and about unicode, no problem, i will convert to utf8 myself.
Posted: Fri Jun 02, 2006 12:06 am
by srod
Freak, this is a fantastic tool to release - thank you.

Posted: Wed Sep 20, 2006 12:16 am
by Shannara
btw: broken link.
Posted: Wed Sep 20, 2006 12:40 am
by freak
The files are included in the PureBasic package (LibrarySDK folder) since v4.