Hi,
I'm using the Gradle plug in to convert my Asciidoc documents. So my (currently only) adoc file resides under:
{project-dir}/src/docs/asciidoc/sample.adoc
I've also created a directory for code samples where i currently have this file:
{project-dir}/src/docs/asciidoc/code/code-sample.html
Then in my asciidoc file (sample.adoc from above) i have the following Asciidoc markup:
== External code
[source,html,linenums]
----
include::code/code-sample.html[lines=2]
----
All works well and the second line (and only the second line) from my code example is being pulled into the result document. I was wondering if there was a way to preserve the original line numbers from the source code listing (either by declaring an offset similar to ordered lists as Mr. Haki had described here:
http://mrhaki.blogspot.de/2015/02/awesome-asciidoctor-change-start-number.htmlor by providing some kind of macro option that tells Asciidoctor to use the original line numbers from the actual source file.
I'm using Coderay. The top of my document looks like this:
= Sample document with gradle
Alexander Klein
2015-03-03
:icons: font
:numbered:
:doctype: book
The Gradle configuration is this:
asciidoctor {
backends = ['html5']
attributes toc: 'left',
'source-highlighter': 'coderay'
}
I googled a lot and couldn't find how to do this.
Is there already a way to achieve this? Or is it planned for a future release? I think that this would be very useful to document / annotate existing code. I recently had to demonstrate an issue with their code to an external company and quickly created a short Asciidoc document. It worked well but it would have been even better if i could have referrered to their original line numbers.
Many thanks in advance.
Best, Alex