/* This 'pipeline' is separate from final site.ori, 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 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: - 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! 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. 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, ./html-manipulations/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, ./html-manipulations/removePrivate.js) final: (all ? withSummary : privateRemoved ) renderedPages: Tree.map(final, {value: (page) => { html: (page, all) ...page }}) /* Then, we can use that html and the trls property to add the translations. */ //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, ./translations/pagesInFoldersWithTranslations.js) linksByFile: Tree.map(Tree.map(renderedPages, (a) => a/html), ./linked-files/getLinkedFilesFromHtml.js) uniqueLinks: Tree.flat(linksByFile) → (a) => [...new Set(a)] linksAsTree: ./linked-files/pathsToObjs.js(uniqueLinks) onlyLinkedFiles: Tree.mask(list, linksAsTree) index.html: ori-templates/indexPage.ori(final, all) ...onlyLinkedFiles }