diff options
Diffstat (limited to 'tcllib/support/devel/sak/localdoc')
-rw-r--r-- | tcllib/support/devel/sak/localdoc/cmd.tcl | 21 | ||||
-rw-r--r-- | tcllib/support/devel/sak/localdoc/help.txt | 8 | ||||
-rw-r--r-- | tcllib/support/devel/sak/localdoc/localdoc.tcl | 129 | ||||
-rw-r--r-- | tcllib/support/devel/sak/localdoc/pkgIndex.tcl | 2 | ||||
-rw-r--r-- | tcllib/support/devel/sak/localdoc/topic.txt | 2 |
5 files changed, 162 insertions, 0 deletions
diff --git a/tcllib/support/devel/sak/localdoc/cmd.tcl b/tcllib/support/devel/sak/localdoc/cmd.tcl new file mode 100644 index 0000000..e32fce7 --- /dev/null +++ b/tcllib/support/devel/sak/localdoc/cmd.tcl @@ -0,0 +1,21 @@ +# -*- tcl -*- +# Implementation of 'localdoc'. + +# Available variables +# * argv - Cmdline arguments +# * base - Location of sak.tcl = Top directory of Tcllib distribution +# * cbase - Location of all files relevant to this command. +# * sbase - Location of all files supporting the SAK. + +# ### + +package require sak::localdoc + +if {[llength $argv]} { + sak::localdoc::usage +} + +sak::localdoc::run + +## +# ### diff --git a/tcllib/support/devel/sak/localdoc/help.txt b/tcllib/support/devel/sak/localdoc/help.txt new file mode 100644 index 0000000..256c8ec --- /dev/null +++ b/tcllib/support/devel/sak/localdoc/help.txt @@ -0,0 +1,8 @@ + + localdoc -- Generate documentation for website and installer. + + sak localdoc + + Convert all documentation into html and nroff, for use by the + installer, and the website. For the latter the results of the + conversion are stored in the repository itself. diff --git a/tcllib/support/devel/sak/localdoc/localdoc.tcl b/tcllib/support/devel/sak/localdoc/localdoc.tcl new file mode 100644 index 0000000..36447a8 --- /dev/null +++ b/tcllib/support/devel/sak/localdoc/localdoc.tcl @@ -0,0 +1,129 @@ +# -*- tcl -*- +# sak::doc - Documentation facilities + +package require sak::util +package require sak::doc + +namespace eval ::sak::localdoc {} + +# ### +# API commands + +## ### ### ### ######### ######### ######### + +proc ::sak::localdoc::usage {} { + package require sak::help + puts stdout \n[sak::help::on localdoc] + exit 1 +} + +proc ::sak::localdoc::run {} { + getpackage cmdline cmdline/cmdline.tcl + getpackage fileutil fileutil/fileutil.tcl + getpackage textutil::repeat textutil/repeat.tcl + getpackage doctools doctools/doctools.tcl + getpackage doctools::toc doctools/doctoc.tcl + getpackage doctools::idx doctools/docidx.tcl + getpackage dtplite dtplite/dtplite.tcl + + # Read installation information. Need the list of excluded + # modules to suppress them here in the doc generation as well. + global excluded modules apps guide + source support/installation/modules.tcl + + lappend baseconfig -module tcllib + foreach e $excluded { + puts "Excluding $e ..." + lappend baseconfig -exclude */modules/$e/* + } + + set nav ../../../../home + + puts "Reindex the documentation..." + sak::doc::imake __dummy__ + sak::doc::index __dummy__ + + puts "Removing old documentation..." + # but keep the main index around, manually created, edited, not to be touched + # TODO: catch errors and restore automatically + file rename embedded/index.html e_index.html + + file delete -force embedded + file mkdir embedded/www + + # Put the saved main page back into place, early. + file rename e_index.html embedded/index.html + + file delete -force idoc + file mkdir idoc/man + file mkdir idoc/www + + puts "Generating manpages (installation)..." + set config $baseconfig + lappend config -exclude {*/doctools/tests/*} + lappend config -exclude {*/support/*} + lappend config -ext n + lappend config -o idoc/man + lappend config nroff . + + dtplite::do $config + + # Note: Might be better to run them separately. + # Note @: Or we shuffle the results a bit more in the post processing stage. + + set map { + .man .html + modules/ tcllib/files/modules/ + apps/ tcllib/files/apps/ + } + + set toc [string map $map [fileutil::cat support/devel/sak/doc/toc.txt]] + set apps [string map $map [fileutil::cat support/devel/sak/doc/toc_apps.txt]] + set mods [string map $map [fileutil::cat support/devel/sak/doc/toc_mods.txt]] + set cats [string map $map [fileutil::cat support/devel/sak/doc/toc_cats.txt]] + + puts "Generating HTML (installation)... Pass 1, draft..." + set config $baseconfig + lappend config -exclude {*/doctools/tests/*} + lappend config -exclude {*/support/*} + lappend config -toc $toc + lappend config -nav {Tcllib Home} $nav + lappend config -post+toc Categories $cats + lappend config -post+toc Modules $mods + lappend config -post+toc Applications $apps + lappend config -merge + lappend config -o idoc/www + lappend config html . + + dtplite::do $config + + puts "Generating HTML (installation)... Pass 2, resolving cross-references..." + dtplite::do $config + + puts "Generating HTML (online)... Pass 1, draft..." + set config $baseconfig + lappend config -exclude {*/doctools/tests/*} + lappend config -exclude {*/support/*} + lappend config -toc $toc + lappend config -post+toc Categories $cats + lappend config -post+toc Modules $mods + lappend config -post+toc Applications $apps + lappend config -merge + lappend config -raw + lappend config -o embedded/www + lappend config -header support/fossil-nav-integration.html + lappend config html . + + dtplite::do $config + + puts "Generating HTML (online)... Pass 2, resolving cross-references..." + dtplite::do $config + return +} + +# ### ### ### ######### ######### ######### + +package provide sak::localdoc 1.0 + +## +# ### diff --git a/tcllib/support/devel/sak/localdoc/pkgIndex.tcl b/tcllib/support/devel/sak/localdoc/pkgIndex.tcl new file mode 100644 index 0000000..560504b --- /dev/null +++ b/tcllib/support/devel/sak/localdoc/pkgIndex.tcl @@ -0,0 +1,2 @@ +if {![package vsatisfies [package provide Tcl] 8.2]} return +package ifneeded sak::localdoc 1.0 [list source [file join $dir localdoc.tcl]] diff --git a/tcllib/support/devel/sak/localdoc/topic.txt b/tcllib/support/devel/sak/localdoc/topic.txt new file mode 100644 index 0000000..4c1f934 --- /dev/null +++ b/tcllib/support/devel/sak/localdoc/topic.txt @@ -0,0 +1,2 @@ +localdoc Generate html & nroff documentation for display + from the website, and the installer. |