Syntax mark-up for documenting code?
Syntax mark-up for documenting code?
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!
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).
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).
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.
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.
quidquid Latine dictum sit altum videtur
@freak
thx
thx
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

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.
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.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
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.
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.
quidquid Latine dictum sit altum videtur
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.
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.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer



