On Jan 11, 2007, at 11:34 PM, Filippo Diotalevi wrote:
On 1/12/07, David Blevins <[EMAIL PROTECTED]> wrote:
Here's the snippet macro's source code if someone happened to have
time and/or ideas on how to make a version that did the same thing
without (or with less obnoxious) tags in source code.
http://svn.atlassian.com/svn/public/contrib/confluence/snippet-
plugin/trunk/
I'm not an expert in Confluence plugins, but I can try to give it a
look and see if it's easy to modify for our needs.
I'm not sure what kind of tags might be better, maybe something
simply smaller might be less obnoxious. Or maybe something might
more sneakily look like an actual comment.
Maybe we could just configure the snippet delimiter at the top of the
class and then strategically use it in the document. Could even be
as short as a single character like '^' or '~'. No real need for a
text prefix with BEGIN and END as you could just parse on/off when
you see the delimiter and then reference the snippets by number.
Don't know what the snippet macro uses for parsing the files, but
with this library parsing with an arbitrary delimiter would be easy
as pie.
http://svn.codehaus.org/swizzle/trunk/swizzle-stream/src/main/java/
org/codehaus/swizzle/stream/StreamLexer.java
You just ...
String delimiter = ...;
StreamLexer lexer = new StreamLexer(delimiter, delimiter);
String firstSnippet = lexer.nextToken();
Or with the begin/end style...
String beginDelimiter = ...;
String endDelimiter = ...;
StreamLexer lexer = new StreamLexer(beginDelimiter, endDelimiter);
String firstSnippet = lexer.nextToken();
-David