Including documents from one point to the other end

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Including documents from one point to the other end

aalmiray
Hello everyone,

The `include` directive can be used to include portions of a document either by specifying a line range or a set of tags. I wonder if it's possible to include a document by simply specifying an entry line and have the rest of the document included from there. My use case is to embed a source file but skipping the license header.

An alternative would be to allow the following syntax (borrowed from Groovy) if both ends of the range must be specified

    include::source.java[12..-1]

Thoughts?
Reply | Threaded
Open this post in threaded view
|

Re: Including documents from one point to the other end

LightGuardjp
Administrator
Someone May Say otherwise, but I'm pretty sure you can do a -1 on the last bit of the range. Ruby allows that as well and I remember talking about it. 

Sent from Mailbox for iPhone


On Sat, Feb 15, 2014 at 11:29 AM, aalmiray [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Hello everyone,

The `include` directive can be used to include portions of a document either by specifying a line range or a set of tags. I wonder if it's possible to include a document by simply specifying an entry line and have the rest of the document included from there. My use case is to embed a source file but skipping the license header.

An alternative would be to allow the following syntax (borrowed from Groovy) if both ends of the range must be specified

    include::source.java[12..-1]

Thoughts?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Including-documents-from-one-point-to-the-other-end-tp1480.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Including documents from one point to the other end

mojavelinux
Administrator
As Jason pointed out, your instinct was correct, Andres. You can use -1 to represent the last line of the document. Your example works.

    include::source.java[12..-1]

I added this information to the user manual as it was previously missing.

-Dan


On Sat, Feb 15, 2014 at 11:42 AM, LightGuardjp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Someone May Say otherwise, but I'm pretty sure you can do a -1 on the last bit of the range. Ruby allows that as well and I remember talking about it. 

Sent from Mailbox for iPhone


On Sat, Feb 15, 2014 at 11:29 AM, aalmiray [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Hello everyone,

The `include` directive can be used to include portions of a document either by specifying a line range or a set of tags. I wonder if it's possible to include a document by simply specifying an entry line and have the rest of the document included from there. My use case is to embed a source file but skipping the license header.

An alternative would be to allow the following syntax (borrowed from Groovy) if both ends of the range must be specified

    include::source.java[12..-1]

Thoughts?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Including-documents-from-one-point-to-the-other-end-tp1480.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Including-documents-from-one-point-to-the-other-end-tp1480p1481.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Including documents from one point to the other end

aalmiray
Beautiful! I'll update the Griffon Guide with this new info.

Have I said how much I love working with #asciidoctor already? ;-)

Thanks guys!