Tags:
create new tag
, view all tags
Though the <verbatim> tags allow for code rendering, this is not enough on many cases in which we want to document, for example, a twiki page.

Also it would be nice to render code, while making comments inside the code pop-out without having to refactor it with a bunch of <verbatim>s and twiki syntax.

So why not a simple addition to the <verbatim> keyword, or even a new keyword that would allow for somewhat arbitrary code syntax, with some basic highlighting.

For example (re-using the <code> tag).

<code comments={";",bold;" //",twiki} end="####">
;this is a comment
here is some code(and, it, is, a, function) // _Don't use or it would erase your HD_
####

Would be rendered as:

;this is a comment
here is some code(and, it, is, a, function) // Don't use or it would erase your HD

I guess it would make programmers that want to use twiki, much more willing to put some stuff in....

I see it as just a bit of perl code ;^), but it would be nice to have a standard syntax inside the core TWiki.

-- EdgarBrown - 15 Jun 2001

There are a lot of source code pretty-printing tools around - typically they render to PostScript, bolding keywords and so on, and are highly configurable, but I'm sure that some of them render to HTML. Why not write a plugin that renders certain text using a pretty-printer? Similar in concept to the LaTeX plugin attached to TWikiPluginAPI, but not requiring any code reformatting.

-- RichardDonkin - 16 Jun 2001

Any good idea for a good open-source code rendering engine?, I have checked a few but haven't found any reasonable one.

-- EdgarBrown - 26 Aug 2001

GNU indent is probably quite good, but I haven't used it for a long time, and it may not suport all the languages you want. This is probably best done as a plugin - most likely you'd have to render each language separately, or do a plug-in parser for each language, but I'm sure CPAN has tools to help with this. Response time might be an issue, of course, but maybe that's not a problem if the snippets are quite short.

Also, <code> is an HTML tag, not a TWiki one, so it would be best to choose a new tag altogether to avoid conflicts IMO. It would also be good to fix VerbatimExpandsVariables, which actually corrupts the display of code, even without pretty printing...

-- RichardDonkin - 27 Aug 2001

I'm doing my best to provide a solution for the VerbatimExpandsVariables...

-- HansDonner - 27 Aug 2001

GNU indent is strictly a C indenting program, that's why I'm asking, all the ones I found are either language-specific (i.e. C, HTML, Perl, or Java), or embeded in the source code of other programs (i.e. vim). I would not like to have a lengthy configuration file, let alone a different chunk of perl code for each language, but it seems the way that all sugestions are headed.

The CPAN modules are no different.

-- EdgarBrown - 27 Aug 2001

As long as we give the code renderers a common interface, it is fine that the implementations are different. Different languages necessarily need to be parsed differently; though the closer that two languages are in structure the more likely they are to be able to share a parser.

It might be worth looking for an editor written in perl; if one exists and it has language syntax highlighting it is likely that that module could be "lifted" and made into a TWiki plug-in.

-- MartinCleaver - 27 Aug 2001

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2001-09-18 - MikeMannix
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.