Suppose there is a code:And I want to quote a fragment from it using code tag. Let's say line 5.
I might write: But this displays 01. System.out.println("Hello world!"); .
Is there a way to make it display 05. System.out.println("Hello world!"); ?
Now, according to the SyntaxHighlighter Wiki on configuration options we can add extra configs to the element class as colon separated items. For example if you wanted to remove the "gutter" (line numbers) and the "controls" you'd need the HTML:
At this point I'm feeling confident until I notice that the config item for defining the starting line number is "firstline[x]". So to start a Java snip on line 5 you'd need [ code=java:firstline] which doesn't work because the BB Code closes the code tag on the first closing square bracket. So trying:
I gave you a cow for doing that research. If you or someone else want to write some code, here are the two regular expressions used to do the BB code to HTML translation within JForum. If you feel like changing the regexp to accommodate the extra brackets or write a third section of XML that does it without overlapping the other two, I'm happy to put it in the codebase. (Sorry, I have other things I need to be doing with my actual development time.) If you do decide to implement this, please submit the test cases you used (the BB and output HTML) so I can stick it in our JUnit test suite.
I like this feature because it can be community written and then easily merged into the codebase.
I've confirmed Tim's change works with our software, fixes the problem and doesn't introduce regression errors. (I haven't committed yet because I need to convert the unit test.) But it will be committed today or this weekend and in the next release of our forum software.
Pawel or Tim: Would one of you mind editing the RanchGuide wiki page to document how to use code tags in this "advanced" way?