Tcl Library Source Code

Check-in [61b61eed41]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

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

Overview
Comment:Continued generation of markdown: doctoc.
Timelines: family | ancestors | descendants | both | doc-fixup-and-markdown
Files: files | file ages | folders
SHA3-256:61b61eed41e5053edc4d1f418bd1cdfc603f796bbd78f7d06ae474d160556a9f
User & Date: aku 2019-03-18 19:57:45
Context
2019-03-19
03:39
Fixed comment typo check-in: bced18e56d user: aku tags: doc-fixup-and-markdown
2019-03-18
19:57
Continued generation of markdown: doctoc. check-in: 61b61eed41 user: aku tags: doc-fixup-and-markdown
2019-03-15
06:28
Started generation of markdown: docidx. check-in: 0f2ecff317 user: aku tags: doc-fixup-and-markdown
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/doctools/doctoc.test.

313
314
315
316
317
318
319
320

321
322
323
324
325
326
327

# -------------------------------------------------------------------------
## Series of tests for all available backends, check their formatting.

set k 11
foreach format {
    html tmml nroff
    text wiki null

} {
    set n 0
    foreach src [TestFilesGlob tests/toc/toc/*] {
	# Get the expected result
	set dst [localPath [file join tests toc $format [file tail $src]]]
	set map {} ; lappend map @USR@ $tcl_platform(user)
	set rem {} ; lappend rem $tcl_platform(user) @USR@







|
>







313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328

# -------------------------------------------------------------------------
## Series of tests for all available backends, check their formatting.

set k 11
foreach format {
    html tmml nroff
    text wiki markdown
    null
} {
    set n 0
    foreach src [TestFilesGlob tests/toc/toc/*] {
	# Get the expected result
	set dst [localPath [file join tests toc $format [file tail $src]]]
	set map {} ; lappend map @USR@ $tcl_platform(user)
	set rem {} ; lappend rem $tcl_platform(user) @USR@

Changes to modules/doctools/mpformats/_markdown.tcl.

1
2
3
4
5
6


7
8




9
10
11
12
13
14
15
..
32
33
34
35
36
37
38




# -*- tcl -*-
#
# -- Core support for markdown
#
# Copyright (c) 2019 Andreas Kupries <andreas_kupries@sourceforge.net>
# Freely redistributable.



################################################################





# # ## ### ##### ########
## `markdown` formatting

proc SectTitle {lb title} {
    upvar 1 $lb lines
    lappend lines "# $title"
................................................................................
    upvar 1 $lb lines
    lappend lines "#### $title"
    return
}

proc Strong {text} { return __${text}__ }
proc Em     {text} { return *${text}* }





|
|



>
>

<
>
>
>
>







 







>
>
>
>
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
..
37
38
39
40
41
42
43
44
45
46
47
# -*- tcl -*-
##
# Support for markdown, overrides parts of coore text.
#
# Copyright (c) 2019 Andreas Kupries <andreas_kupries@sourceforge.net>
# Freely redistributable.
##
# # ## ### ##### ########


# Modified bulleting

DIB {- * +}
DEB {{1.} {1)}}

# # ## ### ##### ########
## `markdown` formatting

proc SectTitle {lb title} {
    upvar 1 $lb lines
    lappend lines "# $title"
................................................................................
    upvar 1 $lb lines
    lappend lines "#### $title"
    return
}

proc Strong {text} { return __${text}__ }
proc Em     {text} { return *${text}* }

##
# # ## ### ##### ########
return

Added modules/doctools/mpformats/toc.markdown.





















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# -*- tcl -*-
# Engine to convert a doctoc document into markdown formatted text
#
# Copyright (c) 2019 Andreas Kupries <andreas_kupries@sourceforge.net>
# Freely redistributable.
#
######################################################################

dt_source _toc_common.tcl
dt_source _text.tcl
dt_source _markdown.tcl

######################################################################
# Conversion specification.
# One-pass processing.

rename toc_postprocess {}
rename text_postprocess toc_postprocess

proc fmt_plain_text {text} {return {}}

################################################################
## Backend for Markdown markup

proc fmt_toc_begin {label title} {
    set title "$label -- $title"
    
    TextInitialize

    Text "\[//\]: # (Table of contents [Provenance])"
    CloseParagraph [Verbatim]

    SectTitle hdr $title
    Text [Compose hdr]    
    CloseParagraph [Verbatim]

    ListOpen
    return
}

proc fmt_toc_end {} { return }

proc fmt_division_start {title symfile} {

    Text "\[$title\]($symfile)"
    CloseParagraph [Verbatim]

    ListOpen
}

proc fmt_division_end  {} {
    ContextPop ;# Ref (a)
    return
}

proc fmt_item {file label desc} {
    Text "\[$label\]($file) $desc"
    CloseParagraph [Verbatim]
    return
}

proc fmt_comment {text} { return }

proc ListOpen {} {
    ContextPush ;# Ref (a)
    ContextNew Division {
	# Indenting is done by replicating the outer ws-prefix.
	set bullet "[WPrefix?]  [IBullet]"
	List! bullet $bullet "[BlankM $bullet] "
    }
    return
}

################################################################

Added modules/doctools/tests/toc/markdown/00.









>
>
>
>
1
2
3
4

[//]: # (Table of contents generated by tcllib/doctools/toc with format 'markdown')

# TOC -- Test

Added modules/doctools/tests/toc/markdown/01.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8

[//]: # (Table of contents generated by tcllib/doctools/toc with format 'markdown')

# TOC -- Test

  - [i1](I1f) i1d

  - [i2](I2f) i2d

Added modules/doctools/tests/toc/markdown/02.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14

[//]: # (Table of contents generated by tcllib/doctools/toc with format 'markdown')

# TOC -- Test

  - [i1](I1f) i1d

  - [D](Df)

      * [i2](I2f) i2d

      * [i3](I3f) i3d

  - [i4](I4f) i4d