чување 453e4547988e6ae1840181b8e748899ea5ea8c04
родитељ 0c693941bff0224aecc1caa023275d5d6c8ce4ee
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sat, 5 Dec 2020 21:44:47 +0100
Continued WIP 2020-12-05
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 3, додавања: 28(+), брисања: 27(-)
diff --git a/highlight.css b/highlight.css
@@ -1,19 +0,0 @@
-/* Style definition file generated by highlight 3.59, http://www.andre-simon.de/ */
-/* highlight theme: Kwrite Editor */
-body.hl { background-color:#e0eaee; }
-pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New',monospace; white-space: pre-wrap; }
-.hl.num { color:#b07e00; }
-.hl.esc { color:#ff00ff; }
-.hl.str { color:#bf0303; }
-.hl.pps { color:#818100; }
-.hl.slc { color:#838183; font-style:italic; }
-.hl.com { color:#838183; font-style:italic; }
-.hl.ppc { color:#008200; }
-.hl.opt { color:#000000; }
-.hl.ipl { color:#0057ae; }
-.hl.lin { color:#555555; }
-.hl.kwa { color:#000000; font-weight:bold; }
-.hl.kwb { color:#0057ae; }
-.hl.kwc { color:#000000; font-weight:bold; }
-.hl.kwd { color:#010181; }
-
diff --git a/slweb.1.xz b/slweb.1.xz
Бинарне датотеке се разликују.
diff --git a/slweb.in b/slweb.in
@@ -1,4 +1,5 @@
#!/bin/bash
+#set -x
BODY_ONLY=0
INFILE=index.slw
@@ -230,7 +231,8 @@ done
declare -A VARS
-if [ $BODY_ONLY -eq 0 ]; then
+HAS_YAML=$(grep -- '^---' "$INFILE" 2>/dev/null)
+if [ $BODY_ONLY -eq 0 -a -n "$HAS_YAML" ]; then
YAML=$(sed '/^---/,$d' $INFILE)
VAR_KEYS=$(echo "$YAML" | \
sed -e's/^\([a-z-]\+\):.*$/\1/g')
@@ -243,8 +245,6 @@ if [ $BODY_ONLY -eq 0 ]; then
sed -e 's/stylesheet: \(.*\)/\1/g')
fi
INDIR=$(dirname $INFILE 2>/dev/null)
-echo INDIR = $INDIR
-echo INFILE = $INFILE
if [ $BODY_ONLY -eq 0 ]; then
grep -- '^---' $INFILE 2>&1 >/dev/null \
@@ -266,16 +266,36 @@ done
DIR_COMMANDS=$(echo "$DOC" | grep '{dir \"[^\"]*\" \"[^\"]*\"}')
shopt -s extglob
-shopt -p extglob
#shopt -s nullglob
while IFS= read -r DIR_COMMAND; do
FORMAT=$(echo "$DIR_COMMAND" | \
sed -e 's/{dir \"\([^\"]*\)\" \"[^\"]*\"}/\1/g')
- DIR_PATTERN=$INDIR/$(echo "$DIR_COMMAND" | \
+ DIR_PATTERN=$(echo "$DIR_COMMAND" | \
sed -e 's/{dir \"[^\"]*\" \"\([^\"]*\)\"}/\1/g')
- set -x
- find $INDIR -regextype sed -regex "$DIR_PATTERN/*.slw" -print
- set +x
+ DIR_FILES=$(cd $INDIR; \
+ find . -regextype sed -regex "\.\/$DIR_PATTERN\/.*\.slw" -print)
+ FORMAT=$(echo "$FORMAT" | \
+ sed -e 's/\//\\\//g' -e 's/\"/\\\"/g')
+ DIR_PATTERN=$(echo "$DIR_PATTERN" | \
+ sed -e 's/\//\\\//g' -e 's/\"/\\\"/g' -e 's/\*/\\\*/g' \
+ -e 's/\./\\\./g' -e 's/\[/\\\[/g' -e 's/\]/\\\]/g')
+ DIR_HTML="<ul class=\"dir\">\n"
+ while IFS= read -r DIR_FILE; do
+ DIR_FILE_HTML=$(echo "$DIR_FILE" | \
+ sed -e's/\.slw/\.html/g')
+ HAS_YAML=$(grep -- '^---' "$INDIR/$DIR_FILE" 2>/dev/null)
+ if [ -n "$HAS_YAML" ]; then
+ DATE=$(sed '/^---/,$d' $INDIR/$DIR_FILE | \
+ grep -e'^date:' | sed -e 's/^date: \(.*\)$/\1/g')
+ DIR_HTML="$DIR_HTML\n<li><a href=\"$DIR_FILE_HTML\">$DATE</a></li>\n"
+ fi
+ done <<< "$DIR_FILES"
+ DIR_HTML="$DIR_HTML\n</ul><!--dir-->\n"
+ DIR_HTML=$(echo "$DIR_HTML" | \
+ sed -e's/\//\\\//g' -e's/\[/\\\[/g' -e's/\./\\\./g' \
+ -e's/\"/\\\"/g')
+ DOC=$(echo "$DOC" | \
+ sed -e "s/{dir \"$FORMAT\" \"$DIR_PATTERN\"}/$DIR_HTML/g")
done <<< "$DIR_COMMANDS"
if [ $BODY_ONLY -eq 0 ]; then