I've posted on http://www.lyx.org/trac/attachment/ticket/6137/
my alternative literate programming style with Lyx. I put this together
because literate programming with noweb and Lyx has been absolutely
awful in so many ways - if I wasn't a sed wizard I'd have given up.

I encourage people to try this and to give feedback.

A literate class is no longer used, you can have any document class and
add the "Newfangle Literate Listings" module to your document.

Your document will no longer be the "literate" format, so you add a
build script as a conversion from "Latex" to "Program"

Noweave is not needed, but is (mostly) impemented as Latex macros.

The excellent lstlistings package is used for format the listings; it
has good support for syntax highlighting, line-numbering and so forth.

Because lstlistings is used server-goto-file-row almost works, so
compile errors bring you to the write lstlistings at least - but not the
actual line number,

notangle (which was buggy) is not used to generate the source, instead
an awk script, newfangle, is used, fixing various notangle bugs.

A new style "Chunk" is defined which can be used to easily name your
next lstlisting (otherwise right-clicking and using advanced) is a bit
long winded and you can't see the name you give it once you clicked OK.

Tomorrow I hope to post the chapter that produces a Makefile.inc which
automatically extracts all file sources, and can also glue into another
build system using recursive make (if you are writing literate modules
for an existing project).

Future:
I'm planning to add markup conversions between chunks; so that (for
instance) a shell-script fragment when included into a makefile will
automatically have $ converted to $$, and line endings with a \ for
multi-line shell script. This works nicely with lstlistings language
support.

There's already basic support for including fragments into some comment
contexts:

# <<frag>>
will cause each line of frag to being with #

<<frag>> \
causes each line of frag to end with \, ideal when C code is being
included into a mutli-line C macro.

Sam

Reply via email to