diff --git a/README.md b/README.md
new file mode 100644
index 0000000..84b2b2a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,58 @@
+---
+title: Website Publication Files
+cuid: 26e4-a0
+trls: [ nl ]
+lang: en
+---
+
+This describes how I publish selected files from this repository to the Web. Actually, these files _are_ the publication mechanism.
+
+
+
+
+## The Engine
+The static site is generated with [Web Origami](https://weborigami.org).
+
+`pipeline.ori` contains the main pipeline. `site.ori` selects some keys from `pipeline.ori` to create the final site. The reason for this split is: there are a bunch of steps in the pipeline which should not be exposed in the final build, but that do need to be accessible for inspection during development/debugging.
+
+Both files take an argument which specifies whether to build the site in public or private mode. In public mode, only files with a certain tag are included in the output.
+
+Public mode is the default. Run: `ori site.ori()` or `ori pipeline.ori()`.
+
+For private mode, run: `ori 'site.ori("all")'` or `ori 'pipeline.ori("all")'`.
+
+
—private-below—
+ +EXCEPT NOT REALLY! In this case, because this file is hardlinked to `README.md` inside a publicised git repository. You have been warned! + +## Organisation + +${ada_pubfiles-worklog.md/} diff --git a/_atest.md b/_atest.md deleted file mode 100644 index 66ad4a2..0000000 --- a/_atest.md +++ /dev/null @@ -1 +0,0 @@ -WILL BE SEEN IN FINAL OUTPUT! diff --git a/_origami-questions-deep-filters.md b/_origami-questions-deep-filters.md deleted file mode 100644 index beb13e9..0000000 --- a/_origami-questions-deep-filters.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: foobar ---- - -(see test.ori. This is confusing!) -So I was wondering the following, but I believe by default the path `..` returns a shallow tree by default, so the question is moot. That is: I was stuck on how to apply a regex to a nested tree of file paths, but I was erroneously assuming the tree was deep, but it's not. - -My original solution therefore works because the input is already just the top-level flat directory contents: - -``` -{ - all: .. - filtered: Tree.filter(raw, (val, key) => key.endsWith('.md')) //yes, should really use globKeys for this, but actually I'm doing a more complex comparison with AND here -} -``` - -Nevertheless, I can't figure out if its possible to achieve the goal stated in the subject. - -`globKeys` supports a limited set of glob patterns. I guess `mask` with `regExpKeys` is probably the closest, but it's not going to work across deep paths? - -given this directory structure: - -``` -/src - readme.md - installation.md - node_modules/ - package/ - readme.md -``` - -I only want `src/readme.md` and `src/installation.md`. - -I came up with this, except is it going to be a deep operation? - -``` -{ - all: .. - selected: Tree.map(all, Tree.regExpKeys({"^[^\/]+?\/.*\.md$": false})) -} -``` -the regex returns false if the string ends with `.md` but also has a folder name with slash at the beginning. So these are excluded from the result. - -huh: would you have to do some rewriting of keys to a flat map with concatenated paths? diff --git a/_testfile.ori.md b/_testfile.ori.md deleted file mode 100644 index ef2214c..0000000 --- a/_testfile.ori.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: ok -id: testit -date: today ---- - -# My file - -${<_index.md>} diff --git a/ada_public-site.ori b/ada_public-site.ori deleted file mode 100644 index c55bf5f..0000000 --- a/ada_public-site.ori +++ /dev/null @@ -1,3 +0,0 @@ -{ - files: site.ori('')/filenames -} diff --git a/adb_private-site.ori b/adb_private-site.ori deleted file mode 100644 index c6160f7..0000000 --- a/adb_private-site.ori +++ /dev/null @@ -1,3 +0,0 @@ -{ - files: site.ori("all")/filenames -} diff --git a/allfiles.sh b/allfiles.sh deleted file mode 100644 index af5cbff..0000000 --- a/allfiles.sh +++ /dev/null @@ -1,2 +0,0 @@ -fd -e md --color=never -#fd -e txt diff --git a/another_pubfile.md b/another_pubfile.md deleted file mode 100644 index 31c2001..0000000 --- a/another_pubfile.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Another Public File -cuid: 26ef-a0 ---- - -This file is also public. But not all of it. - -This part will not be shown. -Everything following here will be hidden from private view! diff --git a/anotherfile.md b/anotherfile.md deleted file mode 100644 index 52b359b..0000000 --- a/anotherfile.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Another File -cuid: 26e4-a2 ---- - -Just some text, in this file. - -This file should only be shown if site was built with `site.ori("all")`, -because it does not have `_pub` in its filename. diff --git a/echo.sh b/echo.sh deleted file mode 100644 index 1c06984..0000000 --- a/echo.sh +++ /dev/null @@ -1,3 +0,0 @@ -while read line -do echo "$line" -done diff --git a/addFilenameData.js b/filenamedata/addFilenameData.js similarity index 100% rename from addFilenameData.js rename to filenamedata/addFilenameData.js diff --git a/filenameparser.js b/filenamedata/filenameparser.js similarity index 100% rename from filenameparser.js rename to filenamedata/filenameparser.js diff --git a/filenameparser.pegjs b/filenamedata/filenameparser.pegjs similarity index 100% rename from filenameparser.pegjs rename to filenamedata/filenameparser.pegjs diff --git a/extractSummary.js b/html-manipulations/extractSummary.js similarity index 100% rename from extractSummary.js rename to html-manipulations/extractSummary.js diff --git a/removePrivate.js b/html-manipulations/removePrivate.js similarity index 100% rename from removePrivate.js rename to html-manipulations/removePrivate.js diff --git a/getLinkedFilesFromHtml.js b/linked-files/getLinkedFilesFromHtml.js similarity index 100% rename from getLinkedFilesFromHtml.js rename to linked-files/getLinkedFilesFromHtml.js diff --git a/pathsToObjs.js b/linked-files/pathsToObjs.js similarity index 100% rename from pathsToObjs.js rename to linked-files/pathsToObjs.js diff --git a/base_html.ori b/ori-templates/base_html.ori similarity index 100% rename from base_html.ori rename to ori-templates/base_html.ori diff --git a/indexPage.ori b/ori-templates/indexPage.ori similarity index 100% rename from indexPage.ori rename to ori-templates/indexPage.ori diff --git a/page.ori b/ori-templates/page.ori similarity index 100% rename from page.ori rename to ori-templates/page.ori diff --git a/page.ori.html b/ori-templates/page.ori.html similarity index 100% rename from page.ori.html rename to ori-templates/page.ori.html diff --git a/pageSummaries.ori.html b/ori-templates/pageSummaries.ori.html similarity index 100% rename from pageSummaries.ori.html rename to ori-templates/pageSummaries.ori.html diff --git a/pageSummaries.js b/pageSummaries.js deleted file mode 100644 index f7884d8..0000000 --- a/pageSummaries.js +++ /dev/null @@ -1,6 +0,0 @@ -//return title and html ... -export default (doc) => { - - -} - diff --git a/parseHtml.js b/parseHtml.js deleted file mode 100644 index 87b0cf7..0000000 --- a/parseHtml.js +++ /dev/null @@ -1,14 +0,0 @@ -import {fromHtml} from 'hast-util-from-html'; -import {visit} from 'unist-util-visit'; - -export default async function(value) { - const tree = fromHtml(value); - const links = []; - visit(tree, [{tagName: 'link'}, {tagName: 'img'}], function(node) { - links.push(node); - }) - const hrefs = links.map(link => link.properties.href || link.properties.src) - - return hrefs; - // return tree; -} diff --git a/pipeline.ori b/pipeline.ori index d2de665..af08aee 100644 --- a/pipeline.ori +++ b/pipeline.ori @@ -3,59 +3,58 @@ to keep parts of the pipeline private while still allowing better debugging. serve/watch pipeline.ori for debugging. server or copy site.ori to build final output. + + See README.md/# */ (all) => { - /* - list is all the files in current directory. - allfiles is all source files: ending with `.md` and not starting with `_`. - pubfiles is the subset containing the string `_pub`. - files selects either of these depending on the argument passed to this file. + /* + list is all the files in parent directory. + allfiles is all source files: ending with `.md` and not starting with `_`. + pubfiles is the subset containing the string `_pub`. + files selects either of these depending on the argument passed to this file. - NOTES: + NOTES: - - if markdown files are empty, Origami.document() will error. - */ - - /* - this is the external filename method. - */ - // allfiles: allfiles.sh() //reads MD files. - // pubfiles: pubfiles.sh(allfiles) - (list): .. - allfiles: Tree.filter(list, (val, key) => key.endsWith('.md') && !key.startsWith('_')) - documents: Tree.map(allfiles, {value: (value) => Origami.document(value)}) //if I don't use the verbose syntax I get the filename characters as part of value! - withfndata: Tree.map(documents, { value: (value, key) => addFilenameData.js(value, Origami.slash.remove(key))}) - - pubfiles: Tree.filter(withfndata, (val, key) => val.fnd.tags?.includes('pub')) - - /* - Now convert to html. - */ - asHtml: Tree.map(all ? withfndata: pubfiles, { - value: (value) => Origami.mdHtml(value) - key: (value, key) => `${value.fnd.name}` - }) - - /* - after converting to html, we can extract a 'summary' from the file. - With markdown, the title is taken from the YAML frontmatter, - and ends up in a separate field of the document. - So we dont have to worry about the title being part of the summary. - */ - withSummary: Tree.map(asHtml, extractSummary.js) - - /* - Removing private content coming below the html paragraph `—private-below—
` - Only remove this if in public mode. So if this file is called as `site.ori("all")`, - then final output is `withSummary`, otherwise it's `privateRemoved`. - */ - privateRemoved: Tree.map(withSummary, removePrivate.js) - final: (all ? withSummary : privateRemoved ) - + - if markdown files are empty, Origami.document() will error. + */ /* - slightly complex. This adds a property `html` to the page with the rendered content. + this is the external filename method. */ + // allfiles: allfiles.sh() //reads MD files. + // pubfiles: pubfiles.sh(allfiles) + (list): .. + allfiles: Tree.filter(list, (val, key) => key.endsWith('.md') && !key.startsWith('_')) + documents: Tree.map(allfiles, {value: (value) => Origami.document(value)}) //if I don't use the verbose syntax I get the filename characters as part of value! + withfilenamedata: Tree.map(documents, { value: (value, key) => addFilenameData.js(value, Origami.slash.remove(key))}) + //files now have a key `fnd` for 'filenamedata`. This contains address, title, and tags parsed from the filename. + + pubfiles: Tree.filter(withfilenamedata, (val, key) => val.fnd.tags?.includes('pub')) + + /* + Now convert to html. + */ + asHtml: Tree.map(all ? withfilenamedata: pubfiles, { + value: (value) => Origami.mdHtml(value) + key: (value, key) => `${value.fnd.name}` + }) + + /* + after converting to html, we can extract a 'summary' from the file. + With markdown, the title is taken from the YAML frontmatter, + and ends up in a separate field of the document. + So we dont have to worry about the title being part of the summary. + */ + withSummary: Tree.map(asHtml, extractSummary.js) + + /* + Removing private content coming below the html paragraph `—private-below—
` + Only remove this if in public mode. So if this file is called as `site.ori("all")`, + then final output is `withSummary`, otherwise it's `privateRemoved`. + */ + privateRemoved: Tree.map(withSummary, removePrivate.js) + final: (all ? withSummary : privateRemoved ) + renderedPages: Tree.map(final, {value: (page) => { html: