#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
-\lyxformat 245
+\lyxformat 276
\begin_document
\begin_header
\textclass literate-article
\end_preamble
\language english
\inputencoding default
-\fontscheme default
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
\graphics default
\paperfontsize default
\spacing single
\papersize default
\use_geometry false
\use_amsmath 0
+\use_esint 0
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\papersides 1
\paperpagestyle default
\tracking_changes false
-\output_changes true
+\output_changes false
\end_header
\begin_body
\begin_layout Standard
-\begin_inset LatexCommand \tableofcontents{}
-
+\begin_inset LatexCommand tableofcontents
\end_inset
then reLyX will copy the surrounded code to the output file verbatim.
Given this, the first part of the translation is easy; we simply have to
copy the code chunks into an intermediate file that surrounds them with
+
+\family default
\family typewriter
\backslash
begin{reLyXskip}
\family default
- and
+ and
+\family default
+
\family typewriter
\backslash
.
We want to be able to run it as a simple pre-processor and post-processor
from within reLyX.
- We can accomplish this by setting the flags
+ We can accomplish this by setting the flags
+\family default
+
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
+\color inherit
+and
+\family default
+\color none
+
\color inherit
- and
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
\color inherit
- before we reach the main conversion code.
+before we reach the main conversion code.
\end_layout
\begin_layout Standard
\begin_layout Standard
-While reading in the
+While reading in the
+\family default
+
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
\color inherit
- file, once we have identified a
+file, once we have identified a
\noun on
noweb
\noun default
\noun on
noweb2lyx
\noun default
-, we will use
+, we will use
+\family default
+
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
+\color inherit
+and
+\family default
+\color none
+
\color inherit
- and
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
\color inherit
- to read and write files.
+to read and write files.
In the code fragment above, we need to read from the input file and write
to a file that will be later transformed by reLyX.
If we are being called only to pre-process the input file, then there is
\begin_layout Standard
-This code uses a small perl subroutine,
+This code uses a small perl subroutine,
+\family default
+
\family roman
\series medium
\shape up
\begin_layout Standard
-Finally, we need to close the
+Finally, we need to close the
+\family default
+
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
+\color inherit
+and
+\family default
+\color none
+
\color inherit
- and
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
\color inherit
- files.
+files.
\end_layout
\begin_layout Scrap
\begin_layout Standard
In this section, we describe and implement the code that runs reLyX on the
- intermediate file
+ intermediate file
+\family default
+
\family roman
\series medium
\shape up
\noun on
noweb2lyx
\noun default
- on the
+ on the
+\emph default
+
\emph on
noweb2lyx.nw
\emph default
\begin_layout Standard
-Note that in the perl code that is contained in the
+Note that in the perl code that is contained in the
+\family default
+
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
+\color inherit
+loop above, the perl construct
+\family default
+\color none
+
\color inherit
- loop above, the perl construct
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
\color inherit
- is sufficient to restart the loop.
+is sufficient to restart the loop.
We can use this construct to do some relatively complex parsing of the
reLyX generated file.
\end_layout
\begin_layout Standard
-Setting up the
+Setting up the
+\family default
+
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
+\color inherit
+and
+\family default
+\color none
+
\color inherit
- and
\family roman
\series medium
\shape up
\emph default
\bar default
\noun default
+\color none
+
\color inherit
- is taken care of by this code:
+is taken care of by this code:
\end_layout
\begin_layout Scrap
\noun on
noweb
\noun default
+
+\emph default
\emph on
[[quoted code]]
\begin_layout Standard
-The noweb2lyx script can be tangled from LyX if you set
+The noweb2lyx script can be tangled from LyX if you set
+\family default
+
\family typewriter
\backslash
build_command
\family default
- to call a generic script that always extracts a scrap named
+ to call a generic script that always extracts a scrap named
+\family default
+
\family typewriter
build-script
\family default