Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit57e9d1666dcaae4d952a166d3af1c67aa1b1b251 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-10-17 15:49:26 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-10-17 15:49:26 +0300
Filesb03f093c32383cb679aff16a8a65fcc3acb0721b
csg-57e9d1666dcaae4d952a166d3af1c67aa1b1b251.tar
csg-57e9d1666dcaae4d952a166d3af1c67aa1b1b251.tar.gz
csg-57e9d1666dcaae4d952a166d3af1c67aa1b1b251.zip
Parentd27f236814171d6913f4c9390010354fc30bba18 (diff)
[s2] Timestamps are now passed as variables to scripts
1 files changed, 9 insertions, 1 deletions
-rwxr-xr-xcsg10
diff --git a/csg b/csg
index 05c70e5..d571e88 100755
--- a/csg
+++ b/csg
@@ -128,7 +128,7 @@ then
for file in $(find . -type f -name '*.md')
do
dates=($(git log --follow --pretty=format:%ad --date="format:%d %B %Y" -- "$file"))
- line="$DESTINATION${file:1:-2}html\t${dates[@]: -3:3}\t${dates[@]:0:3}"
+ line="$DESTINATION${file:1:-2}html\t${dates[@]: -3:3} ${dates[@]:0:3}"
echo -e "$line" >> "$CSG_TIMESTAMP_FILE"
done
}
@@ -229,6 +229,12 @@ transform-file() {
startedGathering && /^$/ { exit }
END { print desc }' "$file")"
local words="$($CSG_AWK '{total += NF} END{print total}' "$file")"
+ local timestamps=($($CSG_AWK -v file="$file" '
+ BEGIN { FS = "\t" }
+ $1 == file {
+ print $2
+ exit
+ }' "$file"))
# Generate
$CSG_MD_TO_HTML "$file" > "$outf"
@@ -238,6 +244,8 @@ transform-file() {
-v title="$title" \
-v description="$descr" \
-v words="$words" \
+ -v created="${timestamps[@]:0:3}" \
+ -v edited="${timestamps[@]:4}" \
$scr_libs $scripts -f "$CSG_TMP_DIR/csg-print.awk" \
"$outf" > "$outf.tmp"
mv "$outf.tmp" "$outf"