external file listing on compile

I’m planning on using scrivener for producing dead-tree program documentation. A common operation will involve copying example code when compiling the document. Ideally, I could automatically pull the listing from working examples so I don’t miss changes.

Is there a way to do this in scrivener directly? Failing that, is there a way to convert project/document references to their paths on compile to address this in TeX or some other downstream utility? I can see the file URL in the list of references, but I don’t know how (or if it’s possible) to reference it in my document.

There isn’t a way of doing that natively yet. Are you using MMD to produce the LaTeX? If so you could put the command right into the text where the code should be inserted, using an HTML comment like so (and of course if you’re composing in LaTeX directly you needn’t do anything special):


To make things easier on yourself, you could codify all of that except for the path into a compile-time Replacement, so that all you have to type in is ^^path/to/code.rb^^, for example:





Thanks for the snippet; it helps a lot!