source: tol/tolsh/tolsh.vfs/lib/tcllib1.10/doctools/mpformats/idx.nroff

devel
Last change on this file was 8597867d, checked in by Jorge Pérez <josp.jorge@…>, 16 years ago

closes #976, se incluye tcllib1.10, base64 debe eliminarse del raiz de lib ya que esta incluido en tcllib

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@2556 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 2.1 KB
Line 
1# -*- tcl -*-
2#
3# $Id: idx.nroff,v 1.6 2005/09/28 04:51:19 andreas_kupries Exp $
4#
5# Engine to convert a docidx document into nroff.
6#
7# Copyright (c) 2003 Andreas Kupries <andreas_kupries@sourceforge.net>
8# Freely redistributable.
9#
10######################################################################
11
12dt_source _idx_common.tcl
13dt_source _nroff.tcl
14
15######################################################################
16# Conversion specification.
17#
18# One-pass processing.
19
20proc idx_postprocess {nroff} {
21    # Postprocessing after generation ...
22    # Strip empty lines out of the generated nroff source
23    # and trim leading blanks, except in code samples.
24
25    set lines [list]
26    foreach line [split $nroff "\n"] {
27        set line [string trim $line]
28        if {0 == [string length $line]} {
29            continue
30        }
31        lappend lines $line
32    }
33    return [nroff_postprocess [join $lines \n]]
34}
35
36#proc fmt_plain_text {text} {if {$text != {}} {return \n} else {return {}}}
37proc fmt_plain_text {text} {return {}}
38
39################################################################
40## Backend for NROFF markup
41
42global prec ok haskey
43set    prec   ""
44set    ok     0
45set    haskey 0
46
47proc fmt_index_begin     {label title}      {
48    global prec ok
49    set ok 1
50    set     hdr [nr_comment {}]\n
51    if {$prec != {}} {
52        set hdr [nr_comment $prec]\n
53    }
54    append  hdr [nr_comment [c_provenance]]\n
55    append  hdr [nr_include man.macros]\n
56    append  hdr [nr_title "\"[string trimleft $label :]\" n"]\n
57    append  hdr [nr_bolds]\n
58    append  hdr [nr_section INDEX]\n
59    append  hdr $title[nr_in]\n
60    return $hdr
61}
62proc fmt_index_end {}          {return [nr_out]}
63proc fmt_key       {text}      {
64    global haskey
65    set res ""
66    if {$haskey} {append res [nr_out]\n}
67    append res $text[nr_in]\n
68    set haskey 1
69    return $res
70}
71proc fmt_manpage   {file label} {return [nr_blt [nr_bld]$file[nr_rst]]\n$label\n}
72proc fmt_url       {url label}  {return [nr_blt [nr_bld]$url[nr_rst]]\n$label\n}
73
74proc fmt_comment {text} {
75    global prec ok
76    if {$ok} {return [nr_comment $text]}
77    append prec $text \n
78    return {}
79}
80
81################################################################
Note: See TracBrowser for help on using the repository browser.