~chambln/cosine.blue

ref: 2862b6de51533a9dea9f6aee7fce1671e013d4be cosine.blue/share/lib.sh -rw-r--r-- 926 bytes
2862b6deGregory Chamberlain Fix template 5 months ago
                                                                                
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
# cosine.blue -- static site generator
# Copyright (C) 2020  Gregory L Chamberlain <greg@cosine.blue>

# This file is part of cosine.blue.
#
# cosine.blue is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cosine.blue is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cosine.blue.  If not, see
# <https://www.gnu.org/licenses/>.

x() {
    printf '<%s>%s</%s>\n' "$1" "${2:-$(cat)}" "${1%% *}"
}

quote() {
    printf '%s\n' "$1" | sed 's/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g'
}