diff options
author | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 20:37:12 +0000 |
---|---|---|
committer | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 20:37:12 +0000 |
commit | a9f9ae0efa326dc2edc7f2d92ce270f5fdc15b60 (patch) | |
tree | 3f21ea75ffbd40fcd53bf1609782763af3953002 /include | |
parent | 162643f981292504f375a7f834d408a4a0fa7f46 (diff) | |
download | lout-a9f9ae0efa326dc2edc7f2d92ce270f5fdc15b60.tar.gz |
Lout 3.23.
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/trunk@15 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include')
-rw-r--r-- | include/book | 1 | ||||
-rw-r--r-- | include/bookf | 4 | ||||
-rw-r--r-- | include/bsf | 178 | ||||
-rw-r--r-- | include/doc | 1 | ||||
-rw-r--r-- | include/dsf | 256 | ||||
-rw-r--r-- | include/picture | 1 | ||||
-rw-r--r-- | include/python | 109 | ||||
-rw-r--r-- | include/pythonf | 390 | ||||
-rw-r--r-- | include/report | 1 | ||||
-rw-r--r-- | include/slides | 1 |
10 files changed, 709 insertions, 233 deletions
diff --git a/include/book b/include/book index a41d539..89177be 100644 --- a/include/book +++ b/include/book @@ -59,6 +59,7 @@ # @ListRightIndent { 0s } # right indent of list items # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links } diff --git a/include/bookf b/include/bookf index 4b10ce3..f555e1f 100644 --- a/include/bookf +++ b/include/bookf @@ -545,7 +545,7 @@ def @BookSetup def @BookIntro force into { @IntroColPlace&&preceding } named @Optimize { @OptimizePages } { - @PageMark @Tag + @NoLinkPageMark @Tag // @Before //1.1b @TitlePageFont @Font @On //1.1b @After @@ -605,7 +605,7 @@ def @BookSetup def @BookCombined force into { @ColPlace&&preceding } named @Optimize { @OptimizePages } { - @PageMark @Tag + @NoLinkPageMark @Tag // @Before //1.1b @TitlePageFont @Font @On //1.1b @After diff --git a/include/bsf b/include/bsf index 726058f..1440b82 100644 --- a/include/bsf +++ b/include/bsf @@ -36,6 +36,58 @@ def @OrIfPlain } } + ########################################################################### + # # + # @Colour, @Color # + # # + ########################################################################### + + def @ColourCommand right col + { + def @ColourCoords + { + col @Case { + darkblue @Yield { 0.0 0.0 0.5 } + blue @Yield { 0.0 0.0 1.0 } + lightblue @Yield { 0.5 0.5 1.0 } + darkgreen @Yield { 0.0 0.5 0.0 } + green @Yield { 0.0 1.0 0.0 } + lightgreen @Yield { 0.5 1.0 0.5 } + darkred @Yield { 0.5 0.0 0.0 } + red @Yield { 1.0 0.0 0.0 } + lightred @Yield { 1.0 0.5 0.5 } + darkcyan @Yield { 0.0 0.5 0.5 } + cyan @Yield { 0.0 1.0 1.0 } + lightcyan @Yield { 0.5 1.0 1.0 } + darkmagenta @Yield { 0.5 0.0 0.5 } + magenta @Yield { 1.0 0.0 1.0 } + lightmagenta @Yield { 1.0 0.5 1.0 } + darkyellow @Yield { 0.5 0.5 0.0 } + yellow @Yield { 1.0 1.0 0.0 } + lightyellow @Yield { 1.0 1.0 0.5 } + darkgray @Yield { 0.2 0.2 0.2 } + gray @Yield { 0.5 0.5 0.5 } + lightgray @Yield { 0.8 0.8 0.8 } + darkgrey @Yield { 0.2 0.2 0.2 } + grey @Yield { 0.5 0.5 0.5 } + lightgrey @Yield { 0.8 0.8 0.8 } + black @Yield { 0.0 0.0 0.0 } + white @Yield { 1.0 1.0 1.0 } + } + } + + col @Case { + nochange @Yield { nochange } + else @Yield { @BackEnd @Case { + PostScript @Yield { @ColourCoords setrgbcolor } + PDF @Yield { @ColourCoords rg @ColourCoords RG } + PlainText @Yield "" + } } + } + } + + def @Colour @Color left col right y { {@ColourCommand col} @SetColour y } + export i c p m s v f def @LengthUnits { @@ -124,9 +176,9 @@ export @Date @Time @DateTimeFormat @DropCapTwo @DropCapThree @Centre @Right @NoDotSep @NoDotJoin @Join @Sep @DotSep @DotJoin @DashJoin @NumSep - @OverStrike @Sup @Sub @Colour @FullWidthRule @LocalWidthRule + @OverStrike @Sup @Sub @FullWidthRule @LocalWidthRule @Box @CurveBox @ShadowBox @BoundaryMarks @NumberMarker @NumberOf - @PageMarker @PageMark @PageOf + @PageMarker @PageMark @NoLinkPageMark @PageOf @CrossLink @BeginDisplayCounter @@ -271,6 +323,9 @@ def @BasicSetup named @ListRightIndent{ 0s } # right indent of list items named @ListLabelWidth { 2.0f @OrIfPlain 5s } # width allowed for list tags named @NumberSeparator{ . } # separates numbers like 2.3.7 + import @BasicSetup + named @CrossLinkFormat + right @Body { @Body } # format for cross links @Begin ########################################################################### @@ -701,56 +756,10 @@ def @BasicSetup ########################################################################### # # - # @Colour, @Color, @AddPaint, @LineWidth # + # @AddPaint, @LineWidth (obsolete), @StrokeCommand # # # ########################################################################### - def @ColourCommand right col - { - def @ColourCoords - { - col @Case { - darkblue @Yield { 0.0 0.0 0.5 } - blue @Yield { 0.0 0.0 1.0 } - lightblue @Yield { 0.5 0.5 1.0 } - darkgreen @Yield { 0.0 0.5 0.0 } - green @Yield { 0.0 1.0 0.0 } - lightgreen @Yield { 0.5 1.0 0.5 } - darkred @Yield { 0.5 0.0 0.0 } - red @Yield { 1.0 0.0 0.0 } - lightred @Yield { 1.0 0.5 0.5 } - darkcyan @Yield { 0.0 0.5 0.5 } - cyan @Yield { 0.0 1.0 1.0 } - lightcyan @Yield { 0.5 1.0 1.0 } - darkmagenta @Yield { 0.5 0.0 0.5 } - magenta @Yield { 1.0 0.0 1.0 } - lightmagenta @Yield { 1.0 0.5 1.0 } - darkyellow @Yield { 0.5 0.5 0.0 } - yellow @Yield { 1.0 1.0 0.0 } - lightyellow @Yield { 1.0 1.0 0.5 } - darkgray @Yield { 0.2 0.2 0.2 } - gray @Yield { 0.5 0.5 0.5 } - lightgray @Yield { 0.8 0.8 0.8 } - darkgrey @Yield { 0.2 0.2 0.2 } - grey @Yield { 0.5 0.5 0.5 } - lightgrey @Yield { 0.8 0.8 0.8 } - black @Yield { 0.0 0.0 0.0 } - white @Yield { 1.0 1.0 1.0 } - } - } - - col @Case { - nochange @Yield { nochange } - else @Yield { @BackEnd @Case { - PostScript @Yield { @ColourCoords setrgbcolor } - PDF @Yield { @ColourCoords rg @ColourCoords RG } - PlainText @Yield "" - } } - } - } - - def @Colour @Color left col right y { {@ColourCommand col} @SetColour y } - def @AddPaint right col { col @Case { @@ -785,6 +794,28 @@ def @BasicSetup } } } + + def @StrokeCommand right linewidth + { + @BackEnd @Case { + PostScript @Yield { + linewidth @Case { + "" @Yield { "stroke" } + none @Yield { } + else @Yield { linewidth "setlinewidth stroke" } + } + } + PDF @Yield { + linewidth @Case { + "" @Yield { "S" } + none @Yield { } + else @Yield { linewidth "w S" } + } + } + else @Yield "" + } + } + ########################################################################### @@ -799,11 +830,11 @@ def @BasicSetup @BackEnd @Case { PostScript @Yield @HExpand { - { "LoutRule" @LineWidth linewidth "stroke" } @Graphic { 0.5p @High } + { "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High } } PDF @Yield @HExpand { - { "0 0 m __xsize 0 l" @LineWidth linewidth "S" } @Graphic { 0.5p @High } + { "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High } } PlainText @Yield { "-" @PlainGraphic 1f @High } @@ -816,11 +847,11 @@ def @BasicSetup @BackEnd @Case { PostScript @Yield { - { "LoutRule" @LineWidth linewidth "stroke" } @Graphic { 0.5p @High } + { "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High } } PDF @Yield { - { "0 0 m __xsize 0 l" @LineWidth linewidth "S" } @Graphic { 0.5p @High } + { "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High } } PlainText @Yield { "-" @PlainGraphic 1f @High } @@ -836,14 +867,14 @@ def @BasicSetup @BackEnd @Case { PostScript @Yield @VContract @HContract 0c @HShift { - {"LoutBox" @AddPaint paint @LineWidth linewidth "stroke"} + {"LoutBox" @AddPaint paint @StrokeCommand linewidth } @Graphic { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } } PDF @Yield @VContract @HContract 0c @HShift { { "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" - @AddPaint paint @LineWidth linewidth "S" } @Graphic + @AddPaint paint @StrokeCommand linewidth } @Graphic { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } } @@ -879,13 +910,13 @@ def @BasicSetup "__div(__mul(11, __xmark), 24) 0" "__xmark 0 c" "h" - @AddPaint paint @LineWidth linewidth "S" + @AddPaint paint @StrokeCommand linewidth } @VContract @HContract 0c @HShift @BackEnd @Case { PostScript @Yield { - {"LoutCurveBox" @AddPaint paint @LineWidth linewidth "stroke"} + {"LoutCurveBox" @AddPaint paint @StrokeCommand linewidth } @Graphic { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } } @@ -1013,7 +1044,7 @@ def @BasicSetup ########################################################################## # # - # @NumberMarker, @NumberOf, @PageMarker, @PageMark, and @PageOf # + # @NumberMarker, @NumberOf, @PageMarker, @PageMark, @PageOf, @CrossLink # # # ########################################################################## @@ -1026,9 +1057,9 @@ def @BasicSetup } def @NumberOf - right x + right tag { - @NumberMarker&&x @Open { @Value } + @NumberMarker&&tag @Open { @Value } } @@ -1042,15 +1073,31 @@ def @BasicSetup } def @PageMark - right x + right tag + { + @Null & tag @LinkDest & @PageMarker&&preceding @Tagged tag + } + + def @NoLinkPageMark + right tag { - @PageMarker&&preceding @Tagged x + @PageMarker&&preceding @Tagged tag } def @PageOf - right x + right tag { - @PageMarker&&x @Open { num } + @PageMarker&&tag @Open { num } + } + + def @CrossLink + left tag + named @Format right @Body { @CrossLinkFormat @Body } + right obj + { + @HContract @VContract { + tag @LinkSource @Format obj + } } @@ -1447,8 +1494,8 @@ def @BasicSetup right x { @NumberMarker&&preceding @Tagged @Tag - // @PageMark @Tag // x + // @PageMark @Tag # weird placement, but @PageMark is definite now } def droplistitem into { @ItemPlace&&preceding } @@ -1457,7 +1504,6 @@ def @BasicSetup { @NumberMarker&&preceding @Tagged @Tag // @PageMark @Tag - // //1vx x } diff --git a/include/doc b/include/doc index 126b8b9..feb50d4 100644 --- a/include/doc +++ b/include/doc @@ -60,6 +60,7 @@ # @ListRightIndent { 0s } # right indent of list items # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links } diff --git a/include/dsf b/include/dsf index b96c427..16a1967 100644 --- a/include/dsf +++ b/include/dsf @@ -2149,6 +2149,7 @@ def @DocumentSetup def @ContentsItem named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2158,17 +2159,24 @@ def @DocumentSetup { def @Leaders { @ContentsLeader &@ContentsLeaderGap @Leaders } + def @OptionalCrossLink right x + { + crosstag @Case { + "" @Yield x + else @Yield { crosstag @CrossLink x } + } + } + def @RightPart { @ContentsRightWidth @Wide { - # &@ContentsLeaderGap @Leaders &@ContentsLeaderGap - &1rt { pagenum //0.5vx } + &1rt { @OptionalCrossLink pagenum //0.5vx } } } def @Item { - |indent number @ContentsFormat @HExpand { + |indent @OptionalCrossLink number @ContentsFormat @HExpand { title & @ContentsLeaderGap @Wide &1rt @OneCol { @Leaders & @RightPart &0io } @@ -2178,19 +2186,9 @@ def @DocumentSetup //pregap //0.5vx - @BackEnd @Case { - { PostScript PlainText } @Yield { - protect @Case { - No @Yield @Item - Yes @Yield @Protect @Item - } - } - PDF @Yield { - protect @Case { - No @Yield { "__link_source=<<"title">>" } @Graphic @Item - Yes @Yield { "__link_source=<<"title">>" } @Graphic { @Protect @Item } - } - } + protect @Case { + No @Yield @Item + Yes @Yield @Protect @Item } //postgap } @@ -2220,6 +2218,7 @@ def @DocumentSetup def @ContentsEntry left wanted named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2229,6 +2228,7 @@ def @DocumentSetup @MakeContents.wanted @Case { Yes.Yes @Yield { @SendContents @ContentsItem indent { indent } + crosstag { crosstag } number { number } title { title } pagenum { pagenum } @@ -2242,6 +2242,7 @@ def @DocumentSetup def @FigureContentsEntry left wanted named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2251,6 +2252,7 @@ def @DocumentSetup @MakeFigureContents.wanted @Case { Yes.Yes @Yield { @SendFigureContents @ContentsItem indent { indent } + crosstag { crosstag } number { number } title { title } pagenum { pagenum } @@ -2264,6 +2266,7 @@ def @DocumentSetup def @TableContentsEntry left wanted named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2273,6 +2276,7 @@ def @DocumentSetup @MakeTableContents.wanted @Case { Yes.Yes @Yield { @SendTableContents @ContentsItem indent { indent } + crosstag { crosstag } number { number } title { title } pagenum { pagenum } @@ -2286,6 +2290,7 @@ def @DocumentSetup def @MajorContentsEntry left wanted named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2295,6 +2300,7 @@ def @DocumentSetup @MakeContents.wanted @Case { Yes.Yes @Yield { @SendContents @ContentsItem indent { indent } + crosstag { crosstag } number { @ContentsFont @Font number } title { @ContentsFont @Font title } pagenum { pagenum } @@ -2367,6 +2373,7 @@ def @DocumentSetup def @BypassContentsEntry into { @ContentsPlace&&preceding } named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2374,6 +2381,7 @@ def @DocumentSetup @MakeContents @Case { Bypass @Yield { @ContentsItem indent { indent } + crosstag { crosstag } number { number } title { title } pagenum { pagenum } @@ -2386,6 +2394,7 @@ def @DocumentSetup def @BypassFigureContentsEntry into { @FigureContentsPlace&&preceding } named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2393,6 +2402,7 @@ def @DocumentSetup @MakeFigureContents @Case { Bypass @Yield { @ContentsItem indent { indent } + crosstag { crosstag } number { number } title { title } pagenum { pagenum } @@ -2405,6 +2415,7 @@ def @DocumentSetup def @BypassTableContentsEntry into { @TableContentsPlace&&preceding } named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2412,6 +2423,7 @@ def @DocumentSetup @MakeTableContents @Case { Bypass @Yield { @ContentsItem indent { indent } + crosstag { crosstag } number { number } title { title } pagenum { pagenum } @@ -2424,6 +2436,7 @@ def @DocumentSetup def @BypassMajorContentsEntry into { @ContentsPlace&&preceding } named indent { 0f } + named crosstag {} named number {} named title {} named pagenum {} @@ -2431,6 +2444,7 @@ def @DocumentSetup @MakeContents @Case { Bypass @Yield { @ContentsItem indent { indent } + crosstag { crosstag } number { @B number } title { @B title } pagenum { pagenum } @@ -2641,7 +2655,7 @@ def @DocumentSetup } } - { @PageMark @Tag @TheoremCounterIncrement @Tag } @Insert + { @PageMark @Tag & @TheoremCounterIncrement @Tag } @Insert @TheoremFormat word { theorem @WordVal @TheoremWord } number { @TheoremNum @Tag } @@ -2700,7 +2714,7 @@ def @DocumentSetup } } - { @PageMark @Tag @DefinitionCounterIncrement @Tag } @Insert + { @PageMark @Tag & @DefinitionCounterIncrement @Tag } @Insert @DefinitionFormat word { definition @WordVal @DefinitionWord } number { @DefinitionNum @Tag } @@ -2755,7 +2769,7 @@ def @DocumentSetup } } - { @PageMark @Tag @ClaimCounterIncrement @Tag } @Insert + { @PageMark @Tag & @ClaimCounterIncrement @Tag } @Insert @ClaimFormat word { claim @WordVal @ClaimWord } number { @ClaimNum @Tag } @@ -2810,7 +2824,7 @@ def @DocumentSetup } } - { @PageMark @Tag @PropositionCounterIncrement @Tag } @Insert + { @PageMark @Tag & @PropositionCounterIncrement @Tag } @Insert @PropositionFormat word { proposition @WordVal @PropositionWord } number { @PropositionNum @Tag } @@ -2865,7 +2879,7 @@ def @DocumentSetup } } - { @PageMark @Tag @LemmaCounterIncrement @Tag } @Insert + { @PageMark @Tag & @LemmaCounterIncrement @Tag } @Insert @LemmaFormat word { lemma @WordVal @LemmaWord } number { @LemmaNum @Tag } @@ -2920,7 +2934,7 @@ def @DocumentSetup } } - { @PageMark @Tag @CorollaryCounterIncrement @Tag } @Insert + { @PageMark @Tag & @CorollaryCounterIncrement @Tag } @Insert @CorollaryFormat word { corollary @WordVal @CorollaryWord } number { @CorollaryNum @Tag } @@ -2975,7 +2989,7 @@ def @DocumentSetup } } - { @PageMark @Tag @ExampleCounterIncrement @Tag } @Insert + { @PageMark @Tag & @ExampleCounterIncrement @Tag } @Insert @ExampleFormat word { example @WordVal @ExampleWord } number { @ExampleNum @Tag } @@ -3063,7 +3077,7 @@ def @DocumentSetup left label right tag { - @RefCiteLabels + tag @CrossLink @RefCiteLabels @RefNum { @NumberOf tag } @Tag { tag } @Type { @Reference&&tag @Open { @Type } } @@ -3324,34 +3338,8 @@ def @DocumentSetup left label right tag { -# -# VT: I can't get this to work, so I've put back the original code -# -# @RefListFont @Font @RefListBreak @Break { -# @BackEnd @Case { -# PostScript @Yield { -# @NumberMarker&&preceding @Tagged tag & -# @PageMark tag -# |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag} -# |@RefListRightIndent -# } -# PDF @Yield { -# { "__link_target=<<"tag">>" } -# @Graphic -# { -# @NumberMarker&&preceding @Tagged tag & -# @PageMark tag -# |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag} -# |@RefListRightIndent -# } -# } -# } -# } -# VT: original: - @RefListFont @Font @RefListBreak @Break { - @NumberMarker&&preceding @Tagged tag & - @PageMark tag + @NumberMarker&&preceding @Tagged tag & @PageMark tag |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag} |@RefListRightIndent } @@ -3470,20 +3458,8 @@ def @DocumentSetup def ";" precedence 90 left x { x";" } @MakeReferences @Case { -# Yes @Yield { @RefCiteStyle cite } Yes @Yield { - @BackEnd @Case { - { PlainText PostScript } @Yield { @RefCiteStyle cite } - PDF @Yield { -# -# VT: can't get this to work: need to ask JHK; I want the text following the "$" to be -# the name of the link that we are trying to create a link to -# { "__link_source=<<"label">>" } -# @Graphic - { @RefCiteStyle cite } -# { blue @Colour @Underline { @RefCiteStyle cite } } - } - } + @RefCiteStyle cite } else @Yield @Null } @@ -3666,6 +3642,7 @@ def @DocumentSetup { @MakeFigureContents @FigureContentsEntry indent { 0f } + crosstag { @Tag } number { @FigureNumber } title { @InitialLanguage @Language @ContentsCaption } pagenum { @PageOf @Tag } @@ -3910,6 +3887,7 @@ def @DocumentSetup { @MakeTableContents @TableContentsEntry indent { 0f } + crosstag { @Tag } number { @TableNumber } title { @InitialLanguage @Language @ContentsCaption } pagenum { @PageOf @Tag } @@ -4030,7 +4008,6 @@ def @DocumentSetup { // @IndexBreak @Break @IndexList // @IndexBreak @Break @BypassIndexList - # //1vx --- "@Clear" // @ClearHeaderComponent // etc } @@ -4094,7 +4071,7 @@ def @DocumentSetup right y { @MakeIndex @Case { - Yes @Yield { {@PageMark @Tag} x @DoIndex stem { y } indent { indent } y } + Yes @Yield { @PageMark @Tag & x @DoIndex stem { y } indent { indent } y } else @Yield @Null } } @@ -4109,16 +4086,21 @@ def @DocumentSetup named to {} right y { - def pagerange + def @PgMk right tag + { + tag @CrossLink @PageOf tag + } + + def @PgRange { to @Case { - "" @Yield @PageOf @Tag + "" @Yield @PgMk @Tag else @Yield { { @PageOf @Tag } @Case { - { @PageOf to } @Yield { @PageOf @Tag } - else @Yield { {@PageOf @Tag}--{@PageOf to} } + { @PageOf to } @Yield { @PgMk @Tag } + else @Yield { {@PgMk @Tag}--{@PgMk to} } } } } @@ -4126,22 +4108,10 @@ def @DocumentSetup @MakeIndex @Case { - Yes @Yield { @BackEnd @Case { - - { PostScript PlainText } @Yield { - @PageMark @Tag - x @DoIndex stem { y } indent { indent } { y &"0.03fu" , pagerange } - } - - PDF @Yield { - {"__link_target=<<"@Tag">>"} @Graphic {""} - @PageMark @Tag - x @DoIndex stem { y } indent { indent } { - y &"0.03fu" , { "__link_source=<<"@Tag">>" } - @Graphic { blue @Colour @Underline pagerange } - } - } - } } + Yes @Yield { + @PageMark @Tag & + x @DoIndex stem { y } indent { indent } { y &"0.03fu" , @PgRange } + } else @Yield @Null } } @@ -4214,7 +4184,7 @@ def @DocumentSetup right y { @MakeIndexA @Case { - Yes @Yield { {@PageMark @Tag} x @DoIndexA indent { indent } y } + Yes @Yield { @PageMark @Tag & x @DoIndexA indent { indent } y } else @Yield @Null } } @@ -4229,16 +4199,21 @@ def @DocumentSetup named to {} right y { - def pagerange + def @PgMk right tag + { + tag @CrossLink @PageOf tag + } + + def @PgRange { to @Case { - "" @Yield @PageOf @Tag + "" @Yield @PgMk @Tag else @Yield { { @PageOf @Tag } @Case { - { @PageOf to } @Yield { @PageOf @Tag } - else @Yield { {@PageOf @Tag}--{@PageOf to} } + { @PageOf to } @Yield { @PgMk @Tag } + else @Yield { {@PgMk @Tag}--{@PgMk to} } } } } @@ -4246,22 +4221,10 @@ def @DocumentSetup @MakeIndexA @Case { - Yes @Yield { @BackEnd @Case { - - { PostScript PlainText } @Yield { - @PageMark @Tag - x @DoIndexA indent { indent } { y &"0.03fu" , pagerange } - } - - PDF @Yield { - {"__link_target=<<"@Tag">>"} @Graphic {""} - @PageMark @Tag - x @DoIndexA indent { indent } { - y &"0.03fu" , { "__link_source=<<"@Tag">>" } - @Graphic { blue @Colour @Underline pagerange } - } - } - } } + Yes @Yield { + @PageMark @Tag & + x @DoIndexA indent { indent } { y &"0.03fu" , @PgRange } + } else @Yield @Null } } @@ -4334,7 +4297,7 @@ def @DocumentSetup right y { @MakeIndexB @Case { - Yes @Yield { {@PageMark @Tag} x @DoIndexB indent { indent } y } + Yes @Yield { @PageMark @Tag & x @DoIndexB indent { indent } y } else @Yield @Null } } @@ -4349,16 +4312,21 @@ def @DocumentSetup named to {} right y { - def pagerange + def @PgMk right tag + { + tag @CrossLink @PageOf tag + } + + def @PgRange { to @Case { - "" @Yield @PageOf @Tag + "" @Yield @PgMk @Tag else @Yield { { @PageOf @Tag } @Case { - { @PageOf to } @Yield { @PageOf @Tag } - else @Yield { {@PageOf @Tag}--{@PageOf to} } + { @PageOf to } @Yield { @PgMk @Tag } + else @Yield { {@PgMk @Tag}--{@PgMk to} } } } } @@ -4366,22 +4334,10 @@ def @DocumentSetup @MakeIndexB @Case { - Yes @Yield { @BackEnd @Case { - - { PostScript PlainText } @Yield { - @PageMark @Tag - x @DoIndexB indent { indent } { y &"0.03fu" , pagerange } - } - - PDF @Yield { - {"__link_target=<<"@Tag">>"} @Graphic {""} - @PageMark @Tag - x @DoIndexB indent { indent } { - y &"0.03fu" , { "__link_source=<<"@Tag">>" } - @Graphic { blue @Colour @Underline pagerange } - } - } - } } + Yes @Yield { + @PageMark @Tag & + x @DoIndexB indent { indent } { y &"0.03fu" , @PgRange } + } else @Yield @Null } } @@ -4537,6 +4493,7 @@ def @DocumentSetup Yes.Minor @Yield { incontents @ContentsEntry indent { contentsindent } + crosstag { tag } number { @LongNum } title { initiallanguage @Language title } pagenum { @PageOf tag } @@ -4544,6 +4501,7 @@ def @DocumentSetup { Yes.Major Yes.MajorIntro Yes.ExtraMajor Yes.ExtraMajorIntro } @Yield { incontents @MajorContentsEntry + crosstag { tag } number { @LongNum } title { initiallanguage @Language title } pagenum { @PageOf tag } @@ -4560,61 +4518,30 @@ def @DocumentSetup def @Heading { - def @AttachPDFLink - left title - right x - { - @BackEnd @Case { - - # VTan: Rats! Cannot use the tag for the name of the link - # because the source link has no access to the tag - # - # using title will work most of the time; it will fail - # with a "problem with left parameter of @Graphic" warning - # message if the title has objects other than text in it. - # Eg, "@Title { My @FancyTitle }" with - # "def @FancyTitle { @OneCol { @Bold "fancy" "title" }" } - # - # Example: the user manual has a definition for @Tex which - # causes this warning message to appear - - PDF @Yield { - title @Case { - "" @Yield x - else @Yield { - "__link_target_for_export=<<"title">>" - @Graphic x - } - } - } - - else @Yield x - } - } type @Case { - Minor @Yield title @AttachPDFLink { + Minor @Yield { headingfont @Font headingbreak @Break @Protect {@LongNum headingformat title} // @PageMark tag } { Major MajorIntro ExtraMajor ExtraMajorIntro } @Yield { - sendheader { title @AttachPDFLink { + sendheader { //aboveheadinggap headingfont @Font headingbreak @Break { @LongNum headingformat title } // @PageMark tag - } } + } } - { VeryMajor } @Yield { sendheader { title @AttachPDFLink { + { VeryMajor } @Yield { sendheader { //aboveheadinggap headingfont @Font headingbreak @Break { bypassnumber headingformat title } // @PageMark tag - } } + } } } } @@ -4643,7 +4570,6 @@ def @DocumentSetup // numbers @Do { attachnum & @NumberMarker @Tag { tag } @Value { @ShortNum } } - # // @PageMark tag // @IfMajor { @FootNoteThrough @Do @BeginFootNoteCounter } // @Run @StartIfMajor // @ContentsStuff diff --git a/include/picture b/include/picture index f797c49..6ce6885 100644 --- a/include/picture +++ b/include/picture @@ -60,6 +60,7 @@ # @ListRightIndent { 0s } # right indent of list items # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links } diff --git a/include/python b/include/python new file mode 100644 index 0000000..0db2ea5 --- /dev/null +++ b/include/python @@ -0,0 +1,109 @@ +############################################################################### +# # +# Lout setup file for Python program printing # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +############################################################################### + + +############################################################################### +# # +# @SysInclude line # +# # +# This line causes Lout to read the definitions for this programming # +# language, and should not be touched. # +# # +############################################################################### + +@SysInclude { pythonf } + + +############################################################################### +# # +# @Use clause # +# # +# To change the default value of any option, delete the # at the start of # +# its line and change the value between braces. # +# # +############################################################################### + +@Use { @PythonSetup + # pipe { } # pipe source through this + # numbered { No } # No, Yes, or a line number + # style { varying @OrIfPlain fixed } # fixed, varying, or symbol + + # the following options apply when style is "fixed" + + # fixedfont { Courier } # font family + # fixedsize { -1.0p } # font size + # fixedline { 1.0vx } # line-space + # fixedtabin { 8 } # tab interval + # fixedtabout { 8s } # tab width + + # fixedidentifiers { Base } # identifier face + # fixedkeywords { Base } # keyword face + # fixedoperators { Base } # operator face + # fixednumbers { Base } # number face + # fixedstrings { Base } # string face + # fixedcomments { Base } # comment face + # fixedlinenumbers { Base } # line numbers face + + # fixedidentifiersformat { @Body } # identifiers format + # fixedkeywordsformat { @Body } # keywords format + # fixedoperatorsformat { @Body } # operators format + # fixednumbersformat { @Body } # numbers format + # fixedstringsformat { @Body } # strings format + # fixedcommentsformat { @Body } # comments format + # fixedlinenumbersformat { @Body } # line numbers format + + # the following options apply when style is "varying" + + # varyingfont { } # font family + # varyingsize { 1.0f } # font size + # varyingline { 1.0vx } # line-space + # varyingtabin { 8 } # tab interval + # varyingtabout { 3f } # tab width + + # varyingidentifiers { Slope } # identifier face + # varyingkeywords { Bold } # keyword face + # varyingoperators { Base } # operator face + # varyingnumbers { Base } # number face + # varyingstrings { Slope } # string face + # varyingcomments { Base } # comment face + # varyinglinenumbers { Base } # line numbers face + + # varyingidentifiersformat { @Body } # identifiers format + # varyingkeywordsformat { @Body } # keywords format + # varyingoperatorsformat { @Body } # operators format + # varyingnumbersformat { @Body } # numbers format + # varyingstringsformat { @Body } # strings format + # varyingcommentsformat { @Body } # comments format + # varyinglinenumbersformat { @Body } # line numbers format + + # the following options apply when style is "symbol" + + # symbolfont { } # font family + # symbolsize { 1.0f } # font size + # symbolline { 1.0vx } # line-space + # symboltabin { 8 } # tab interval + # symboltabout { 3f } # tab width + + # symbolidentifiers { Slope } # identifier face + # symbolkeywords { Bold } # keyword face + # symboloperators { Base } # operator face + # symbolnumbers { Base } # number face + # symbolstrings { Slope } # string face + # symbolcomments { Base } # comment face + # symbollinenumbers { Base } # line numbers face + + # symbolidentifiersformat { @Body } # identifiers format + # symbolkeywordsformat { @Body } # keywords format + # symboloperatorsformat { @Body } # operators format + # symbolnumbersformat { @Body } # numbers format + # symbolstringsformat { @Body } # strings format + # symbolcommentsformat { @Body } # comments format + # symbollinenumbersformat { @Body } # line numbers format +} diff --git a/include/pythonf b/include/pythonf new file mode 100644 index 0000000..642cfb3 --- /dev/null +++ b/include/pythonf @@ -0,0 +1,390 @@ + +############################################################################### +# # +# Lout @PythonSetup package for formatting Python programs # +# # +# Version 3.0 # +# Jeffrey H. Kingston # +# 5 April 2000 # +# # +# This package uses a filtered body parameter to convert program source # +# code into Lout source. The filter program is prg2lout, which is # +# distributed with Lout and should be compiled and installed wherever # +# Lout itself is. # +# # +############################################################################### + +export @Python +def @PythonSetup + named pipe { } # pipe through this first + named numbered { No } # want lines numbered? + named style + named @OrIfPlain left x right y + { @BackEnd @Case { PlainText @Yield y else @Yield x } } + { varying @OrIfPlain fixed } # print style + + # the following options apply when style is "fixed" + named fixedfont { Courier }# font family + named fixedsize { -1.0p } # font size + named fixedline { 1.0vx } # line-space + named fixedtabin { 8 } # tab interval + named fixedtabout { 8s } # tab width + + named fixedidentifiers { Base } # identifier face + named fixedkeywords { Base } # keyword face + named fixedoperators { Base } # operator face + named fixednumbers { Base } # number face + named fixedstrings { Base } # string face + named fixedcomments { Base } # comment face + named fixedlinenumbers { Base } # line numbers face + + named fixedidentifiersformat right @Body { @Body } # identifier format + named fixedkeywordsformat right @Body { @Body } # keyword format + named fixedoperatorsformat right @Body { @Body } # operators format + named fixednumbersformat right @Body { @Body } # number format + named fixedstringsformat right @Body { @Body } # string format + named fixedcommentsformat right @Body { @Body } # comment format + named fixedlinenumbersformat right @Body { @Body } # line nums format + + # the following options apply when style is "varying" + named varyingfont { } # font family + named varyingsize { 1.0f } # font size + named varyingline { 1.0vx } # line-space + named varyingtabin { 8 } # tab interval + named varyingtabout { 3f } # tab width + + named varyingidentifiers { Slope } # identifier face + named varyingkeywords { Bold } # keyword face + named varyingoperators { Base } # operator face + named varyingnumbers { Base } # number face + named varyingstrings { Slope } # string face + named varyingcomments { Base } # comment face + named varyinglinenumbers { Base } # line numbers face + + named varyingidentifiersformat right @Body { @Body } # identifier format + named varyingkeywordsformat right @Body { @Body } # keyword format + named varyingoperatorsformat right @Body { @Body } # operators format + named varyingnumbersformat right @Body { @Body } # number format + named varyingstringsformat right @Body { @Body } # string format + named varyingcommentsformat right @Body { @Body } # comment format + named varyinglinenumbersformat right @Body { @Body } # line nums format + + # the following options apply when style is "symbol" + named symbolfont { } # font family + named symbolsize { 1.0f } # font size + named symbolline { 1.0vx } # line-space + named symboltabin { 8 } # tab interval + named symboltabout { 3f } # tab width + + named symbolidentifiers { Slope } # identifier face + named symbolkeywords { Bold } # keyword face + named symboloperators { Base } # operator face + named symbolnumbers { Base } # number face + named symbolstrings { Slope } # string face + named symbolcomments { Base } # comment face + named symbollinenumbers { Base } # line numbers face + + named symbolidentifiersformat right @Body { @Body } # identifier format + named symbolkeywordsformat right @Body { @Body } # keyword format + named symboloperatorsformat right @Body { @Body } # operators format + named symbolnumbersformat right @Body { @Body } # number format + named symbolstringsformat right @Body { @Body } # string format + named symbolcommentsformat right @Body { @Body } # comment format + named symbollinenumbersformat right @Body { @Body } # line nums format + +@Begin + + export + + @PI @PK @PO @PN @PS @PC @PL @PA @PM @PD + @A "$>" + + def @Python + named style { style } # style + named numbered { numbered } # want numbered lines? + named pipe { pipe } # pipe through this first + named font { dft } # font family + named size { dft } # font size + named line { dft } # line-space + named tabin { dft } # tab interval + named tabout { dft } # tab width + named identifiers { dft } # ident. font + named keywords { dft } # keyword font + named operators { dft } # operator font + named numbers { dft } # number font + named strings { dft } # string font + named comments { dft } # comment font + named linenumbers { dft } # line numbers font + body @Body # filtered, see below + @Begin + + def @Test # returns x unless x is dft + left x + named iffixed {} + named ifvarying {} + named ifsymbol {} + { + x @Case { + dft @Yield { + style @Case { + fixed @Yield { iffixed } + varying @Yield { ifvarying } + symbol @Yield { ifsymbol } + } + } + else @Yield x + } + } + + + def @Else # returns x, or y if x is dft + left x + right y + { + x @Case { + dft @Yield y + else @Yield x + } + } + + + def @InitTab + { + tabin @Test + iffixed { fixedtabin } + ifvarying { varyingtabin } + ifsymbol { symboltabin } + } + + + def @InitTabWidth + { + tabout @Test + iffixed { fixedtabout } + ifvarying { varyingtabout } + ifsymbol { symboltabout } + } + + + def @Filter + { + def wantnumbered + { + numbered @Case { + { No no } @Yield "" + { Yes yes } @Yield "-L" + else @Yield { "-L"numbered } + } + } + + pipe @Case { + "" @Yield { + "prg2lout -r -lPython" wantnumbered -i{@FilterIn} + -o{@FilterOut} -e{@FilterErr} + -t{@InitTab} -T{@InitTabWidth} + } + else @Yield { + "cat" @FilterIn "|" pipe "|" + "prg2lout -r -lPython" wantnumbered -o{@FilterOut} + -e{@FilterErr} -t{@InitTab} -T{@InitTabWidth} + } + } + } + + + def @InitFontFamily + { + font @Test + iffixed { fixedfont } + ifvarying { varyingfont } + ifsymbol { symbolfont } + } + + + def @InitSize + { + size @Test + iffixed { fixedsize } + ifvarying { varyingsize } + ifsymbol { symbolsize } + } + + + def @InitLine + { + line @Test + iffixed { fixedline } + ifvarying { varyingline } + ifsymbol { symbolline } + } + + + def @PI # for formatting identifiers + right x + { + style @Case { + fixed @Yield fixedidentifiersformat { + { identifiers @Else fixedidentifiers } @Font x + } + varying @Yield varyingidentifiersformat { + { identifiers @Else varyingidentifiers } @Font x + } + symbol @Yield symbolidentifiersformat { + { identifiers @Else symbolidentifiers } @Font x + } + } + } + + + def @PK # for formatting keywords + right x + { + style @Case { + fixed @Yield fixedkeywordsformat { + { keywords @Else fixedkeywords } @Font x + } + varying @Yield varyingkeywordsformat { + { keywords @Else varyingkeywords } @Font x + } + symbol @Yield symbolkeywordsformat { + { keywords @Else symbolkeywords } @Font x + } + } + } + + + def @PO # for formatting operators + right x + { + style @Case { + fixed @Yield fixedoperatorsformat { + { operators @Else fixedoperators } @Font x + } + varying @Yield varyingoperatorsformat { + { operators @Else varyingoperators } @Font x + } + symbol @Yield symboloperatorsformat { + { operators @Else symboloperators } @Font x + } + } + } + + + def @PN # for formatting numbers + right x + { + style @Case { + fixed @Yield fixednumbersformat { + { numbers @Else fixednumbers } @Font x + } + varying @Yield varyingnumbersformat { + { numbers @Else varyingnumbers } @Font x + } + symbol @Yield symbolnumbersformat { + { numbers @Else symbolnumbers } @Font x + } + } + } + + + def @PS # for formatting strings + right x + { + style @Case { + fixed @Yield fixedstringsformat { + { strings @Else fixedstrings } @Font x + } + varying @Yield varyingstringsformat { + { strings @Else varyingstrings } @Font x + } + symbol @Yield symbolstringsformat { + { strings @Else symbolstrings } @Font x + } + } + } + + + def @PC # for formatting comments + right x + { + style @Case { + fixed @Yield fixedcommentsformat { + { comments @Else fixedcomments } @Font x + } + varying @Yield varyingcommentsformat { + { comments @Else varyingcomments } @Font x + } + symbol @Yield symbolcommentsformat { + { comments @Else symbolcomments } @Font x + } + } + } + + + def @PL # for formatting line numbers + right x + { + style @Case { + fixed @Yield fixedlinenumbersformat { + { linenumbers @Else fixedlinenumbers } @Font x + } + varying @Yield varyinglinenumbersformat { + { linenumbers @Else varyinglinenumbers } @Font x + } + symbol @Yield symbollinenumbersformat { + { linenumbers @Else symbollinenumbers } @Font x + } + } + } + + + def @PA # for formatting asterisks + { + @PO @BackEnd @Case { + PlainText @Yield "*" + else @Yield { "0.5w" @VShift "*" } + } + } + + + def @PM # for formatting minus signs + { + @PO @BackEnd @Case { + PlainText @Yield "-" + else @Yield style @Case { + fixed @Yield "-" + else @Yield { { Symbol Base } @Font @Char "minus" } + } + } + } + + + def @PD # for formatting dots, if wanted larger + { + @PO @BackEnd @Case { + PlainText @Yield "." + else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" } + } + } + + + def @A # get characters from the Adobe Symbol font + left sym + right x + { + style @Case { + symbol @Yield { { Symbol Base } @Font @Char sym } + else @Yield { x } + } + } + + + macro "$>" { {} & } + + + { @InitFontFamily Base @InitSize } @Font + { @InitLine lines nohyphen } @Break @Body + + @End @Python + +@End @PythonSetup diff --git a/include/report b/include/report index cebd65a..4bc31ca 100644 --- a/include/report +++ b/include/report @@ -65,6 +65,7 @@ # @ListRightIndent { 0s } # right indent of list items # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links } diff --git a/include/slides b/include/slides index 60d5a63..7f9f677 100644 --- a/include/slides +++ b/include/slides @@ -62,6 +62,7 @@ # @ListRightIndent { 0s } # right indent of list items # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags # @NumberSeparator { . } # separates nums like 2.3.7 + # @CrossLinkFormat { @Body } # format of cross links } |