all repos — h3rald @ 90056b98b87a1f24b5366458df8e3d7ae2c4db18

The sources of https://h3rald.com

Added linting script.
h3rald h3rald@h3rald.com
Fri, 23 Feb 2024 10:54:06 +0100
commit

90056b98b87a1f24b5366458df8e3d7ae2c4db18

parent

ee3af68f1723ba1851fa999fe21c596ccf0d5978

4 files changed, 115 insertions(+), 2 deletions(-)

jump to
M assets/styles/style.cssassets/styles/style.css

@@ -371,6 +371,13 @@ }

.main-content { margin-top: 20px; + max-width: 1024px; + margin: auto; +} + +footer { + max-width: 1024px; + margin: auto; } @media screen and (max-width: 385px) {
M rules.minrules.min

@@ -207,7 +207,7 @@ id page process-icons @page

id page process-code @page content page %contents @content ( - ((id "^(glyph|ruby-compendium)\/book" match?) ()) ;Do not add index.html + ((id "^(glyph|ruby-compendium)(\/|\\\\)book" match?) ()) ;Do not add index.html due to the way book internal links work. ((id "index" !=)( content "$1/index" (id) =% %id
A scripts/lint.min

@@ -0,0 +1,106 @@

+"output" ls-r ("\.html?" match?) filter :html-files + +( + symbol check-links + (str :contents ==> quot :result) + ( + () @result + contents "<a.+?href=\"(.+?)(?:#.+?)?\".*?>.+?</a>" search-all :hrefs + hrefs ( + 1 get :href + href :resolved-href + ; Check internal links + (href "^\/" match?) + ( + (href "\..+$" match? not) + ( + (href "\/$" match?) + ("$#$#" (href "index.html") =% @resolved-href) + ("$#/$#" (href "index.html") =% @resolved-href) + if + ) + when + "$#$#" ("output" resolved-href) =% @resolved-href + (resolved-href file? not) + ( + (result resolved-href in? not) + (resolved-href result append @result) + when + ) + when + ) + when + (href "^https?:\/\/(?:www.)?h3rald.com" match?) + ( + (result href in? not) + (href result append @result) + when + ) + when + ) foreach + ) +) :: + +( + symbol check-images + (str :contents ==> quot :result) + ( + () @result + contents "<img.+?src=\"(.+?)\".*?>" search-all :srcs + srcs ( + 1 get :src + src :resolved-src + ; Check internal images + (src "^\/" match?) + ( + "$#$#" ("output" resolved-src) =% @resolved-src + (resolved-src file? not) + ( + (result resolved-src in? not) + (resolved-src result append @result) + when + ) + when + ) + when + (src "^https?:\/\/(?:www.)?h3rald.com" match?) + ( + (result src in? not) + (src result append @result) + when + ) + when + ) foreach + ) +) :: + +; Check all output files for internal broken links and images +html-files +( + :file + file fread :contents + contents check-links :broken-links + contents check-images :broken-images + broken-links size :n-links + broken-images size :n-images + (((n-links 0 >)(n-images 0 >)) ||) + ( + "=> $#" (file) =% puts! + (n-links 0 >) + (" -> $# Invalid Links:" (n-links) =% puts!) + when + broken-links ( + :target + " - $#" (target) =% puts! + ) foreach + (n-images 0 >) + (" -> $# Invalid Images:" (n-images) =% puts!) + when + broken-images ( + :target + " - $#" (target) =% puts! + ) foreach + ) + when +) foreach +
M templates/article.mustachetemplates/article.mustache

@@ -13,7 +13,7 @@ <div class="row">

<div class="col-xs-12"> <article class="{{content-type}} box content"> {{> _page_header}} - <time datetime="{{date-iso8601}}"><img src="/images/entypo/calendar.svg" alt="[date]" class="icon"/>&nbsp;{{date}}</time> + <time datetime="{{date-iso8601}}"><img src="/images/icons/calendar.svg" alt="[date]" class="icon"/>&nbsp;{{date}}</time> <div class="body-text" class="hyphenate"> {{{contents}}} </div>