some script changes

This commit is contained in:
Abdullah Islam 2023-11-04 16:15:28 +06:00
parent e29e3a663f
commit bdf7c1c4ab
4 changed files with 27 additions and 31 deletions

View File

@ -2,9 +2,7 @@ function genNavbarHTML(filename, sourcePath, outputPath) {
if (filename == "-" || filename == "/dev/stdout/")
return ""
sub("^" sourcePath, outputPath, filename)
dirname = getDirname(filename)
sub(/(\.|\[|\]|\*)/, "\\&", sourcePath)
return sprintf("<nav id='navbar'>\n\
<a href='%s'>home</a> | \n\
@ -14,20 +12,18 @@ function genNavbarHTML(filename, sourcePath, outputPath) {
<a href='%s'>feed</a> | \n\
<a href='http://git.vern.cc/techn0path/'>git</a>\n\
</nav><hr>\n", \
getRelativePath(dirname, outputPath "/index.html"), \
getRelativePath(dirname, outputPath "/useful/index.html"), \
getRelativePath(dirname, outputPath "/notes/index.html"), \
getRelativePath(dirname, outputPath "/sitemap.html"), \
getRelativePath(dirname, outputPath "/feed.atom"))
getRelativePath(dirname, sourcePath "/index.html"), \
getRelativePath(dirname, sourcePath "/useful/index.html"), \
getRelativePath(dirname, sourcePath "/notes/index.html"), \
getRelativePath(dirname, sourcePath "/sitemap.html"), \
getRelativePath(dirname, sourcePath "/feed.atom"))
}
function genNavbarGMI(filename, sourcePath, outputPath) {
if (filename == "-" || filename == "/dev/stdout/")
return ""
sub("^" sourcePath, outputPath, filename)
dirname = getDirname(filename)
sub(/(\.|\[|\]|\*)/, "\\&", sourcePath)
return sprintf("Navigation:\n\
=> %s home\n\
@ -36,9 +32,9 @@ function genNavbarGMI(filename, sourcePath, outputPath) {
=> %s sitemap\n\
=> %s feed\n\
=> https://git.vern.cc/techn0path/ git\n\n", \
getRelativePath(dirname, outputPath "/index.gmi"), \
getRelativePath(dirname, outputPath "/useful/index.gmi"), \
getRelativePath(dirname, outputPath "/notes/index.gmi"), \
getRelativePath(dirname, outputPath "/sitemap.gmi"), \
getRelativePath(dirname, outputPath "/feed.atom"))
getRelativePath(dirname, sourcePath "/index.gmi"), \
getRelativePath(dirname, sourcePath "/useful/index.gmi"), \
getRelativePath(dirname, sourcePath "/notes/index.gmi"), \
getRelativePath(dirname, sourcePath "/sitemap.gmi"), \
getRelativePath(dirname, sourcePath "/feed.atom"))
}

View File

@ -7,7 +7,9 @@ function getDirname(path, pathComponents, dirname) {
if (length(pathComponents) < 2) return "."
for (i in pathComponents)
pathComponents[length(pathComponents)] = ""
for (i = 1; i < length(pathComponents); i++)
dirname = dirname pathComponents[i] "/"
return dirname

View File

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

View File

@ -6,16 +6,16 @@
<meta name='referrer' content='no-referrer' />
<meta name='viewpoint' content='width=device-width,initial-scale=1.0' />
<link rel='stylesheet' href='style.css'/>
<link rel='stylesheet' href='src/style.css'/>
</head>
<body>
<header>
<nav id='navbar'>
<a href='index.html'>home</a> |
<a href='useful/index.html'>useful</a> |
<a href='notes/index.html'>notes</a> |
<a href='sitemap.html'>sitemap</a> |
<a href='feed.atom'>feed</a> |
<a href='src/index.html'>home</a> |
<a href='index.html/src/useful'>useful</a> |
<a href='index.html/src/notes'>notes</a> |
<a href='src/sitemap.html'>sitemap</a> |
<a href='src/feed.atom'>feed</a> |
<a href='http://git.vern.cc/techn0path/'>git</a>
</nav><hr>
@ -27,10 +27,9 @@
<h1>Testing Input</h1>
<p>This is testing input.</p>
<p></p>
<p>And this text should be &lt;escaped&gt;, so that the characters work in &apos;HTML.</p>
<p></p>
<blockquote>
Quotes should work.<br>
- Me<br>
</blockquote>
<pre>
@ -38,17 +37,16 @@ And code should work too.
Right?
&gt; Well quotes within code don&apos;t work.
</pre>
<p></p>
<ul>
<li>Unordered lists</li>
<li>should work properly, hopefully</li>
</ul>
<ul>
<li>And spaces seperate lists</li>
</ul>
<h2 id='level_2_subheadings_work'>Level 2 Subheadings work</h2>
<a href='#level_2_subheadings_work'>Permalink</a><br/><br/>
<p></p>
<h3>Level 3 Subheadings work</h3>
<p></p>
<p>#### But not beyond that.</p>
<p>If you have any suggestions, let me know at <a href='mailto:logicartist123@gmail.com'>logicartist123@gmail.com</a>. Sorry, I still use GMail. :/</p>