Tcl Library Source Code

Changes On Branch apn-dtplite-kwlinks
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch apn-dtplite-kwlinks Excluding Merge-Ins

This is equivalent to a diff from 91f14dfd0a to 7593991c41

2013-04-04
16:18
Merged dtplite feature work. check-in: c148f532c8 user: andreask tags: trunk
16:15
[Feature 3609342]: Applied Ashok's patch to disable the keyword index page when the processed documentation does not contain keywords, with modifications. Version bumped to 1.1. Closed-Leaf check-in: 7593991c41 user: andreask tags: apn-dtplite-kwlinks
04:28
Fixed more manpage clashes, base virtual channels versus package "Memchan". Regenerated embedded docs. check-in: 740521ccc1 user: aku tags: trunk
04:05
Applied Ashok's patch to disable the keyword index page if no keyword were found. With changes. check-in: 44d847703f user: aku tags: apn-dtplite-kwlinks
2013-03-27
16:56
Started fixing bug 3609183. Created initial testsuite for the package. check-in: 69105024f6 user: andreask tags: ooutil-bug-3609183
2013-03-26
17:08
Fixed package index, was missing struct::queue version bump causing mismatch. check-in: 91f14dfd0a user: andreask tags: trunk
2013-03-25
22:12
Update to TEPAM 0.4.1: * Correction of bug 3608952: Help text is incorrectly generated if procedures are part of the non-default namespaces * Correction of bug 3608951: Help text shows incorrect argument order if procedure is defined in the "unnamed arguments first, named arguments later" calling style. check-in: e040e29b2b user: Andreas Drollinger tags: trunk

Changes to modules/dtplite/ChangeLog.








1
2
3
4
1
2
3
4
5
6
7
8
9
10
11
+
+
+
+
+
+
+




2013-04-04  Andreas Kupries <[email protected]>

	* dtplite.man: [Feature 3609342]: Applied Ashok's patch to disable
	* dtplite.tcl: the keyword index page when the processed
	* pkgIndex.tcl: documentation does not contain keywords, with
	  modifications. Version bumped to 1.1.

2013-02-22  Andreas Kupries  <[email protected]>

	* New module 'dtplite'. dtplite application-as-package.

Changes to modules/dtplite/dtplite.man.

1
2

3
4
5
6
7
8
9
1

2
3
4
5
6
7
8
9

-
+







[comment {-*- tcl -*- doctools manpage}]
[manpage_begin dtplite n 1.0.5]
[manpage_begin dtplite n 1.1]
[copyright {2004-2013 Andreas Kupries <[email protected]>}]
[titledesc {Lightweight DocTools Markup Processor}]
[moddesc   {Documentation toolbox}]
[category  {Documentation tools}]
[description]
[para]

Changes to modules/dtplite/dtplite.tcl.

1
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29


-
+


















-
+







# -*- tcl -*- \
# @@ Meta Begin
# Application dtplite 1.0.5
# Application dtplite 1.1
# Meta platform     tcl
# Meta summary      Lightweight DocTools Processor
# Meta description  This application is a simple processor
# Meta description  for documents written in the doctools
# Meta description  markup language. It covers the most
# Meta description  common use cases, but is not as
# Meta description  configurable as its big brother dtp.
# Meta category     Processing doctools documents
# Meta subject      doctools doctoc docidx
# Meta require      {doctools 1}
# Meta require      {doctools::idx 1}
# Meta require      {doctools::toc 1}
# Meta require      fileutil
# Meta require      textutil::repeat
# Meta author       Andreas Kupries
# Meta license      BSD
# @@ Meta End

package provide dtplite 1.0.5
package provide dtplite 1.1

# dtp lite - Lightweight DocTools Processor
# ======== = ==============================
#
# Use cases
# ---------
#
834
835
836
837
838
839
840






841
842
843
844
845
846
847
848
849
850
851
852
853
854

855
856
857
858
859
860
861
862
863
864
865
866
867

868


869
870
871

872


873
874
875
876
877
878
879
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859

860
861
862
863
864
865
866
867
868
869
870
871
872
873
874

875
876
877
878
879
880

881
882
883
884
885
886
887
888
889







+
+
+
+
+
+













-
+













+
-
+
+



+
-
+
+







    if {![llength $files]} {
	ArgError "Module \"$module\" has no files to process."
    }

    MetadataGet $files
    StyleMakeLocal

    # Attention, ordering! Ensure that 'kwid' is initialized before
    # testing it with 'HaveKeywords' everywhere we configure the links
    # showns in the navigation bar.

    set idx [IdxGenerate $module [IdxGet]]

    if {$utoc ne {}} {
	if {[file exists $utoc]} { set utoc [Get $utoc] }
	TocWrite toc index $utoc
    } else {
	TocWrite toc index [TocGenerate [TocGet $module toc]]
    }
    # (+TOC)
    set n 0
    foreach item $mtoc {
	if {[file exists $item]} { set item [Get $item] }
	TocWrite toc$n index $item
	incr n
    }
    IdxWrite index toc [IdxGenerate $module [IdxGet]]
    IdxWrite index toc $idx

    dt configure -module $module
    XrefGet
    XrefSetup   dt
    FooterSetup dt
    MapSetup    dt

    foreach f [lsort -dict $files] {
	Print stdout \t$f

	set o $out($f)
	dt configure -file [At $o] -ibase $input/$f

        if {[HaveKeywords]} {
	NavbuttonPush {Keyword Index}     [Output index] $o
            NavbuttonPush {Keyword Index} [Output index] $o
        }
	NavbuttonPush {Table Of Contents} [Output toc]   $o
	HeaderSetup dt $o
	NavbuttonPop
        if {[HaveKeywords]} {
	NavbuttonPop
            NavbuttonPop
        }
	StyleSetup dt $o

	if {[string equal $format null]} {
	    dt format [Get [Pick $f]]
	} else {
	    Write [At $o] [dt format [Get [Pick $f]]]
	}
911
912
913
914
915
916
917






918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933

934
935
936
937
938
939
940
941
942
943
944
945
946
947



948
949
950
951
952

953


954
955
956
957
958
959
960
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948

949
950
951
952
953
954
955
956
957
958
959
960
961


962
963
964
965
966
967
968
969
970

971
972
973
974
975
976
977
978
979







+
+
+
+
+
+















-
+












-
-
+
+
+





+
-
+
+







    if {![llength $files]} {
	ArgError "Module \"$module\" has no files to process."
    }

    MetadataGet $files $module
    StyleMakeLocal     $module

    # Attention, ordering! Ensure that 'kwid' is initialized before
    # testing it with 'HaveKeywords' everywhere we configure the links
    # showns in the navigation bar.

    set idx [IdxGenerate {} [IdxGetSaved index]]

    set localtoc [TocGet $module $module/toc]
    TocWrite $module/toc index [TocGenerate $localtoc] [TocMap $localtoc]
    if {$utoc ne {}} {
	if {[file exists $utoc]} { set utoc [Get $utoc] }
	TocWrite toc index $utoc
    } else {
	TocWrite toc index [TocGenerate [TocMergeSaved $localtoc]]
    }
    # (+TOC)
    set n 0
    foreach item $mtoc {
	if {[file exists $item]} { set item [Get $item] }
	TocWrite toc$n index $item
	incr n
    }
    IdxWrite index toc [IdxGenerate {} [IdxGetSaved index]]
    IdxWrite index toc $idx

    dt configure -module $module
    XrefGetSaved
    XrefSetup   dt
    FooterSetup dt
    MapSetup    dt

    foreach f [lsort -dict $files] {
	Print stdout \t$f

	set o $out($f)
	dt configure -file [At $o] -ibase $input/$f

	NavbuttonPush {Keyword Index}          [Output index]       $o
        if {[HaveKeywords]} {
            NavbuttonPush {Keyword Index} [Output index] $o
        }
	NavbuttonPush {Table Of Contents}      [Output $module/toc] $o
	NavbuttonPush {Main Table Of Contents} [Output toc]         $o
	HeaderSetup dt $o
	NavbuttonPop
	NavbuttonPop
        if {[HaveKeywords]} {
	NavbuttonPop
            NavbuttonPop
        }
	StyleSetup dt $o

	if {[string equal $format null]} {
	    dt format [Get [Pick $f]]
	} else {
	    Write [At $o] [dt format [Get [Pick $f]]]
	}
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139







1140
1141
1142
1143
1144
1145
1146
1148
1149
1150
1151
1152
1153
1154




1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168







-
-
-
-
+
+
+
+
+
+
+








    if {[string equal $format null]} return
    Write [At .tocdoc] $text

    set ft [Output $ftoc]

    doctools::toc::new toc -format $format -file $ft

    NavbuttonPush {Keyword Index} [Output $findex] $ftoc
    HeaderSetup  toc $ft
    NavbuttonPop
    if {[HaveKeywords]} {
        NavbuttonPush {Keyword Index} [Output $findex] $ftoc
    }
    HeaderSetup toc $ft
    if {[HaveKeywords]} {
        NavbuttonPop
    }
    FooterSetup  toc
    StyleSetup   toc $ftoc

    foreach {k v} $map {toc map $k $v}

    Write [At $ft] [toc format $text]
    toc destroy
1255
1256
1257
1258
1259
1260
1261


1262
1263
1264
1265
1266
1267
1268
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292







+
+







    return [join $lines \n]\n
}

proc ::dtplite::IdxWrite {findex ftoc text} {
    variable format

    if {[string equal $format null]} return
    if {![HaveKeywords]} return

    Write [At .idxdoc] $text

    set fi [Output $findex]

    doctools::idx::new idx -format $format -file $fi

    NavbuttonPush {Table Of Contents} [Output $ftoc] $findex
1282
1283
1284
1285
1286
1287
1288








1289
1290
1291
1292
1293
1294
1295
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327







+
+
+
+
+
+
+
+







    set mxf 0
    foreach item $keys {
	foreach {symfile label} $item break
	Max mxf $symfile
    }
    return
}

# ### ### ### ######### ######### #########
## Detect presence of keywords.

proc ::dtplite::HaveKeywords {} {
    variable   kwid
    array size kwid
}

# ### ### ### ######### ######### #########
## Column sizing

proc ::dtplite::Max {v str} {
    upvar 1 $v max
    set l [string length [list $str]]
1575
1576
1577
1578
1579
1580
1581


1582

1583
1584









1585
1586
1587
1588
1589
1590
1591
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617


1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633







+
+

+
-
-
+
+
+
+
+
+
+
+
+







## Header/Footer mgmt
## Header is merged from regular header, plus nav bar.
## Caching the merge result for quicker future access.

proc ::dtplite::HeaderSetup {o ref} {
    variable header
    variable nav
    variable prenav
    variable postnav

    # We cannot generate a navigation bar if the output format does
    if {[string equal $header ""] && ![llength $nav]} return
    if {![in [$o parameters] header]}                 return
    # not support a "header".
    if {![in [$o parameters] header]} return

    # Do not generate a navigation bar if no content was specified for
    # it, at all.
    if {![llength $prenav] &&
	![llength $postnav] &&
	![llength $nav] &&
	[string equal $header ""]} return

    $o setparam header [Navbar $nav $ref]
    return
}

proc ::dtplite::Navbar {nav ref} {
    variable header

Changes to modules/dtplite/pkgIndex.tcl.

1
2
3
4
5

1
2
3
4

5




-
+
if {![package vsatisfies [package provide Tcl] 8.2]} {
    # PRAGMA: returnok
    return
}
package ifneeded dtplite 1.0.5 [list source [file join $dir dtplite.tcl]]
package ifneeded dtplite 1.1 [list source [file join $dir dtplite.tcl]]