Overview
Comment:refactor(tag-page): factor out [pages-with-contents]. Use semantic [list] and [dict create] for new values.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cccd50fa76e62eebe8d6dabdd3e7edd74d7c00caa92efe5c96c03744266462f8
User & Date: dbohdan on 2020-06-05 18:12:27
Other Links: manifest | tags
Context
2020-07-04
16:24
feat(skin): add syntax highlighting for code via highlight.js. This requires escaping the dollar signs in highlight.pack.js for TH1. check-in: 2041b54a18 user: dbohdan tags: trunk
2020-06-05
18:12
refactor(tag-page): factor out [pages-with-contents]. Use semantic [list] and [dict create] for new values. check-in: cccd50fa76 user: dbohdan tags: trunk
17:40
feat(tag-page): print the page text to stdout if the page name is "" or "-" check-in: ea68498dd6 user: dbohdan tags: trunk
Changes

Modified tag-page/tag-page.tcl from [cf9edca8d8] to [212fb93f08].

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88










89
90
91
92
93
94
95
96
97
98
    } else {
        return {}
    }
}


proc group-by-tag pages {
    set grouped {}

    foreach {name contents} $pages {
        if {$contents in {{} \n}} continue

        foreach tag [page-tags $contents] {
            dict lappend grouped $tag $name
        }
................................................................................
        \" "
        ' '
    } $text]
}


proc markdown-list {grouped prefix} {
    set markdown {}

    foreach {tag pages} $grouped {
        set section [list "$prefix [entities $tag]"]

        foreach page $pages {
            set link [expr {
                [regexp {[\(\)\[\]<>"'&]} $page]
................................................................................
proc update-page {name contents} {
    set old [fossil wiki export $name]
    if {$contents eq $old} return
    fossil wiki commit $name << $contents
}


proc tag-page repo {
    set lines {}

    lappend lines {# Pages by tag} {## Contents} {## Tags}

    set pages {}
    foreach name [split [fossil wiki ls $repo] \n] {
        lappend pages $name [fossil wiki export $name]
    }











    set grouped [group-by-tag $pages]
    set sorted [lsort -stride 2 -index 0 -nocase $grouped]
    lappend lines [markdown-list $sorted ###]

    return [join $lines \n]
}


proc main {repo {page-name {}}} {
    set contents [tag-page $repo]







|







 







|







 







|
|

<
<
<

|


>
>
>
>
>
>
>
>
>
>


|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
72
73
74
75
76
77
78
79
80
81



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    } else {
        return {}
    }
}


proc group-by-tag pages {
    set grouped [dict create]

    foreach {name contents} $pages {
        if {$contents in {{} \n}} continue

        foreach tag [page-tags $contents] {
            dict lappend grouped $tag $name
        }
................................................................................
        \" &quot;
        ' &#039;
    } $text]
}


proc markdown-list {grouped prefix} {
    set markdown [list]

    foreach {tag pages} $grouped {
        set section [list "$prefix [entities $tag]"]

        foreach page $pages {
            set link [expr {
                [regexp {[\(\)\[\]<>"'&]} $page]
................................................................................
proc update-page {name contents} {
    set old [fossil wiki export $name]
    if {$contents eq $old} return
    fossil wiki commit $name << $contents
}


proc pages-with-contents repo {
    set pages [dict create]




    foreach name [split [fossil wiki ls $repo] \n] {
        dict set pages $name [fossil wiki export $name]
    }

    return $pages
}


proc tag-page repo {
    set pages [pages-with-contents $repo]

    set lines [list]
    lappend lines {# Pages by tag} {## Contents}

    set grouped [group-by-tag $pages]
    set sorted [lsort -stride 2 -index 0 -nocase $grouped]
    lappend lines {## Tags} [markdown-list $sorted ###]

    return [join $lines \n]
}


proc main {repo {page-name {}}} {
    set contents [tag-page $repo]