ussg

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 7824c06e055a0124c4294a08d8c12b4484adf0bb
parent 6b90eafce52b18cb5765c83d7a60d38a492a0593
Author: Ellenor Bjornsdottir <ellenor@umbrellix.net>
Date:   Thu,  2 Mar 2023 00:27:41 +0000

xsitelogo

Diffstat:
Mdoc/interface.hmd | 7+++----
Mplugins/navbar.tm | 9+++++++++
Mussg-page | 13++++++++++++-
3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/doc/interface.hmd b/doc/interface.hmd @@ -1,7 +1,6 @@ -X-Site-Title: Umbrellix -X-Site-Description: Left politics, programming, and self-hosted Internet services: experiences, lessons and hope -X-Synoptic-Title: Interface of ussg -X-Synoptic-Text: ussg thus far carries one utility. Its interface is described in page. +Title: Umbrellix &raquo; UmbrellixSSG &raquo; Interface of the utility +X-Synoptic-Title: Umbrellix - Interface of ussg +X-Synoptic-Text: ussg thus far carries one utility. Its interface is described, haphazardly, in page. # Interface of the utility diff --git a/plugins/navbar.tm b/plugins/navbar.tm @@ -13,12 +13,20 @@ proc navbar {} { if {![catch {dict get $::headers navbar-prefix} navprefix]} {set prefix [file normalize $navprefix]} # This is the prefix that is assumed to be on $::outputfile during generation. This is used to calculate "this page." + if {![catch {dict get $::headers url-prefix} urlprefix]} {set prefix [file normalize $navprefix]} + # This is the prefix that is assumed to be on URLs but not on $::outputfile during generation. This is used to calculate "this page." + if {[catch {dict get $::headers navbar-title} navtitle]} {set navtitle ""} #mimicking the werc function of the same nature if {[catch {set ::outputfile} outputfile]} { puts stderr "Warn: Navbar plugin: You are running ussg in stdout mode. Navbar doesn't work in stdout mode; it needs the output file name to know if it's on \"this page\". Navbar will still do its best, but there will be no differentiation of this page from not this page." set outputfile "" + } ;# without an output filename we cannot work properly. + + if {[catch {set ::inputfile} inputfile]} { + puts stderr "Warn: Navbar plugin: You are running ussg in stdin mode. Navbar may not work in stdin mode; it needs the output file name to know if it's on \"this page\". Navbar will still do its best." + set inputfile "" } ;# without an input filename we cannot work properly. if {[catch {dict get $::headers navbar-source} navsource]} { @@ -36,6 +44,7 @@ proc navbar {} { set garbage [lassign [split [gets $provinputfd] "\t"] path label] if {$path == ""} {continue} if {$outputfile == ""} { + set isthispath 0 puts $::outputfd [format "<li><a href=\"%s\">&raquo; <i>%s</i></a></li>" $path $label] } { set isthispath 0 diff --git a/ussg-page b/ussg-page @@ -83,7 +83,7 @@ proc opts {{consume {h v H: M: help version headers: markdown:}} argl} { } # foreach letter } - # if only dash + # if only dash, else short option } # if two dashes } else { @@ -134,6 +134,9 @@ ussg-page.1. If both input and output are blank, convert stdin to stdout. +If either input or output are single dashes, convert the respective +standard file. + A double dash terminates option processing, and all arguments are taken as non-options thereafter, including other double dashes. @@ -226,6 +229,7 @@ set headermulti { title-separator 0 template 0 x-site-title 0 + x-site-logo 0 x-site-description 0 x-synoptic-title 0 x-synoptic-text 0 @@ -305,6 +309,7 @@ if {[llength $arg] == 2} { set inputfile [lindex $arg 0] set outputfile [lindex $arg 1] if {$outputfile == "-"} { + set outputfile "" } else { # In the positive, output file desc is already set correctly. # Alternatively... @@ -355,6 +360,7 @@ if {[llength $arg] == 2} { if {[llength $arg] > 0} { set inputfile [lindex $arg 0] if {$inputfile == "-"} { + set outputfile "" } else { # In the positive, the input file desc is already set correctly. if {[catch {open [file normalize $inputfile] r} provinputfd]} { @@ -505,6 +511,11 @@ namespace eval ::templcmds { puts $::outputfd [format "<title>%s</title>" $title] } + proc xsitelogo {} { + # output Site Logo code + if {![catch {dict get $::headers x-site-logo} title]} { puts -nonewline $::outputfd $title } + } + proc xsitetitle {} { # output Site Title if {![catch {dict get $::headers x-site-title} title]} { puts -nonewline $::outputfd $title }