Modified style sheet uses ^K in text export for better parsing of name/args
[newfangle.git] / fangle.ts
blobd720c8160fc0722ddcd6844f1438adf3de646b8f
1 <TeXmacs|1.0.7.10>
3 <style|source>
5 <\body>
6   <\active*>
7     <\src-title>
8       <src-style-file|fangle|0.5>
10       <\src-purpose>
11         Style to be used in literate programs.
12       </src-purpose>
14       <\src-copyright|2009-2011>
15         Sam Liddicott
16       </src-copyright>
18       <\src-license>
19         This <TeXmacs> style file falls under the <hlink|GNU general public
20         license|$TEXMACS_PATH/LICENSE> and comes WITHOUT ANY WARRANTY
21         WHATSOEVER. If you do not have a copy of the license, then write to
22         the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23         Boston, MA 02111-1307, USA.
24       </src-license>
25     </src-title>
26   </active*>
28   <\active*>
29     <\src-comment>
30       The previous release of newfangle did not embed the \<less\>item\<gtr\>
31       tags within the listing to denote a new line. Instead it used tricks to
32       break the environment contents into lines and enumerated over those and
33       emitting an \<less\>item\<gtr\> tag before each one.
35       Such a technique prevented lines from wrapping when typesetting and
36       also prevented users from inserting soft line-breaks (as they can with
37       normal enumerate environments).
39       For these reasons, a change is made to explicitly use the
40       \<less\>item\<gtr\> tag at the beginning of each line in a listing.
41       When the program is extracted from the document:
43       1. lines that do not begin with \<less\>item\<gtr\> will be joined to
44       the previous line by a single space character.
46       2. if the first line does not begin with \<less\>item\<gtr\> then
48       \ \ \ a. if it is not the first instance of a chunk name, it will be
49       joined to the end of the last line of the previous chunk instance
51       Note: if a line is included in another chunk without starting a new
52       line in the including chunk then the included chunk will not start a
53       new line, regardless of whether or not it is prefixed with
54       \<less\>item\<gtr\>
56       \;
58       This sed will convert <TeXmacs> documents from the old to the new
59       format. Within nf-chunk tags it detects the start of a new entry by the
60       preceding blank line and inserts an \<less\>item\<gtr\> tag. It also
61       inserts an \<less\>item\<gtr\> tag right after the start of the
62       nf-chunk tag as this does not have a blank line.
64       <\verbatim>
65         sed -e '
67         /^[[:space:]]*\<less\>\\/nf-chunk/h
69         /^$/{n;/[^ ]/{x;/^[[:space:]]*\<less\>\\\\nf-chunk/{x;s/[[:space:]]*/
70         \<less\>item\<gtr\>/;x};x}}
72         /^[[:space:]]*\<less\>\\\\nf-chunk/{h;n;s/[[:space:]]*/
73         \<less\>item\<gtr\>/}
75         } ' slow.tm
76       </verbatim>
77     </src-comment>
78   </active*>
80   <\active*>
81     <\src-comment>
82       These are our package dependancies
83     </src-comment>
84   </active*>
86   <use-package|std|env|tmdoc-markup>
88   <\active*>
89     <\src-comment>
90       This is a failed attempt to add nf-chunk to the list tag definitions.
91       It does not work and must currently be executed from Tools, Execute,
92       Evaluate Scheme Expression
93     </src-comment>
94   </active*>
96   <extern|(lambda() (define-group enumerate-tag nf-chunk))>
98   <\active*>
99     <\src-comment>
100       The filename macro is intended to format filenames with appropriate
101       visual markup and avoiding confusing insertions of hyphens when the
102       name is split over a line
103     </src-comment>
104   </active*>
106   <assign|filename|<macro|name|<verbatim|<arg|name>>>>
108   <\active*>
109     <\src-comment>
110       The build-in code and verbaitim formats have an unpleasant line spacing
111     </src-comment>
112   </active*>
114   <assign|old-code|<value|code>>
116   <assign|code|<macro|x|<with|par-par-sep|0fn|<compound|old-code|<arg|x>>>>>
118   <assign|old-verbatim|<value|verbatim>>
120   <assign|verbatim|<macro|x|<with|par-par-sep|0fn|<compound|old-verbatim|<arg|x>>>>>
122   <\active*>
123     <\src-comment>
124       This style renders causes hyperlinks to show the URL in a footnote -
125       very useful for printed text and while <TeXmacs> PDF output does not
126       support hyperlink clicking
127     </src-comment>
128   </active*>
130   <assign|old-hlink|<value|hlink>>
132   <assign|hlink|<macro|t|l|<old-hlink|<arg|t>|<arg|l>><\footnote>
133     <arg|l>
134   </footnote>>>
136   <assign|old-render-footnote|<value|render-footnote>>
138   <assign|render-footnote|<macro|nr|x|<specific|html|\<less\>table
139   width="30%" align="right"\<gtr\>\<less\>tr\<gtr\>\<less\>td\<gtr\>><assign|zz|<arg|nr>><with|footnote-sep|<macro|<specific|html|<value|zz>>.
140   >|<old-render-footnote|<arg|nr>|<arg|x>>><specific|html|\<less\>/td\<gtr\>\<less\>/tr\<gtr\>\<less\>/table\<gtr\>>>>
142   <\active*>
143     <\src-comment>
144       Now, some extensions to standard <TeXmacs> functionality.
146       \ - the get-binding trick to extract a page number is kindly given by
147       Joris who gave us so much already.
149       I would rather ispageref? just made the first test comparing to uninit
150       (the red question mark) so that real but un-placed page refs would
151       still be recognized as a pageref - however I have found documents with
152       stale labels - that no longer exist in the document but which are still
153       stored in the document references section with a target page of ?
155       --- additional note: I have found that stale labels are now not even
156       reverting to ? but retain the last known value. The only fix is to
157       insert \<less\>assign\|save-aux\|false\<gtr\> in the pre-amble and hope
158       that it works (it often doesn't) so that page references are not saved
159       at all but created from scratch each time - avoiding the problem of
160       stale labels as they won't get created!
161     </src-comment>
162   </active*>
164   <assign|ispageref?|<macro|x|<and|<not|<equal|<uninit>|<pagerefpage|<arg|x>>>>|<not|<equal|?|<pagerefpage|<arg|x>>>>>>>
166   <\active*>
167     <\src-comment>
168       Joris tells me:
170       <\verbatim>
171         Page references are links, defined by the following macro:
173         \ \ \ (macro "x"
175         \ \ \ \ \ (locus (id (hard-id (arg "x")))
177         \ \ \ \ \ \ \ \ \ \ \ \ (hyperlink (id (hard-id (arg "x")))
179         \ \ \ \ \ (url (merge "#" (arg "x"))))
181         (get-binding (arg "x") "1")))
182       </verbatim>
184       which leads to this definition if pagerefpage whose job it is to give
185       the page number for a label (as it was last calculated to be).\ 
187       This is useful when constructing our own labels that consist of the
188       page number and a sub-page counter of the target.
189     </src-comment>
190   </active*>
192   <assign|pagerefpage|<macro|x|<get-binding|<arg|x>|1>>>
194   <\active*>
195     <\src-comment>
196       These next macros control how a code chunk is rendered on the screen,
197       and could legitimately be re-defined in the document.
198     </src-comment>
199   </active*>
201   <\active*>
202     <\src-comment>
203       nf-framed-table defines the format of the single cell that used to hold
204       the listing. The listing is no longer defined in a cell, but we still
205       draw top and bottom borders.
207       Currenly we can't draw left and right borders.
208     </src-comment>
209   </active*>
211   <assign|nf-cell-border|0.5ln>
213   <assign|nf-cell-no-border|0.0ln>
215   <assign|nf-cell-top-border|<value|nf-cell-border>>
217   <assign|nf-cell-left-border|<value|nf-cell-border>>
219   <assign|nf-cell-bottom-border|<value|nf-cell-no-border>>
221   <assign|nf-cell-right-border|<value|nf-cell-border>>
223   <\active*>
224     <\src-comment>
225       DEPRACATED: nf-framed-fragment defines the listing to be rendered in a
226       table with a single cell.
227     </src-comment>
228   </active*>
230   <assign|nf-framed-table|<macro|x|<with|color|dark
231   grey|<tformat|<twith|table-width|1par>|<cwith|1|-1|1|-1|cell-hyphen|t>|<cwith|1|-1|1|-1|cell-bsep|1spc>|<cwith|1|-1|1|-1|cell-tsep|1spc>|<cwith|1|-1|1|-1|cell-background|white>|<cwith|1|-1|1|-1|cell-lborder|<value|nf-cell-left-border>>|<cwith|1|-1|1|-1|cell-rborder|<value|nf-cell-right-border>>|<cwith|1|-1|1|-1|cell-bborder|<value|nf-cell-bottom-border>>|<cwith|1|-1|1|-1|cell-tborder|<value|nf-cell-top-border>>|<arg|x>>>>>
233   <\active*>
234     <\src-comment>
235       DEPREACTED: nf-framed-fragment defines the listing to be rendered in a
236       table with a single cell.\ 
238       As we currently use \<less\>wide-underlined\<gtr\> or
239       \<less\>wide-bothlined\<gtr\> to draw the lines this is done on lines
240       before and after the listing by underlining the header and a following
241       blank line, so nf-framed-fragment is currently null.
242     </src-comment>
243   </active*>
245   <assign|nf-framed-fragment-old|<macro|x|<nf-framed-table|<tformat|<table|<row|<\cell>
246     <with|color|black|<arg|x>>
247   </cell>>>>>>>
249   <assign|nf-framed-fragment|<macro|x|<arg|x>>>
251   <\active*>
252     <\src-comment>
253       prog-f renders a body in prog mode with specified language and without
254       a ghastly par-par-sep
255     </src-comment>
256   </active*>
258   <assign|prog-f|<macro|lang|body|<with|mode|prog|prog-language|<arg|lang>|<with|par-par-sep|0fn|<arg|body>>>>>
260   <\active*>
261     <\src-comment>
262       nf-border-if takes a boolean and then returns a correct width to show
263       (or not show) a border -- either as a table sell or a wide-underlined
264     </src-comment>
265   </active*>
267   <assign|nf-border-if|<macro|x|<if|<arg|x>|<value|nf-cell-border>|<value|nf-cell-no-border>>>>
269   <\active*>
270     <\src-comment>
271       ???prog-fragment is the top level macro used for rendering a listing
272       (without line numbers). It renders prog-f within a framed fragment.
273     </src-comment>
274   </active*>
276   <assign|prog-fragment|<\macro|name|lang|x>
277     <with|nf-cell-top-border|<nf-border-if|<compound|nf-first-chunklet?|<arg|name>>>|nf-cell-bottom-border|<nf-border-if|<nf-last-chunklet?|<arg|name>>>|<nf-framed-fragment|<compound|prog-f|<arg|lang>|<arg|x>>>>
278   </macro>>
280   <assign|nf-pf|<macro|name|lang|x|<nf-framed-fragment|<prog-f|<arg|lang>|<arg|x>>>>>
282   <\active*>
283     <\src-comment>
284       ???Numbering the listing
285     </src-comment>
286   </active*>
288   <assign|nflp|<macro|x|<arg|x>>>
290   <\active*>
291     <\src-comment>
292       Forgot what nf-chunk is for
293     </src-comment>
294   </active*>
296   <new-counter|nf-chunk>
298   <\active*>
299     <\src-comment>
300       The noweb format that we follow names listings after the page number
301       followed by an alpha-counter that is reset on each page; e.g. 12a then
302       12b, 12c and then on page 13 back to 13a
304       As there is no trigger called on a new page that can help us, we
305       instead store the page number as we process each chunk so that we can
306       tell when a chunk is on a different page to the previous chunk --- in
307       order to reset the alpha-counter.
308     </src-comment>
309   </active*>
311   <assign|nf-page|0>
313   <\active*>
314     <\src-comment>
315       Chunks have a name which is provided by the user, but more than one
316       chunk can have the same name. These are called chunklets of the same
317       chunk.
319       Although chunklets have the same name, they have a different id, which
320       is the name with a specified prefix, and a suffix which is the chunklet
321       sequence number.
323       nf-chunk-id computes a chunk id from a fixed "code-" namespace, a
324       supplied "tag" namespace name, the name and the chunklet number
325     </src-comment>
326   </active*>
328   <assign|nf-chunk-id|<macro|name|tag|n|<merge|code-|<arg|tag>|-|<unquote|<arg|name>>|-|<arg|n>>>>
330   <\active*>
331     <\src-comment>
332       nf-this-chunk-id is a convenience that uses the counter for the current
333       chunklet. (Each chunk has it's own counter to count it's chunklets)
335       ???Possibly unquote should be used by the called and not here
336     </src-comment>
337   </active*>
339   <assign|nf-this-chunk-id|<macro|name|tag|<nf-chunk-id|<arg|name>|<arg|tag>|<compound|<merge|the-code-chunk-|<unquote|<arg|name>>>>>>>
341   <\active*>
342     <\src-comment>
343       Simple way to discover if we are processing the first chunklet of a
344       named chunk - by checking it's chunklet counter.
345     </src-comment>
346   </active*>
348   <assign|nf-first-chunklet?|<macro|name|<equal|<compound|<merge|the-code-chunk-|<unquote|<arg|name>>>>|1>>>
350   <\active*>
351     <\src-comment>
352       Simple way to discover if we are processing the last chunklet of a
353       named chunk - by checking if there is a chunklet with an increased
354       counter
355     </src-comment>
356   </active*>
358   <assign|nf-last-chunklet?|<macro|name|<not|<compound|nf-chunklet-exists?|<nf-chunk-id|<arg|name>|ref|<plus|<compound|<merge|the-code-chunk-|<unquote|<arg|name>>>>|1>>>>>>
360   <\active*>
361     <\src-comment>
362       Simple way to discover if a chunklet (probably) exists - which is
363       needed to know if we should show a forward reference to the next
364       chunklet. As each chunklet defines a label, we just need to check if
365       there is a pageref to that label.
366     </src-comment>
367   </active*>
369   <assign|nf-chunklet-exists?|<macro|id|<ispageref?|<arg|id>>>>
371   <\active*>
372     <\src-comment>
373       nf-nav renders the links to the previous and next chunklets of this
374       chunk (if they exist).
376       Looks like this: <math|\<vartriangleleft\>>7b
377       7d<math|\<vartriangleright\>>
378     </src-comment>
379   </active*>
381   <assign|nf-prev-chunk-id|<macro|name|<nf-chunk-id|<arg|name>|ref|<minus|<compound|<merge|the-code-chunk-|<unquote|<arg|name>>>>|1>>>>
383   <assign|nf-next-chunk-id|<macro|name|<nf-chunk-id|<arg|name>|ref|<plus|<compound|<merge|the-code-chunk-|<unquote|<arg|name>>>>|1>>>>
385   <assign|nf-nav|<style-with|src-compact|none|<macro|name|<style-with|src-compact|all|<if|<not|<nf-first-chunklet?|<arg|name>>>|<if|<equal|<pagerefpage|<nf-prev-chunk-id|<arg|name>>>|<pagerefpage|<nf-this-chunk-id|<arg|name>|label>>>|<math|\<vartriangle\>>|<math|\<vartriangleleft\>>><reference|<nf-prev-chunk-id|<arg|name>>>>><if|<compound|nf-chunklet-exists?|<nf-next-chunk-id|<arg|name>>>|
386   <reference|<nf-next-chunk-id|<arg|name>>><if|<equal|<pagerefpage|<nf-next-chunk-id|<arg|name>>>|<pagerefpage|<nf-this-chunk-id|<arg|name>|label>>>|<math|\<triangledown\>>|<math|\<vartriangleright\>>>>>>>
388   <\active*>
389     <\src-comment>
390       nf-header renders the single line header before the listing. It lists
391       the reference of this chunk which is the-label (already estiablished by
392       nf-chunk-init) along with the chunk name and language, the chunklet
393       number and a reference to the first chunklet with the same name, and
394       also the chunklet navigation.
396       Like this:\ 
397     </src-comment>
398   </active*>
400   <assign|nf-pad|<macro|w|<if|<not|<less|<arg|w>|1>>|
401   <nf-pad|<minus|<arg|w>|1>>>>>
403   <assign|nf-header|<macro|name|lang|args|<shift|<resize|<specific-verbatim|\<#000A\><nf-pad|<minus|5|<length|<merge|<pagerefpage|<nf-this-chunk-id|<arg|name>|label>>|<number|<the-nf-chunk>|alpha>>>>>><value|the-label>
404   |||0fn|>|-2.0fn|><nv-langle><with|color|blue|<arg|name>>[<compound|<merge|the-code-chunk-|<unquote|<arg|name>>>><style-with|src-compact|none|]><if|<not|<nf-first-chunklet?|<arg|name>>>|<if|<not|<equal|<value|<merge|code-args-|<unquote|<arg|name>>>>|<uninit>>>|(<with|nf-render-commas|<macro|x|<arg|x>>|<nf-commas|<value|<merge|code-args-|<unquote|<arg|name>>>>>>)>
405   <math|\<Uparrow\>><reference|<nf-chunk-id|<arg|name>|ref|1>>|(<nf-commas|<arg|args>>)>,
406   lang=<with|color|blue|<arg|lang>><nv-rangle>
407   <math|<if|<not|<nf-first-chunklet?|<arg|name>>>|+>\<equiv\>><htab|0pt><nf-nav|<arg|name>>>>
409   <assign|nf-render-commas|<macro|x|<with|color|blue|<arg|x>>>>
411   <assign|nf-commas|<macro|items|<if|<equal|<get-label|<arg|items>>|tuple>|<if|<less|<length|<arg|items>>|1>|<specific-verbatim|\<#000B\>>|<nf-render-commas|<look-up|<arg|items>|0>><if|<greater|<length|<arg|items>>|1>|<specific-verbatim|\<#000B\>>,
412   <nf-commas|<range|<arg|items>|1|<length|<arg|items>>>>|<specific-verbatim|\<#000B\>>>>|<arg|items><if|<not|<equal|<length|<arg|items>>|0>>|<specific-verbatim|\<#000B\>>>>>>
414   <assign|nf-commaxy|<macro|x|, (<arg|x>)>>
416   <assign|nf-commax|<xmacro|args|[<arg|args|0><map-args|nf-commaxy|concat|args|1>]>>
418   <assign|bla|<xmacro|args|<arg|args|0>:<arg|args|1>(<arg|args>)>>
420   <\active*>
421     <\src-comment>
422       nf-gather is an attempt to remember each named chunk so that it can
423       optionally be expanded in-place in other chunks. It's a poor attempt
424       and only works for forward uses. Such expansion should be compined with
425       over-brace or side-brace decoration of the included chunk, and also
426       requires that the inline continuation after the expanded chunk continue
427       from the baseline of the expanded chunk instead of the baseline before
428       the expanded chunk was included.
429     </src-comment>
430   </active*>
432   <assign|nf-gather|<macro|name|x|lang|<if|<provides|<arg|name>>|<assign|<unquote|<arg|name>>|<value|<arg|name>><unquote|<arg|x>>>|<assign|<unquote|<arg|name>>|<quote|<arg|x>>>>>>
434   <\active*>
435     <\src-comment>
436       nf-chunk-new is called by nf-chunk-init for the first chunklet of a
437       given chunk name - it defines a chunklet counter and a line number
438       counter
439     </src-comment>
440   </active*>
442   <assign|nf-chunk-new|<macro|name|args|<quasi|<new-counter|<merge|code-chunk-|<unquote|<arg|name>>>><new-counter|<merge|code-line-|<unquote|<arg|name>>>><assign|<unquote|<merge|code-item-|<arg|name>>>|<macro|<compound|<unquote|<merge|next-code-line-|<arg|name>>>><render-item|<compound|<unquote|<merge|the-code-line-|<arg|name>>>>>>><compound|<merge|inc-code-chunk-|<unquote|<arg|name>>>><assign|<merge|code-args-|<unquote|<arg|name>>>|<arg|args>>>>>
444   <\active*>
445     <\src-comment>
446       nf-chunk-next is called by nf-chunk-init for the additional chunklets
447       of a given chunk name. \ It increments the chunklet counter
448     </src-comment>
449   </active*>
451   <assign|nf-chunk-next|<macro|name|<compound|<merge|inc-code-chunk-|<unquote|<arg|name>>>>>>
453   <\active*>
454     <\src-comment>
455       nf-check-page uses the label defined in nf-chunk-label to get the
456       number of the page containing this chunk to compare to nf-page (the
457       number of the page containing the previous chunk) to see if this chunk
458       is the first chunk on a page. If so, then the nf-chunk alpha counter is
459       reset, otherwise it is increased.
460     </src-comment>
461   </active*>
463   <assign|nf-check-page|<macro|name|<if|<not|<equal|<value|nf-page>|<pagerefpage|<nf-this-chunk-id|<arg|name>|label>>>>|<reset-nf-chunk><inc-nf-chunk><assign|nf-page|<pagerefpage|<nf-this-chunk-id|<arg|name>|label>>>|<inc-nf-chunk>>>>
465   <\active*>
466     <\src-comment>
467       ???????? Review from here onwards
468     </src-comment>
469   </active*>
471   <\active*>
472     <\src-comment>
473       nf-chunk-ref defines labels and label text so that we can generate
474       references to chunklets in the form
475       \<less\>PAGENO\<gtr\>\<less\>the-nf-chunk\<gtr\> \ e.g. 17a then 17b
476       etc.
478       The label text is stored in the-chunk-label which is used by XXX. It
479       then creates a label (with the tag ref) of the form code-ref-NAME-NO
480       which is a bit long winded to use with \<less\>reference\|...\<gtr\>
481       and so \<less\>chunk-reference\|...\<gtr\> is provided to help.
483       The ref tagged label is to be used in preference to the label-tagged
484       label created in nf-chunk-label whose only purpose is to find out what
485       page a chunk starts on so that the chunk ref label can be created
486     </src-comment>
487   </active*>
489   <assign|nf-chunk-ref|<macro|name|<nf-check-page|<arg|name>><assign|the-chunk-label|<pagerefpage|<nf-this-chunk-id|<arg|name>|label>><number|<the-nf-chunk>|alpha>><assign|the-label|<value|the-chunk-label>><label|<nf-this-chunk-id|<arg|name>|ref>>>>
491   <\active*>
492     <\src-comment>
493       There seems to be no \<less\>specific\|...\<gtr\> tag for verbatim
494       exports, so we use specific-verbatim. The body is not visible except in
495       text exports.
496     </src-comment>
497   </active*>
499   <assign|specific-verbatim|<macro|x|<clipped|<arg|x>|0|0|0|0>>>
501   <\active*>
502     <\src-comment>
503       except-specific-verbatim is intended to output in all forms except
504       verbatim. This is used because some entities do not have a text
505       representation --- like \<less\>langle\<gtr\> and the fall-back
506       representation is ugly. This macro does not work in page headers, the
507       \<less\>if*\|false\|body\<gtr\> fails to leave the correct space
508     </src-comment>
509   </active*>
511   <assign|except-specific-verbatim|<macro|body|<specific|screen|<arg|body>><specific|printer|<arg|body>><if*|false|<arg|body>>>>
513   <\active*>
514     <\src-comment>
515       nv-langle-subst and lv-rangle-subst define characters that should be
516       output in verbatim mode instead of langle and rangle which would
517       otherwise be output as the literal text rangle and langle
518     </src-comment>
519   </active*>
521   <assign|nv-langle-subst|\<less\>>
523   <assign|nv-rangle-subst|\<gtr\>>
525   <\active*>
526     <\src-comment>
527       nv-langle and nv-rangle are macros that can be used to generate a
528       langle and rangle exceot in text mode were they use the subst
529       characters \<less\> and \<gtr\>
530     </src-comment>
531   </active*>
533   <assign|nv-langle|<macro|<except-specific-verbatim|<with|mode|math|<left|langle>>><specific-verbatim|<value|nv-langle-subst>>>>
535   <assign|nv-rangle|<macro|<except-specific-verbatim|<with|mode|math|<right|rangle>>><specific-verbatim|<value|nv-rangle-subst>>>>
537   <\active*>
538     <\src-comment>
539       nv-render-line-no renders the line numbers for listings in a way that
540       is suitable for typeset and also verbatim export.
541     </src-comment>
542   </active*>
544   <assign|nf-render-line-no|<macro|x|<with|mode|text|par-mode|right|<with|font-family|tt|<with|font-base-size|6|<specific-verbatim|<nf-pad|<minus|3|<length|<value|item-nr>>>>><aligned-space-item|<arg|x>><specific-verbatim|\|
545   >>>><nf-bar>>>
547   <\active*>
548     <\src-comment>
549       A chunklabel is of the form [chunkaname chunkno] e.g. [main.c 1] but
550       it's main purpose is not decorative or visual but as a means to
551       discover the page number containing this chunk so that it can be used
552       by nf-chunk-ref.
553     </src-comment>
554   </active*>
556   <assign|nf-chunk-label|<macro|name|<assign|nf-last-chunk|<arg|name>><assign|the-label|[<arg|name>
557   <compound|<merge|the-code-chunk-|<unquote|<arg|name>>>>]><label|<nf-this-chunk-id|<arg|name>|label>>>>
559   <\active*>
560     <\src-comment>
561       nf-chunk-init is called at the start of nf-chunk to create all
562       neccessary counters and labels. The
563       \<less\>provides\|\<less\>merge\|code-chunk-\|\<less\>unquote\|name\<gtr\>\|-nr\<gtr\>\<gtr\>
564       test could be replaced by some more canonical way to discover if a
565       chunk or chunk counter is defined. It's old code and I don't want to
566       change it now.
567     </src-comment>
568   </active*>
570   <assign|nf-chunk-init|<macro|name|args|<with|nf-same-chunk|<equal|<value|nf-last-chunk>|<arg|name>>|<if|<not|<provides|<merge|code-chunk-|<unquote|<arg|name>>|-nr>>>|<nf-chunk-new|<arg|name>|<arg|args>>|<nf-chunk-next|<arg|name>>><nf-chunk-label|<arg|name>><nf-chunk-ref|<arg|name>><assign|nf-continues|<and|<value|nf-same-chunk>|<not|<equal|<number|<the-nf-chunk>|alpha>|a>>>>>>>
572   <\active*>
573     <\src-comment>
574       nf-chunk-outit is called at the end of nf-chunk mainly to create a
575       label so that we can see if the chunk ended on the same page it began.\ 
576     </src-comment>
577   </active*>
579   <assign|nf-chunk-outit|<macro|name|<label|<nf-this-chunk-id|<arg|name>|end>>>>
581   <\active*>
582     <\src-comment>
583       These macros output either a solid line ________ or a torn-paper-line
584       /\\/\\/\\ at the top and bottom of listins in verbatim mode, to signify
585       if the chunk continues or ends with this chunklet
586     </src-comment>
587   </active*>
589   <assign|nf-jags|<macro|<datoms|<macro|x|<repeat|<arg|x>|<with|gr-geometry|<tuple|geometry|2mm|5mm|center>|gr-mode|<tuple|edit|line>|gr-frame|<tuple|scale|1cm|<tuple|0.589991gw|0.5gh>>|<graphics||<line|<point|0mm|0mm>|<point|1mm|1mm>|<point|2mm|0mm|>>>>>>|<htab|5mm*|last>>>>
591   <assign|nf-bar|<macro|>>
593   <assign|nf-barx|<macro|<merge|<times|<value|font-base-size>|<value|font-size>>|pt><with|gr-geometry|<tuple|geometry|2mm|<merge|<times|<value|font-base-size>|<value|font-size>|1>|pt>|center>|gr-mode|<tuple|edit|line>|line-width|8ln|<graphics||<line|<point|0mm|0mm>|<point|0mm|30pt>>>>>>
595   <assign|nf-verbatim-top|<macro|new|<if|<arg|new>|<specific-verbatim|
596   \ \ \ \ \ ________________________________________________________________________>|<specific-verbatim|
597   \ \ \ \ ./\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\>>>>
599   <assign|nf-verbatim-bottom|<macro|new|<if|<arg|new>|<specific-verbatim|
600   \ \ \ \ \|________________________________________________________________________>|<specific-verbatim|
601   \ \ \ \ \|/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\>>>>
603   <\active*>
604     <\src-comment>
605       nf-chunk is the first public macro. It shows a named listing with all
606       the trimmings.\ 
608       We used to disable the full header if previous chunk on this page had
609       same name and this is not the first chunk on a page
610     </src-comment>
611   </active*>
613   <assign|nf-chunk|<macro|name|x|lang|args|<with|the-label||xnv-langle-subst||xnv-rangle-subst||nf-name|<unquote|<arg|name>>|y|<value|pob>|<small|<surround|<nf-chunk-init|<arg|name>|<arg|args>><wide-underlined|<nf-border-if|<nf-first-chunklet?|<value|nf-name>>>|1ln|<no-page-break*><label|<arg|name>><small|<nf-header|<arg|name>|<arg|lang>|<arg|args>>><no-page-break>>|<if|<nf-last-chunklet?|<value|nf-name>>|<wide-bothlined|<nf-border-if|<nf-last-chunklet?|<value|nf-name>>>|0ln|1ln|0ln|<htab|5mm*|last>>|<nf-jags>>|<\with|item|<value|<merge|code-item-|<unquote|<arg|name>>>>|item-vsep|0fn|current-item|<value|nf-render-line-no>|transform-item|<value|identity>>
614     <\surround||<nf-chunk-outit|<arg|name>><if|<and|<not|<equal|<value|nf-page>|<pagerefpage|<nf-this-chunk-id|<arg|name>|end>>>>|<ispageref?|<nf-this-chunk-id|<arg|name>|end>>>|<set-this-page-header|<with|nv-langle|<macro|<with|mode|math|<left|langle>>>|nv-rangle|<macro|<with|mode|math|<right|rangle>>>|<small|<nf-header|<arg|name>|<arg|lang>|<arg|args>>>>>>>
615       <no-page-break><nf-verbatim-top|<nf-first-chunklet?|<value|nf-name>>>
617       <with|nv-langle-subst|\S|nv-rangle-subst|\T|<nf-pf|<value|nf-name>|<arg|lang>|<arg|x>>>
619       <no-page-break*><if|<nf-last-chunklet?|<value|nf-name>>|<assign|<merge|code-line-|<value|nf-name>|-nr>|0>><nf-verbatim-bottom|<nf-last-chunklet?|<value|nf-name>>>
620     </surround>
621   </with>>>>>>
623   <assign|nf-fake-chunk|<macro|name|x|lang|args|is_last|is_first|<with|the-label||xnv-langle-subst||xnv-rangle-subst||nf-name|<unquote|<arg|name>>|y|<value|pob>|<small|<surround|<wide-underlined|<nf-border-if|<nf-first-chunklet?|<value|nf-name>>>|1ln|<no-page-break*><label|<arg|name>><small|<nf-header|<arg|name>|<arg|lang>|<arg|args>>><no-page-break>>|<if|<arg|is_last>|<wide-bothlined|<nf-border-if|<is-last>>|0ln|1ln|0ln|<htab|5mm*|last>>|<nf-jags>>|<\with|item|<value|<merge|code-item-|<unquote|<arg|name>>>>|item-vsep|0fn|current-item|<value|nf-render-line-no>|transform-item|<value|identity>>
624     <\surround||<nf-chunk-outit|<arg|name>><if|<and|<not|<equal|<value|nf-page>|<pagerefpage|<nf-this-chunk-id|<arg|name>|end>>>>|<ispageref?|<nf-this-chunk-id|<arg|name>|end>>>|<set-this-page-header|<with|nv-langle|<macro|<with|mode|math|<left|langle>>>|nv-rangle|<macro|<with|mode|math|<right|rangle>>>|<small|<nf-header|<arg|name>|<arg|lang>|<arg|args>>>>>>>
625       <no-page-break><nf-verbatim-top|<nf-first-chunklet?|<value|nf-name>>>
627       <with|nv-langle-subst|\S|nv-rangle-subst|\T|<nf-pf|<value|nf-name>|<arg|lang>|<arg|x>>>
629       <no-page-break*><if|<nf-last-chunklet?|<value|nf-name>>|<assign|<merge|code-line-|<value|nf-name>|-nr>|0>><nf-verbatim-bottom|<nf-last-chunklet?|<value|nf-name>>>
630     </surround>
631   </with>>>>>>
633   <new-list|nfl|<value|aligned-dot-item>|<value|identity>>
635   <drd-props|nf-chunk|accessible|all>
637   <assign|nf-comment|<macro|x|<with|mode|text|<specific-verbatim|/*
638   ><arg|x><specific-verbatim| */>>>>
640   <\active*>
641     <\src-comment>
642       nf-ref is the second public macro. It may be inserted into a chunk
643       listing to signify that another listing should be included at that
644       point. As \\ doesn't work in listings you'll have to type meta-\\ \ 
646       This will become an xmacro or something so that it can take optional
647       arguments (like C macros) which will be expanded when the programs are
648       extracted.
649     </src-comment>
650   </active*>
652   <assign|nf-ref|<style-with|src-compact|none|<macro|name|args|<nv-langle><arg|name><if|<equal|<get-label|<arg|args>>|tuple>|<specific-verbatim|\<#000B\>>(<nf-commas|<arg|args>>)>
653   <reference|<nf-chunk-id|<arg|name>|ref|1>><nv-rangle><flag|<arg|name>|red><if|<equal|0|1>|<compound|<quote-arg|name>>>>>>
655   <\active*>
656     <\src-comment>
657       nf-arg is a public macro. It will be replaced by the value of the chunk
658       argument when the code is extracted.
660       I really want to use \<less\>with\|nv-langle\|${\<gtr\> etc, but
661       evaluation of this is deferred until afterwards or something
662     </src-comment>
663   </active*>
665   <assign|nf-arg|<macro|name|<with|nv-langle-subst||nv-rangle-subst||<nv-langle><specific-verbatim|${><with|color|dark
666   green|<with|prog-font-shape|italic|<arg|name>>><specific-verbatim|}><nv-rangle>>>>
668   <\active*>
669     <\src-comment>
670       chunk-reference takes the chunks name and chunklet number and returns a
671       regular reference - like \<less\>reference\|\<gtr\> but calculates the
672       id for you.
673     </src-comment>
674   </active*>
676   <assign|chunk-reference|<macro|name|n|<reference|<nf-chunk-id|<arg|name>|ref|<arg|n>>>>>
678   <assign|chunk-page-reference|<macro|name|n|<pageref|<nf-chunk-id|<arg|name>|ref|<arg|n>>>>>
680   <assign|chunk-page-reference-page|<macro|name|n|<pagerefpage|<nf-chunk-id|<arg|name>|ref|<arg|n>>>>>
682   <\active*>
683     <\src-comment>
684       One day nf-tab will manage proper tab stops and emit a literal TAB
685       character in text mode.
687       Until then, it equals 8 spaces and the sequence 0xE2 0x86 0xA6 must be
688       converted to a tab during untangling
690       nf-untab will output 0xE2 0x86 0xA4 and is a hack; during untanging
691       [[:space:]]*0xE2 0x86 0xA4 will be deleted. This is useful for
692       removeing the indent of here documents in bash scripts
693     </src-comment>
694   </active*>
696   <assign|nf-tab-stop|8>
698   <assign|xafter|<specific-verbatim|\<#000A\> \ \ \ \<#221F\>>>
700   <assign|xnf-tab|<macro|<resize|\<#0009\><with|mode|math|\<mapsto\>>|||<merge|c+|<minus|<value|nf-tab-stop>|<mod|<value|nf-len>|<value|nf-tab-stop>>>|spc>|>>>
702   <assign|nf-tab|<macro|<resize|<with|mode|math|\<mapsto\>>|||8spc|>>>
704   <assign|nf-untab|<macro|<with|mode|math|\<mapsfrom\>>>>
706   <assign|nf-ht|<macro|<extern|(lambda () `(concat "[" ,(string #\\ht)
707   "]"))>>>
708 </body>
710 <\initial>
711   <\collection>
712     <associate|page-medium|automatic>
713     <associate|page-screen-height|746496tmpt>
714     <associate|page-screen-width|1268736tmpt>
715     <associate|preamble|true>
716   </collection>
717 </initial>