From 82c6fad7017261284fcf3b5942811c0f257867ec Mon Sep 17 00:00:00 2001 From: Pavel Demin Date: Mon, 11 Nov 2024 11:37:01 +0100 Subject: [PATCH] replace 11ty with pandoc --- .github/workflows/{11ty.yml => pandoc.yml} | 14 +++--- .prettierignore | 2 - Makefile | 32 +++++++++++++ _data/site.js | 16 ------- _layouts/page.html | 29 ------------ css/main.css | 2 + defaults.yml | 11 +++++ eleventy.config.js | 52 ---------------------- filters.lua | 48 ++++++++++++++++++++ md/alpine.md | 6 +-- md/components.md | 4 +- md/index.md | 4 -- md/led-blinker.md | 6 +-- md/links.md | 4 +- md/md.json | 4 -- md/sdr-receiver-hpsdr.md | 6 +-- md/sdr-transceiver.md | 10 ++--- metadata.yml | 12 +++++ package.json | 15 ------- page.html | 26 +++++++++++ 20 files changed, 148 insertions(+), 155 deletions(-) rename .github/workflows/{11ty.yml => pandoc.yml} (70%) delete mode 100644 .prettierignore create mode 100644 Makefile delete mode 100644 _data/site.js delete mode 100644 _layouts/page.html create mode 100644 defaults.yml delete mode 100644 eleventy.config.js create mode 100644 filters.lua delete mode 100644 md/md.json create mode 100644 metadata.yml delete mode 100644 package.json create mode 100644 page.html diff --git a/.github/workflows/11ty.yml b/.github/workflows/pandoc.yml similarity index 70% rename from .github/workflows/11ty.yml rename to .github/workflows/pandoc.yml index feaee0d..106fa8c 100644 --- a/.github/workflows/11ty.yml +++ b/.github/workflows/pandoc.yml @@ -1,4 +1,4 @@ -name: Deploy 11ty site to Pages +name: Deploy Pandoc site to Pages on: push: @@ -21,17 +21,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install 11ty - run: npm install + - name: Install Pandoc + run: sudo apt-get update && sudo apt-get -yq install pandoc - name: Setup Pages id: pages uses: actions/configure-pages@v5 - - name: Build with 11ty - run: npm run build -- --pathprefix ${{ steps.pages.outputs.base_path }} + - name: Build with Pandoc + run: make BASE=${{ steps.pages.outputs.base_path }} - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index bf3613f..0000000 --- a/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -_site -**/*.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e5a4637 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +BASE = +SITE = _site + +PAGES = $(filter-out index, $(basename $(notdir $(wildcard md/*.md)))) +CONTENT = $(addprefix $(SITE)/, css img index.html $(addsuffix /index.html, $(PAGES))) + +PANDOC = pandoc --defaults defaults.yml --metadata base=$(abspath $(BASE)) + +MKDIR = mkdir -p +CP = cp -r +RM = rm -rf + +all: $(SITE) $(CONTENT) + +$(SITE): + @$(MKDIR) $@ + +$(SITE)/%: % + @echo ">> Copying $^" + @$(MKDIR) $(@D) + @$(CP) $^ $@ + +$(SITE)/%.html $(SITE)/%/index.html: md/%.md + @echo ">> Converting $^" + @$(MKDIR) $(@D) + @$(PANDOC) --metadata page=$* --output $@ $^ + +serve: + @python3 -m http.server --bind 127.0.0.1 --directory $(SITE) + +clean: + @$(RM) $(SITE) diff --git a/_data/site.js b/_data/site.js deleted file mode 100644 index a293ce2..0000000 --- a/_data/site.js +++ /dev/null @@ -1,16 +0,0 @@ -export default { - title: "Eclypse Z7 Notes", - - description: "Notes on the Eclypse Z7 development board", - - baseurl: "https://pavel-demin.github.io/eclypse-z7-notes", - - source: "https://github.com/pavel-demin/eclypse-z7-notes", - issues: "https://github.com/pavel-demin/eclypse-z7-notes/issues", - - release_image: - "https://github.com/pavel-demin/eclypse-z7-notes/releases/download/20230222/eclypse-z7-alpine-3.14-armv7-20230222.zip", - - extio_file: - "https://www.dropbox.com/scl/fi/pl8gfjn2ay267or1zkohu/extio_red_pitaya.dll?rlkey=zhmv6qktymfeno8bdap94noq9&dl=1", -}; diff --git a/_layouts/page.html b/_layouts/page.html deleted file mode 100644 index 766d45a..0000000 --- a/_layouts/page.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -{% if title %}{{ title }}{% else %}{{ site.title }}{% endif %} - - -
-
-{{ site.title }} -
-
-Source -Issues -
-
-
-{% if title -%} -

{{ title }}

-{% endif -%} -{{ content -}} -
- - diff --git a/css/main.css b/css/main.css index b24bc99..61e77dc 100644 --- a/css/main.css +++ b/css/main.css @@ -14,6 +14,8 @@ html { Liberation Sans, DejaVu Sans, sans-serif; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; text-size-adjust: none; } diff --git a/defaults.yml b/defaults.yml new file mode 100644 index 0000000..062c644 --- /dev/null +++ b/defaults.yml @@ -0,0 +1,11 @@ +standalone: true +template: page.html + +reader: markdown-implicit_figures +writer: html + +highlight-style: null +wrap: none + +metadata-file: metadata.yml +filters: [filters.lua] diff --git a/eleventy.config.js b/eleventy.config.js deleted file mode 100644 index 0e819cd..0000000 --- a/eleventy.config.js +++ /dev/null @@ -1,52 +0,0 @@ -import { EleventyHtmlBasePlugin } from "@11ty/eleventy"; -import { IdAttributePlugin } from "@11ty/eleventy"; - -import postcss from "postcss"; -import autoprefixer from "autoprefixer"; -import cssnano from "cssnano"; - -import site from "./_data/site.js"; - -const postcssPlugins = [ - autoprefixer(), - cssnano({ - preset: "default", - }), -]; - -export default function (eleventyConfig) { - eleventyConfig.addPassthroughCopy("img"); - eleventyConfig.addPassthroughCopy("etc"); - - eleventyConfig.addPlugin(EleventyHtmlBasePlugin); - eleventyConfig.addPlugin(IdAttributePlugin); - - eleventyConfig.setTemplateFormats(["md", "css"]); - - eleventyConfig.addExtension("css", { - outputFileExtension: "css", - compile: async (inputContent, inputPath) => async () => - await postcss(postcssPlugins) - .process(inputContent, { from: inputPath }) - .then((result) => result.css), - }); - - eleventyConfig.addShortcode("canonical", (url) => site.baseurl + url); - - eleventyConfig.setLiquidOptions({ - dynamicPartials: false, - root: ["_includes", "."], - }); -} - -export const config = { - dir: { - input: ".", - data: "_data", - includes: "_includes", - layouts: "_layouts", - output: "_site", - }, - htmlTemplateEngine: "liquid", - markdownTemplateEngine: "liquid", -}; diff --git a/filters.lua b/filters.lua new file mode 100644 index 0000000..9088ae6 --- /dev/null +++ b/filters.lua @@ -0,0 +1,48 @@ +local meta = {} +local title = nil +local stringify = pandoc.utils.stringify + +function get_title(h) + if h.level == 1 and not title then + title = h.content + return h + end +end + +function change_meta(m) + meta = m + if m.page == "index" then + m.canonical = stringify(m.baseurl) .. "/" + else + m.canonical = stringify(m.baseurl) .. "/" .. m.page .. "/" + end + m.title = title or m.site_title + return m +end + +function change_link_target(l) + if meta[l.target] then + l.target = stringify(meta[l.target]) + elseif l.target:sub(1, 1) == "/" then + l.target = meta.base .. l.target + end + return l +end + +function change_image_src(i) + if i.src:sub(1, 1) == "/" then + i.src = meta.base .. i.src + end + return i +end + +return { + { + Header = get_title, + Meta = change_meta + }, + { + Link = change_link_target, + Image = change_image_src + } +} diff --git a/md/alpine.md b/md/alpine.md index 92cbfbd..e883c3e 100644 --- a/md/alpine.md +++ b/md/alpine.md @@ -1,6 +1,4 @@ ---- -title: Alpine with pre-built applications ---- +# Alpine with pre-built applications ## Introduction @@ -8,7 +6,7 @@ To simplify maintenance and distribution of the pre-built applications described ## Getting started -- Download [SD card image zip file]({{ site.release_image }}). +- Download [SD card image zip file](release_image). - Copy the contents of the SD card image zip file to a micro SD card. - Optionally, to start one of the applications automatically at boot time, copy its `start.sh` file from `apps/` to the topmost directory on the SD card. - Install the micro SD card in the Eclypse Z7 board and connect the power. diff --git a/md/components.md b/md/components.md index d90e68b..139d235 100644 --- a/md/components.md +++ b/md/components.md @@ -1,6 +1,4 @@ ---- -title: List of components ---- +# List of components The following is a list of components that can be used with Eclypse Z7. diff --git a/md/index.md b/md/index.md index 4109495..530362f 100644 --- a/md/index.md +++ b/md/index.md @@ -1,7 +1,3 @@ ---- -permalink: / ---- - 1. [List of components](/components/) 1. [Links](/links/) 1. [LED blinker](/led-blinker/) diff --git a/md/led-blinker.md b/md/led-blinker.md index daef296..909646c 100644 --- a/md/led-blinker.md +++ b/md/led-blinker.md @@ -1,6 +1,4 @@ ---- -title: LED blinker ---- +# LED blinker ## Introduction @@ -107,7 +105,7 @@ Building an SD card image: sudo sh scripts/alpine.sh ``` -A pre-built SD card image can be downloaded from [this link]({{ site.release_image }}). +A pre-built SD card image can be downloaded from [this link](release_image). To write the image to a micro SD card, copy the contents of the SD card image zip file to a micro SD card. diff --git a/md/links.md b/md/links.md index 6510c7a..43abdf6 100644 --- a/md/links.md +++ b/md/links.md @@ -1,6 +1,4 @@ ---- -title: Links ---- +# Links - [Digilent documentation for Eclypse Z7](https://digilent.com/reference/programmable-logic/eclypse-z7/start) diff --git a/md/md.json b/md/md.json deleted file mode 100644 index 90b5aaa..0000000 --- a/md/md.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "layout": "page.html", - "permalink": "/{{ page.fileSlug }}/" -} diff --git a/md/sdr-receiver-hpsdr.md b/md/sdr-receiver-hpsdr.md index ff68230..7945b35 100644 --- a/md/sdr-receiver-hpsdr.md +++ b/md/sdr-receiver-hpsdr.md @@ -1,6 +1,4 @@ ---- -title: SDR receiver compatible with HPSDR ---- +# SDR receiver compatible with HPSDR ## Introduction @@ -48,7 +46,7 @@ This SDR receiver should work with most of the programs that support the HPSDR/M ## Getting started -- Download [SD card image zip file]({{ site.release_image }}) (more details about the SD card image can be found at [this link](/alpine/)). +- Download [SD card image zip file](release_image) (more details about the SD card image can be found at [this link](/alpine/)). - Copy the contents of the SD card image zip file to a micro SD card. - Optionally, to start the application automatically at boot time, copy its `start.sh` file from `apps/sdr_receiver_hpsdr` to the topmost directory on the SD card. - Install the micro SD card in the Eclypse Z7 board and connect the power. diff --git a/md/sdr-transceiver.md b/md/sdr-transceiver.md index 1abc39d..0da5297 100644 --- a/md/sdr-transceiver.md +++ b/md/sdr-transceiver.md @@ -1,6 +1,4 @@ ---- -title: SDR transceiver ---- +# SDR transceiver ## Introduction @@ -50,7 +48,7 @@ The [projects/sdr_transceiver/gnuradio](https://github.com/pavel-demin/eclypse-z ## Getting started with GNU Radio - Connect an antenna to the CH1 connector of the Zmod Digitizer module. -- Download [SD card image zip file]({{ site.release_image }}) (more details about the SD card image can be found at [this link](/alpine/)). +- Download [SD card image zip file](release_image) (more details about the SD card image can be found at [this link](/alpine/)). - Copy the contents of the SD card image zip file to a micro SD card. - Optionally, to start the application automatically at boot time, copy its `start.sh` file from `apps/sdr_transceiver` to the topmost directory on the SD card. - Install the micro SD card in the Eclypse Z7 board and connect the power. @@ -77,12 +75,12 @@ gnuradio-companion fm.grc ## Getting started with SDR# and HDSDR - Connect an antenna to the CH1 connector of the Zmod Digitizer module. -- Download [SD card image zip file]({{ site.release_image }}) (more details about the SD card image can be found at [this link](/alpine/)). +- Download [SD card image zip file](release_image) (more details about the SD card image can be found at [this link](/alpine/)). - Copy the contents of the SD card image zip file to a micro SD card. - Optionally, to start the application automatically at boot time, copy its `start.sh` file from `apps/sdr_transceiver` to the topmost directory on the SD card. - Install the micro SD card in the Eclypse Z7 board and connect the power. - Download and install [SDR#](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AAAdAcU238cppWziK4xPRIADa/sdr/sdrsharp_v1.0.0.1361_with_plugins.zip?dl=1) or [HDSDR](https://www.hdsdr.de). -- Download [pre-built ExtIO plug-in]({{ site.extio_file }}) for SDR# and HDSDR. +- Download [pre-built ExtIO plug-in](extio_file) for SDR# and HDSDR. - Copy `extio_red_pitaya.dll` into the SDR# or HDSDR installation directory. - Start SDR# or HDSDR. - Select Red Pitaya from the Source list in SDR# or from the Options [F7] → Select Input menu in HDSDR. diff --git a/metadata.yml b/metadata.yml new file mode 100644 index 0000000..d9bfd8d --- /dev/null +++ b/metadata.yml @@ -0,0 +1,12 @@ +site_title: Eclypse Z7 Notes + +description: Notes on the Eclypse Z7 development board + +baseurl: https://pavel-demin.github.io/eclypse-z7-notes + +source: https://github.com/pavel-demin/eclypse-z7-notes +issues: https://github.com/pavel-demin/eclypse-z7-notes/issues + +release_image: https://github.com/pavel-demin/eclypse-z7-notes/releases/download/20230222/eclypse-z7-alpine-3.14-armv7-20230222.zip + +extio_file: https://www.dropbox.com/scl/fi/pl8gfjn2ay267or1zkohu/extio_red_pitaya.dll?rlkey=zhmv6qktymfeno8bdap94noq9&dl=1 diff --git a/package.json b/package.json deleted file mode 100644 index 08f4896..0000000 --- a/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "module", - "scripts": { - "format": "npx prettier --write .", - "start": "npx @11ty/eleventy --serve", - "build": "npx @11ty/eleventy" - }, - "devDependencies": { - "@11ty/eleventy": "^3.0.0", - "autoprefixer": "^10.4.20", - "cssnano": "^7.0.6", - "postcss": "^8.4.47", - "prettier": "^3.3.3" - } -} diff --git a/page.html b/page.html new file mode 100644 index 0000000..deddebc --- /dev/null +++ b/page.html @@ -0,0 +1,26 @@ + + + + + + + + + +${title} + + +
+
+${site_title} +
+
+Source +Issues +
+
+
+${body} +
+ +