From 0458ac2ac791be5a4c81b3e7c943877d73f58062 Mon Sep 17 00:00:00 2001 From: sejo Date: Sun, 27 Mar 2022 19:42:34 -0600 Subject: [PATCH] moving to lua-based generator --- .gitignore | 1 - README.md | 28 ++---- etc/generador/README.md | 98 +++++++++++++++++++ .../generador/gemtext2html.awk | 0 .../generador/generasitio.sh | 0 genindice.awk => etc/generador/genindice.awk | 0 genlog.awk => etc/generador/genlog.awk | 0 gmo2gmi.awk => etc/generador/gmo2gmi.awk | 0 links.py => etc/generador/links.py | 0 9 files changed, 108 insertions(+), 19 deletions(-) create mode 100644 etc/generador/README.md rename gemtext2html.awk => etc/generador/gemtext2html.awk (100%) rename generasitio.sh => etc/generador/generasitio.sh (100%) rename genindice.awk => etc/generador/genindice.awk (100%) rename genlog.awk => etc/generador/genlog.awk (100%) rename gmo2gmi.awk => etc/generador/gmo2gmi.awk (100%) rename links.py => etc/generador/links.py (100%) diff --git a/.gitignore b/.gitignore index 6d31f78..6403df3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ web/* gem/* src/pages.gmo tmp/* -generador gemtest webtest src/log.gmo diff --git a/README.md b/README.md index db6c081..7b7a286 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,25 @@ # compudanzas -this repository contains the scripts and source files for the compudanzas site in gemini and the web +this repository contains the script and source files for the compudanzas site in gemini and the web * generated in web/ : [https://compudanzas.net](https://compudanzas.net) * generated in gem/ : [gemini://compudanzas.net](gemini://compudanzas.net/) # generate site -call the shell script: +the generator script requires lua. -``` -./generasitio.sh +it was developed using lua 5.3.3 but it probably works with previous versions. + +in order to call the script and build the site: + +```sh +$ lua generasitio.lua ``` -# files +## archive -* `generasitio.sh`: the shell script that copies files and call the other scripts with the corresponding arguments (like last modified date) -* `gemtext2html.awk`: converts the files in .gmo format (modified .gmi) to an html version, according to the spec and my own taste -* `gmo2gmi.awk`: converts the files in .gmo format to real .gmi -* `genindice.awk`: generates the index of all pages -* `links.py`: calculates the incoming links between pages and adds them to the files -* `genlog.awk`: generates the log files (atom, twtxt, gemsub) from `src/log.txt` -* `gmo.nanorc`: syntax highlighting for .gmo format in nano +the `etc/generador/` directory contains the previous generator files and `README.md`, written in bash, awk and python. # .gmo format @@ -87,12 +85,6 @@ converted to gemtext: => ./references.gmi references ``` -## incoming links calculation - -`links.py` takes both of those types of wikilinks in order to perform its calculation. - -it looks at the contents between the curly brackets, converts them to a filename format (replacing spaces for underscores), and assummes that file actually exists. - # license [peer production license](https://wiki.p2pfoundation.net/Peer_Production_License) diff --git a/etc/generador/README.md b/etc/generador/README.md new file mode 100644 index 0000000..db6c081 --- /dev/null +++ b/etc/generador/README.md @@ -0,0 +1,98 @@ +# compudanzas + +this repository contains the scripts and source files for the compudanzas site in gemini and the web + +* generated in web/ : [https://compudanzas.net](https://compudanzas.net) +* generated in gem/ : [gemini://compudanzas.net](gemini://compudanzas.net/) + +# generate site + +call the shell script: + +``` +./generasitio.sh +``` + +# files + +* `generasitio.sh`: the shell script that copies files and call the other scripts with the corresponding arguments (like last modified date) +* `gemtext2html.awk`: converts the files in .gmo format (modified .gmi) to an html version, according to the spec and my own taste +* `gmo2gmi.awk`: converts the files in .gmo format to real .gmi +* `genindice.awk`: generates the index of all pages +* `links.py`: calculates the incoming links between pages and adds them to the files +* `genlog.awk`: generates the log files (atom, twtxt, gemsub) from `src/log.txt` +* `gmo.nanorc`: syntax highlighting for .gmo format in nano + +# .gmo format + +the same format as gmi (gemtext), but with the following line types: + +* `+` add this line to the html file but not to the gmi file +* `&` add this line to the gmi file but not to the html file + +# wikilinks + +## inline wikilinks + +the generator can parse and convert inline {wikilinks}, as many as needed per line + +* in html, they get converted to an inline link +* in gemtext, the links are added after the line with the text + +.gmo text: + +``` +see the {roadmap} for updates that want to happen. +``` + +converted to html: + +```html +

+see the roadmap for updates that want to happen. +

+``` + +converted to gemtext: + +```gemtext +see the roadmap for updates that want to happen. +=> ./roadmap.gmi roadmap +``` + +spaces inside the wikilinks are converted to underscores. + +## gemtext-like wikilinks + +the generator can also parse normal links in gemtext, one per line + +* in html, it gets converted to an inline link +* in gemtext, the link is left as is + +.gmo text: + +``` +=> ./references.gmi {references} +``` + +converted to html: + +```html +

references

+``` + +converted to gemtext: + +``` +=> ./references.gmi references +``` + +## incoming links calculation + +`links.py` takes both of those types of wikilinks in order to perform its calculation. + +it looks at the contents between the curly brackets, converts them to a filename format (replacing spaces for underscores), and assummes that file actually exists. + +# license + +[peer production license](https://wiki.p2pfoundation.net/Peer_Production_License) diff --git a/gemtext2html.awk b/etc/generador/gemtext2html.awk similarity index 100% rename from gemtext2html.awk rename to etc/generador/gemtext2html.awk diff --git a/generasitio.sh b/etc/generador/generasitio.sh similarity index 100% rename from generasitio.sh rename to etc/generador/generasitio.sh diff --git a/genindice.awk b/etc/generador/genindice.awk similarity index 100% rename from genindice.awk rename to etc/generador/genindice.awk diff --git a/genlog.awk b/etc/generador/genlog.awk similarity index 100% rename from genlog.awk rename to etc/generador/genlog.awk diff --git a/gmo2gmi.awk b/etc/generador/gmo2gmi.awk similarity index 100% rename from gmo2gmi.awk rename to etc/generador/gmo2gmi.awk diff --git a/links.py b/etc/generador/links.py similarity index 100% rename from links.py rename to etc/generador/links.py