I'm trying to make use of code snippets -- small chunks from a larger
file. I'm using sed for this with the sys macro, but I'm wondering if
there is a better way.

For what it's worth, my sed snippets print regex ranges (from the line
containing X to the line containing Y), for example:

[source,javascript]
----
sys::[sed -n '/the game/I,/add(body)/ p' includes/building_an_avatar/avatar.js]
----

I can then do a regular include later for the "let's see the whole
thing" summary. The benefit being that I only have to change things in
one place and can run unit tests -- even for snippets that might not
otherwise compile.

Is there a better way to accomplish the same thing? I'm a little
concerned with cases when a code change results in empty sed output.
I'm also unsure if there may be something that I'm overlooking.

That said, this does seem to work.

-Chris

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

Reply via email to