fixed broken links

This commit is contained in:
Abdullah Islam 2023-09-22 09:10:20 +06:00
parent fe45ac3466
commit 0e89ab80fc
6 changed files with 19 additions and 20 deletions

View File

@ -44,16 +44,16 @@ html/style.css: src/style.css
cp $< $@
html/%.html: src/%.gmi scripts/html.awk scripts/navbar.awk
mawk -f scripts/navbar.awk -f scripts/path.awk -f scripts/html.awk -- $< > $@
mawk -f scripts/navbar.awk -f scripts/path.awk -v 'sourcePath=src/ outputPath=html/' -f scripts/html.awk -- $< > $@
gmi/%.gmi: src/%.gmi scripts/gemini.awk scripts/navbar.awk
mawk -f scripts/navbar.awk -f scripts/path.awk -f scripts/gemini.awk -- $< > $@
mawk -f scripts/navbar.awk -f scripts/path.awk -v 'sourcePath=src/ outputPath=html/' -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 scripts/path.awk -f scripts/sitemap_gmi.awk -- $(SITEMAP_INDEX_FILES) > $@
mawk -f scripts/navbar.awk -f scripts/path.awk -v 'sourcePath=src/ outputPath=html/' -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 scripts/path.awk -f scripts/sitemap_html.awk -- $(SITEMAP_INDEX_FILES) > $@
mawk -f scripts/navbar.awk -f scripts/path.awk -v 'sourcePath=src/ outputPath=html/' -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 scripts/path.awk -f scripts/feed.awk -- - > $@

View File

@ -144,13 +144,16 @@ END {
tocText = tocText "</ol> </details>\n"
}
navbarText = genNavbarHTML(FILENAME, "src/", "html/")
navbarText = genNavbarHTML(FILENAME, sourcePath, outputPath)
stylesheetPath = getRelativePath(dirname, outputPath "/style.css")
dirname = getDirname(FILENAME)
gsub(/(\.|\[|\]|\*)/, "\\&", sourcePath)
gsub(sourcePath, outputPath, dirname)
gsub(sourcePath, outputPath, filename)
printf "<!DOCTYPE html>\n\
<html>\n\
<head>\n\
@ -159,7 +162,7 @@ END {
<meta name='referrer' content='no-referrer' />\n\
<meta name='viewpoint' content='width=device-width,initial-scale=1.0' />\n\
\n\
<link ref='stylesheet' href='%s'>\n\
<link rel='stylesheet' href='%s'/>\n\
</head>\n\
<body>\n\
<header>\n\

View File

@ -50,5 +50,7 @@ function getRelativePath(base, path, resolvedPath, baseComponents, pathComponent
resolvedPath = resolvedPath pathComponents[i] "/"
}
sub(/\/+$/, "", resolvedPath)
return resolvedPath
}

View File

@ -55,6 +55,6 @@ body { margin: 20px; }\n\
</article>\n\
</body>\n\
</html>", \
genNavbarHTML(FILENAME, "src/", "html/"), \
genNavbarHTML(FILENAME, sourcePath, outputPath), \
body
}

View File

@ -1,7 +1,7 @@
Navigation:
=> gmi/index.gmi/ home
=> gmi/sitemap.gmi/ sitemap
=> gmi/feed.atom/ feed
=> gmi/index.gmi home
=> gmi/sitemap.gmi sitemap
=> gmi/feed.atom feed
=> http://git.vern.cc/techn0path/ git
# Testing Input

View File

@ -6,20 +6,14 @@
<meta name='referrer' content='no-referrer' />
<meta name='viewpoint' content='width=device-width,initial-scale=1.0' />
<style>
#content { max-width: 70ch; margin: auto; padding: 10px; }
#navbar { max-width: 70ch; margin: auto; padding: 10px; background: teal; color: white; }
#navbar a { color: white; }
hr { max-width: 70ch; }
.permalink { margin-left: 15px; }
</style>
<link rel='stylesheet' href='style.css'/>
</head>
<body>
<header>
<nav id='navbar'>
<a href='html/index.html/'>home</a> |
<a href='html/sitemap.html/'>sitemap</a> |
<a href='html/feed.atom/'>feed</a> |
<a href='index.html'>home</a> |
<a href='sitemap.html'>sitemap</a> |
<a href='feed.atom'>feed</a> |
<a href='http://git.vern.cc/techn0path/'>git</a>
</nav><br>