Re: [docbook-apps] Better rendering for programlisting
Hi Tom, thanks, now it works. I incorrectly assumed that saxon65.jar just repackages the saxon parser and did not include that into the classpath. Now everything is fine. Thanks again, Lars 2012/5/6 Thomas Schraitle tom_s...@web.de: Hi Lars, Am Sonntag, 6. Mai 2012, 19:02:11 schrieb Lars Vogel: thanks but if I set this up with Saxon 6.5I get an error message from my Ant build file: No adjustColumnWidths function available. Details below. [...] Set tablecolumns.extension=1 and check if you _really_ have the saxon65.jar DocBook extension jar in your classpath. You can find the Jar file in the extensions/ directory of your DocBook XSL distribution. Hope this helps. :) -- Gruß/Regards Thomas Schraitle -- Lars http://www.vogella.com - Eclipse, Android and Java Tutorials http://www.twitter.com/vogella - Lars on Twitter - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
On 06/05/12 01:23, David Cramer wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/05/2012 10:38 AM, davep wrote: 1. Stick with what we have now. 2. Use the table solution and accept the limitation that all lines must always be the same height. Why is this an issue Norm? How often in a fixed width font do users want exponents/Drop caps etc? The callouts cause the lines that contain them to be a little higher than the others, causing the line numbers to become out of whack. If you have more than a couple of callouts, the code listing ends up extending beyond the line numbers and obviously the line numbers aren't accurate. Understood. I viewed them as character glyphs. I'm open to suggestions on 3, but I'm not likely to figure it out myself. Thoughts? Other suggestions? You've obviated the line numbers by putting content in col 2... why not finish the job and put co in col 3? But what if the user wants to put the callout somewhere other than the end of the line? If you do that, you should just abandon callouts and refer to line numbers from a list below the code listing. If you want that you can't let your readers cut and paste as (I think) is the objective here? 'Readers come first'?? regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/06/2012 01:55 AM, davep wrote: On 06/05/12 01:23, David Cramer wrote: ... But what if the user wants to put the callout somewhere other than the end of the line? If you do that, you should just abandon callouts and refer to line numbers from a list below the code listing. If you want that you can't let your readers cut and paste as (I think) is the objective here? 'Readers come first'?? I can think of a few ways to avoid copying callouts, each with tradeoffs: 1. Remove the alt text, so that when the user copies the code listing nothing comes with it, but then you don't have alt text. 2. Use SyntaxHighligher with modifications to allow callouts. This gives you syntax highlighting, line numbering, and copy, but has the tradeoffs mentioned in my previous posting in this thread. 3. a. Put the code listing in the page twice, once formatted however you like with callouts, syntax highlighting, line numbering, etc, and another time completely unmodified. If JavaScript is turned on, hide the unmodified version and show the modified version, but provide a Copy button which copies the content of the unmodified version into the clipboard b. Instead of a Copy button, use a Raw button/link which opens a small window showing the unmodifed version of the listing. And instead of putting the code listing in the page twice, put the unmodified listing in a separate file which is loaded in a new window when the user clicks the Raw link. I think you could do 3.b. with no JavaScript at all. David -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPppfHAAoJEMHeSXG7afUh+lIH/iPw8vHFg+TP6FvSzOKOyZws 4bMfhdFKHckkEQ/nTNuR1afkuYZ/68aQ1HXZDPIugoLHGZitIvicMhfNK0PmFs1P psAdA7msa7lC7Uu4uqAPpjQnkubzEiO7C+R176bV0kubhrwstnTRl50xOo2+w/Zr 48QsNa7CbbA9QPZRmPUpWevOGE3Z9vS432x0utBcmgE5Wx6bxoj6hj0aauWXjLjU ZL1p24qZyMVfF4nU9OjOjvqiW9kXQhBUp+HgM36xVzCo+TdmTPoib13c5jAyZECG f36l4nP6uMPa7DjnBFYT3orX2xue7dJHj53We8GIfojpxzN7qNRjbABF/LefXgo= =SSnZ -END PGP SIGNATURE- - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
Hi Lars, Am Sonntag, 6. Mai 2012, 17:53:35 schrieb Lars Vogel: A bit of topic, but how do I activate line numbers in a program listing? 1. Add the attribute-value pair linenumbering=numbered in programlisting or screen. 2. Use Saxon and put the saxon65.jar DocBook extension in your classpath. Linenumbering won't work with xsltproc currently. 3. Enable linenumbering by using the parameters use.extensions=1 and linenumbering.extension=1 either on the commandline or in your customization layer. 4. Rebuild your document. Hope I didn't forget anything. For more information, see here: http://www.sagehill.net/docbookxsl/AnnotateListing.html#LineNumbering Have fun! :-) -- Gruß/Regards Thomas Schraitle - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
Hi Tom, thanks but if I set this up with Saxon 6.5I get an error message from my Ant build file: No adjustColumnWidths function available. Details below. Best regards, Lars Full error message: build-html: [xslt] Transforming into /home/vogella/workspace/docu/output/website/articles [xslt] Processing /home/vogella/workspace/docu/output/website.tmp/Android/article.xml to /home/vogella/workspace/docu/output/website/articles/Android/article.html [xslt] Loading stylesheet /home/vogella/workspace/docu/de.vogella.publishing/mystylesheets/myhtmldocbook.xsl [xslt] Loading Xslthl configuration from file:/home/vogella/workspace/docu/de.vogella.publishing/docbook-xsl-1.76.1/highlighting/xslthl-config.xml... [xslt] No adjustColumnWidths function available. [xslt] Failed to process null Here is the relevant part of my Ant Build file: target name=build-html depends=copybookimages, copyvgwort, copyadvertisement, copystaticfiles, copyimages, xinclude, remove-space, build-htmlbook description=Generates HTML files from DocBook XML xslt style=${myhtml.stylesheet} extension=.html basedir=${outputtmp.dir} destdir=${article.dir} include name=**/*article.xml / param name=html.stylesheet expression=${stylesheet} / param name=section.autolabel expression=1 / param name=section.label.includes.component.label expression=1 / param name=make.valid.html expression=1 / param name=html.cleanup expression=1 / param name=chunker.output.encoding expression=UTF-8 / param name=highlight.source expression=1 / param name=highlight.xslthl.config expression=${xslthl.config.url} / param name=highlight.default.language expression=java / param name=ignore.image.scaling expression=1 / param name=use.extensions expression=1 / param name=linenumbering.extension expression=1 / outputproperty name=indent value=yes / classpath refid=saxon.class.path / /xslt !-- Copy the stylesheet to the top level directory-- copy todir=${article.dir}/.. fileset dir=lib include name=styles.css / /fileset /copy /target 2012/5/6 Thomas Schraitle tom_s...@web.de: Hi Lars, Am Sonntag, 6. Mai 2012, 17:53:35 schrieb Lars Vogel: A bit of topic, but how do I activate line numbers in a program listing? 1. Add the attribute-value pair linenumbering=numbered in programlisting or screen. 2. Use Saxon and put the saxon65.jar DocBook extension in your classpath. Linenumbering won't work with xsltproc currently. 3. Enable linenumbering by using the parameters use.extensions=1 and linenumbering.extension=1 either on the commandline or in your customization layer. 4. Rebuild your document. Hope I didn't forget anything. For more information, see here: http://www.sagehill.net/docbookxsl/AnnotateListing.html#LineNumbering Have fun! :-) -- Gruß/Regards Thomas Schraitle - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org -- Lars http://www.vogella.com - Eclipse, Android and Java Tutorials http://www.twitter.com/vogella - Lars on Twitter - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
Hi Lars, Am Sonntag, 6. Mai 2012, 19:02:11 schrieb Lars Vogel: thanks but if I set this up with Saxon 6.5I get an error message from my Ant build file: No adjustColumnWidths function available. Details below. [...] Set tablecolumns.extension=1 and check if you _really_ have the saxon65.jar DocBook extension jar in your classpath. You can find the Jar file in the extensions/ directory of your DocBook XSL distribution. Hope this helps. :) -- Gruß/Regards Thomas Schraitle - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
[docbook-apps] Better rendering for programlisting
Hello world, The current rendering for verbatim environments, when line numbers are enabled, has a significant deficiency: you can't cut-and-paste the listing without also getting the line numbers and separators. Looking around at other sites with numbered program listings, the solution seems to be to use tables. Put the line numbers in the first column and the listing in the second. That works, mostly, but if anything in the listing causes a variation in line height (such as a larger callout), the numbers and the lines get out of sync. Using one-line-per-row fixes this, but then cut-and-paste doesn't work again; the selection crosses over all the columns in each row. An alternative solution uses nested divs and some slightly fancy CSS. Naturally, it doesn't work in IE. I've put an example online: http://nwalsh.com/scratch/out.html The callout graphics in the listing are intentionally broken because that was the easiest way to introduce variation. At this font-size, the callouts are actually ok. So: 1. Stick with what we have now. 2. Use the table solution and accept the limitation that all lines must always be the same height. 3. Find a way to tweak the CSS solution so that IE doesn't fall over I'm open to suggestions on 3, but I'm not likely to figure it out myself. Thoughts? Other suggestions? Be seeing you, norm -- Norman Walsh n...@nwalsh.com | Ahhh. A man with a sharp wit. http://www.oasis-open.org/docbook/ | Someone ought to take it away from Chair, DocBook Technical Committee | him before he cuts himself.--Peter | da Silva pgpMnRLPuvKqc.pgp Description: PGP signature
Re: [docbook-apps] Better rendering for programlisting
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/05/2012 08:33 AM, Norman Walsh wrote: That works, mostly, but if anything in the listing causes a variation in line height (such as a larger callout), the numbers and the lines get out of sync. Hi Norm, We encountered the line height problem when we integrated SyntaxHighlighter [1]. Our solution was to make the callout graphics slightly smaller and increase the line spacing slightly. I've posted an example [2] (scroll down to the listing with 11 callouts to see that there is no effect on the line spacing). Note: To use SyntaxHighlighter, we had to modify it so that it ignores callouts when doing the syntax highlighting. There's a slight performance hit since it adds some regular expression that have to be evaluated. Another thing we had to do to make this work is to strip out most markup from code listings. We still allow DocBook markup that ends up bolding text in the code listing, but we strip out markup that doesn't have any presentational effect. Otherwise, it would have required many regular expressions to tell SyntaxHighlighter to skip. One advantage of SyntaxHighlighter is that if you double click the listing, you can copy it without getting the alt text values for the callouts like you do with straight DocBook. David [1] http://alexgorbatchev.com/SyntaxHighlighter/ [2] http://feline.thingbag.net/SyntaxHighlighterTest/content/DB_copy_paste_examples.html -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPpTrzAAoJEMHeSXG7afUhvRYH/1u26Bh/k3jqc3KqLo4/OM9A WSs5wxKod/lpVVx3vawfsGIB4XoT82qfcJa13U+vD0/3fnqiIWa8p9zcAeOn+XNn NZ7B9rxTi+R9DizeNI9PZfjq1aw+0pvF0yV1B+cL92D9evkmeXM/ZW3J3xWiOBkW 7Gf1+5qaiqGn29F7qD6Po70e7gQKPQDt3gIvAAKpMxQqRa6wmT80xLKCR5ujzGrr nhH8QjMCRh7sTVRcS4cv3ihu79+HoysxKFELuDmZv6Da7roHP0Yn7AMIZD4wMRBP CA7qJay3kHGp4bnOJ+DjUcbOOSY22taUHGq+48t7LmcJZ+lcJApbSbRL1ti2Zs4= =N/B3 -END PGP SIGNATURE- - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
On 05/05/12 14:33, Norman Walsh wrote: Hello world, The current rendering for verbatim environments, when line numbers are enabled, has a significant deficiency: you can't cut-and-paste the listing without also getting the line numbers and separators. Looking around at other sites with numbered program listings, the solution seems to be to use tables. Put the line numbers in the first column and the listing in the second. That works, mostly, but if anything in the listing causes a variation in line height (such as a larger callout), the numbers and the lines get out of sync. Using one-line-per-row fixes this, but then cut-and-paste doesn't work again; the selection crosses over all the columns in each row. An alternative solution uses nested divs and some slightly fancy CSS. Naturally, it doesn't work in IE. I've put an example online: http://nwalsh.com/scratch/out.html The callout graphics in the listing are intentionally broken because that was the easiest way to introduce variation. At this font-size, the callouts are actually ok. So: 1. Stick with what we have now. 2. Use the table solution and accept the limitation that all lines must always be the same height. Why is this an issue Norm? How often in a fixed width font do users want exponents/Drop caps etc? 3. Find a way to tweak the CSS solution so that IE doesn't fall over (or chase pixie dust?) I'm open to suggestions on 3, but I'm not likely to figure it out myself. Thoughts? Other suggestions? You've obviated the line numbers by putting content in col 2... why not finish the job and put co in col 3? Then I could cut/paste? HTH regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Better rendering for programlisting
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/05/2012 10:38 AM, davep wrote: 1. Stick with what we have now. 2. Use the table solution and accept the limitation that all lines must always be the same height. Why is this an issue Norm? How often in a fixed width font do users want exponents/Drop caps etc? The callouts cause the lines that contain them to be a little higher than the others, causing the line numbers to become out of whack. If you have more than a couple of callouts, the code listing ends up extending beyond the line numbers and obviously the line numbers aren't accurate. I'm open to suggestions on 3, but I'm not likely to figure it out myself. Thoughts? Other suggestions? You've obviated the line numbers by putting content in col 2... why not finish the job and put co in col 3? But what if the user wants to put the callout somewhere other than the end of the line? If you do that, you should just abandon callouts and refer to line numbers from a list below the code listing. Then I could cut/paste? That should be hard requirement for html outputs. David -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPpcR1AAoJEMHeSXG7afUhXKIH/1SyaZPW2wna9n9ljdoDHHar +7rrfuFZpwPsmhh8rtlIK6x7nGOTXOmMV71Q3BCdS0g0+TUlbmoqmeu5CjLHjf9+ w+9iK6qd0e7acWtym2hOClZqy11XoF5K/00DZAx3h3K2+7izumx45SKQwAtc/dES QiuyAEjcC5fh6KHMoIFXg4aaAMPCrloPKaznpgfv6GT6WA4rvwmhvjmqfvggYNkU UeTLKXUFLBO8XiJum4vHVW9nQqE/Cwhdu62RLqUGslzK23oJKVUM8UZLvJdmtWnQ 73yhf5DfepliU8VQNPvN+n/JYse3z78S89NzlBE0j3++GBVA2+BBxGpNJqQsCDY= =wPhz -END PGP SIGNATURE- - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org