This commit is contained in:
Hans Fast 2026-03-25 09:23:03 +01:00
parent 3ecf3e9959
commit 7d5a0dbe50
2 changed files with 9 additions and 10 deletions

View File

@ -26,7 +26,7 @@
(list): .. (list): ..
allfiles: Tree.filter(list, (val, key) => key.endsWith('.md') && !key.startsWith('_')) 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! 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))}) withfilenamedata: Tree.map(documents, { value: (value, key) => ./filenamedata/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. //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')) pubfiles: Tree.filter(withfilenamedata, (val, key) => val.fnd.tags?.includes('pub'))
@ -45,18 +45,18 @@
and ends up in a separate field of the document. and ends up in a separate field of the document.
So we dont have to worry about the title being part of the summary. So we dont have to worry about the title being part of the summary.
*/ */
withSummary: Tree.map(asHtml, extractSummary.js) withSummary: Tree.map(asHtml, ./html-manipulations/extractSummary.js)
/* /*
Removing private content coming below the html paragraph `<p>—private-below—</p>` Removing private content coming below the html paragraph `<p>—private-below—</p>`
Only remove this if in public mode. So if this file is called as `site.ori("all")`, 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`. then final output is `withSummary`, otherwise it's `privateRemoved`.
*/ */
privateRemoved: Tree.map(withSummary, removePrivate.js) privateRemoved: Tree.map(withSummary, ./html-manipulations/removePrivate.js)
final: (all ? withSummary : privateRemoved ) final: (all ? withSummary : privateRemoved )
renderedPages: Tree.map(final, {value: (page) => { renderedPages: Tree.map(final, {value: (page) => {
html: <page.ori>(page, all) html: <ori-templates/page.ori>(page, all)
...page ...page
}}) }})
/* /*
@ -64,14 +64,14 @@
*/ */
//NOTE! two steps at once. Could separate the withTranslations part: add a html_LANG property to the document object, then later create the folder structure. //NOTE! two steps at once. Could separate the withTranslations part: add a html_LANG property to the document object, then later create the folder structure.
pagesInFolders: Tree.map(renderedPages, pagesInFoldersWithTranslations.js) pagesInFolders: Tree.map(renderedPages, ./translations/pagesInFoldersWithTranslations.js)
linksByFile: Tree.map(Tree.map(renderedPages, (a) => a/html), getLinkedFilesFromHtml.js) linksByFile: Tree.map(Tree.map(renderedPages, (a) => a/html), ./linked-files/getLinkedFilesFromHtml.js)
uniqueLinks: Tree.flat(linksByFile) → (a) => [...new Set(a)] uniqueLinks: Tree.flat(linksByFile) → (a) => [...new Set(a)]
linksAsTree: pathsToObjs.js(uniqueLinks) linksAsTree: ./linked-files/pathsToObjs.js(uniqueLinks)
onlyLinkedFiles: Tree.mask(list, linksAsTree) onlyLinkedFiles: Tree.mask(list, linksAsTree)
index.html: indexPage.ori(final, all) index.html: ori-templates/indexPage.ori(final, all)
...onlyLinkedFiles ...onlyLinkedFiles
} }

View File

@ -28,7 +28,6 @@ export default async (page) => {
//this is going to create a folder for each 'translation' specified in frontmatter. //this is going to create a folder for each 'translation' specified in frontmatter.
function handleTranslations(html, trls) { function handleTranslations(html, trls) {
if (trls) { if (trls) {
console.log(trls);
const outputs = {}; const outputs = {};
trls.forEach(trl => { trls.forEach(trl => {
outputs[trl] = { outputs[trl] = {
@ -41,7 +40,7 @@ function handleTranslations(html, trls) {
} }
} }
//"reorders" all `trl-group`s so the element with given lang is displayed. //modifies all `trl-group`s so the element with given lang is displayed.
//EN is default language ... //EN is default language ...
//also adds a (hidden by css) trl-selector at the top of `body`. //also adds a (hidden by css) trl-selector at the top of `body`.
//TODO: add a link to translated pages ... //TODO: add a link to translated pages ...