added lib/ directory
This commit is contained in:
parent
ea95073ac4
commit
cb71f73b96
25
Makefile
25
Makefile
|
@ -19,9 +19,10 @@ upload:
|
|||
scp -r html/* techn0path@vern.cc:public_html
|
||||
|
||||
test: testing/input.gmi testing/input_feed.txt
|
||||
mawk -f scripts/navbar.awk -f ~/projects/awk_functions/lib.awk -f scripts/html.awk -- testing/input.gmi > testing/output.html
|
||||
mawk -f scripts/navbar.awk -f ~/projects/awk_functions/lib.awk -f scripts/gemini.awk -- testing/input.gmi > testing/output.gmi
|
||||
mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- testing/input_feed.txt > testing/output.atom
|
||||
mawk -f lib/navbar.awk -f lib/path.awk -f scripts/html.awk -- testing/input.gmi > testing/output.html
|
||||
mawk -f lib/navbar.awk -f lib/path.awk -f scripts/gemini.awk -- testing/input.gmi > testing/output.gmi
|
||||
mawk -f lib/path.awk -f scripts/feed.awk -- testing/input_feed.txt > testing/output.atom
|
||||
html5validator testing/output.html
|
||||
|
||||
subdirs:
|
||||
find src -mindepth 1 -type d -printf '%P\0' | xargs -0 -I{} mkdir -p gmi/{} html/{}
|
||||
|
@ -38,20 +39,20 @@ html/%.webp: src/%.webp
|
|||
gmi/%.webp: src/%.webp
|
||||
cp $< $@
|
||||
|
||||
html/%.html: src/%.gmi scripts/html.awk scripts/navbar.awk
|
||||
mawk -f scripts/navbar.awk -f ~/projects/awk_functions/lib.awk -f scripts/html.awk -- $< > $@
|
||||
html/%.html: src/%.gmi scripts/html.awk lib/navbar.awk
|
||||
mawk -f lib/navbar.awk -f lib/path.awk -f scripts/html.awk -- $< > $@
|
||||
|
||||
gmi/%.gmi: src/%.gmi scripts/gemini.awk scripts/navbar.awk
|
||||
mawk -f scripts/navbar.awk -f ~/projects/awk_functions/lib.awk -f scripts/gemini.awk -- $< > $@
|
||||
gmi/%.gmi: src/%.gmi scripts/gemini.awk lib/navbar.awk
|
||||
mawk -f lib/navbar.awk -f lib/path.awk -f scripts/gemini.awk -- $< > $@
|
||||
|
||||
gmi/sitemap.gmi: $(SITEMAP_INDEX_FILES) scripts/sitemap_gmi.awk scripts/navbar.awk
|
||||
mawk -f scripts/navbar.awk -v 'sourcePath=src/' -f ~/projects/awk_functions/lib.awk -f scripts/sitemap_gmi.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
mawk -f lib/navbar.awk -v 'sourcePath=src/' -f lib/path.awk -f scripts/sitemap_gmi.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
|
||||
html/sitemap.html: $(SITEMAP_INDEX_FILES) scripts/sitemap_html.awk scripts/navbar.awk
|
||||
mawk -f scripts/navbar.awk -v 'sourcePath=src/' -f ~/projects/awk_functions/lib.awk -f scripts/sitemap_html.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
html/sitemap.html: $(SITEMAP_INDEX_FILES) scripts/sitemap_html.awk lib/navbar.awk
|
||||
mawk -f lib/navbar.awk -v 'sourcePath=src/' -f lib/path.awk -f scripts/sitemap_html.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
|
||||
gmi/feed.atom: scripts/feed.awk
|
||||
git log --diff-filter=A --pretty=format:'%aI "%s"' --name-only src/ | mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- - > $@
|
||||
git log --diff-filter=A --pretty=format:'%aI "%s"' --name-only src/ | mawk -f lib/path.awk -f scripts/feed.awk -- - > $@
|
||||
|
||||
html/feed.atom: scripts/feed.awk
|
||||
git log --diff-filter=A --pretty=format:'%aI "%s"' --name-only src/ | mawk -v 'willConvertLinks=1' -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- - > $@
|
||||
git log --diff-filter=A --pretty=format:'%aI "%s"' --name-only src/ | mawk -v 'willConvertLinks=1' -f lib/path.awk -f scripts/feed.awk -- - > $@
|
||||
|
|
|
@ -13,9 +13,9 @@ function genNavbarHTML(filename, sourcePath, outputPath) {
|
|||
<a href='%s'>feed</a> | \n\
|
||||
<a href='http://git.vern.cc/techn0path/'>git</a>\n\
|
||||
</nav><br>\n", \
|
||||
relpath(dirname, outputPath "/index.html"), \
|
||||
relpath(dirname, outputPath "/sitemap.html"), \
|
||||
relpath(dirname, outputPath "/feed.atom"))
|
||||
getRelativePath(dirname, outputPath "/index.html"), \
|
||||
getRelativePath(dirname, outputPath "/sitemap.html"), \
|
||||
getRelativePath(dirname, outputPath "/feed.atom"))
|
||||
}
|
||||
|
||||
function genNavbarGMI(filename, sourcePath, outputPath) {
|
||||
|
@ -32,7 +32,7 @@ function genNavbarGMI(filename, sourcePath, outputPath) {
|
|||
=> %s sitemap\n\
|
||||
=> %s feed\n\
|
||||
=> https://git.vern.cc/techn0path/ git\n\n", \
|
||||
relpath(dirname, outputPath "/index.gmi"), \
|
||||
relpath(dirname, outputPath "/sitemap.gmi"), \
|
||||
relpath(dirname, outputPath "/feed.atom"))
|
||||
getRelativePath(dirname, outputPath "/index.gmi"), \
|
||||
getRelativePath(dirname, outputPath "/sitemap.gmi"), \
|
||||
getRelativePath(dirname, outputPath "/feed.atom"))
|
||||
}
|
|
@ -21,7 +21,7 @@ function resolvePath(path, resolvedPath, pathComponents) {
|
|||
split(path, pathComponents, "/")
|
||||
|
||||
for (i in pathComponents)
|
||||
if (pathComponents[i] == "." || pathComponents[i+1] == ".." || pathComponents[i] == ""))
|
||||
if (pathComponents[i] == "." || pathComponents[i+1] == ".." || pathComponents[i] == "")
|
||||
continue
|
||||
else
|
||||
resolvedPath = resolvedPath pathComponents[i] "/"
|
|
@ -7,7 +7,6 @@ BEGIN {
|
|||
/^#[^#]/ {
|
||||
match($0, "^#[ ]*")
|
||||
headingText = substr($0, RSTART + RLENGTH)
|
||||
|
||||
title = headingText
|
||||
body = body sprintf("<h1>%s</h1>\n", headingText)
|
||||
|
||||
|
@ -17,13 +16,18 @@ BEGIN {
|
|||
/^##[^#]/ {
|
||||
match($0, "^##[ ]*")
|
||||
headingText = substr($0, RSTART + RLENGTH)
|
||||
|
||||
subHeadings[length(subHeadings)] = headingText
|
||||
|
||||
headingTextAsID = tolower(headingText)
|
||||
gsub(/^[ ]*/, "", headingTextAsID)
|
||||
gsub(/[ ]*$/, "", headingTextAsID)
|
||||
gsub(" ", "_", headingTextAsID)
|
||||
|
||||
body = body sprintf("<h2 id='%s'>%s</h2>\n\
|
||||
<a href='#%s'>Permalink</a><br/><br/>\n", \
|
||||
toFilename(headingText), \
|
||||
headingTextAsID, \
|
||||
headingText, \
|
||||
toFilename(headingText))
|
||||
headingTextAsID)
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -130,10 +134,16 @@ END {
|
|||
if (length(subHeadings) > 0) {
|
||||
tocText = "<details id='toc'> <summary>Table of content</summary> <ol>\n"
|
||||
|
||||
for (i in subHeadings)
|
||||
for (i in subHeadings) {
|
||||
headingTextAsID = tolower(subHeadings[i])
|
||||
gsub(/^[ ]*/, "", headingTextAsID)
|
||||
gsub(/[ ]*$/, "", headingTextAsID)
|
||||
gsub(" ", "_", headingTextAsID)
|
||||
|
||||
tocText = tocText sprintf("<li><a href='#%s'>%s</a></li>\n", \
|
||||
toFilename(subHeadings[i]), \
|
||||
headingTextAsID, \
|
||||
subHeadings[i])
|
||||
}
|
||||
|
||||
tocText = tocText "</ol> </details>\n"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue