diff --git a/_site.ori b/_site.ori new file mode 100644 index 0000000..05f533c --- /dev/null +++ b/_site.ori @@ -0,0 +1,49 @@ +(all) => { + //put the file selection part in a closure, so that the list of all files is kept private. + pages: { + /* + 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. + */ + // allfiles: allfiles.sh() //reads MD files. + // pubfiles: pubfiles.sh(allfiles) + (list): .. + allfiles: Tree.filter(list, (val, key) => key.endsWith('.md') && !key.startsWith('_')) + pubfiles: Tree.filter(allfiles, (val, key) => key.includes('_pub')) + files: Tree.map( all ? allfiles : pubfiles, {value: (val) => Origami.document(val)}) + asHtml: Tree.map(files, (value) => Origami.mdHtml(value)) + → (values) => Tree.mapExtension(values, '.md→.html') + + /* + 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 comment `` + 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) + + }.final + + renderedPages: Tree.map(pages, page.ori) + + /* + assets are relative to the pubfiles directory + */ + css + + /* + Now, I think I have enough to build both the individual pages and the index page! + */ + index.html: indexPage.ori(pages) + ...renderedPages/ +} diff --git a/site.ori b/site.ori index 05f533c..a2eff33 100644 --- a/site.ori +++ b/site.ori @@ -1,49 +1,14 @@ (all) => { - //put the file selection part in a closure, so that the list of all files is kept private. - pages: { - /* - 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. - */ - // allfiles: allfiles.sh() //reads MD files. - // pubfiles: pubfiles.sh(allfiles) - (list): .. - allfiles: Tree.filter(list, (val, key) => key.endsWith('.md') && !key.startsWith('_')) - pubfiles: Tree.filter(allfiles, (val, key) => key.includes('_pub')) - files: Tree.map( all ? allfiles : pubfiles, {value: (val) => Origami.document(val)}) - asHtml: Tree.map(files, (value) => Origami.mdHtml(value)) - → (values) => Tree.mapExtension(values, '.md→.html') - /* - 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. + list is all the files in current directory. + allfiles: ending with `.md` and not starting with `_`. + pubfiles: the subset containing the string `_pub`. + files selects either of these depending on the argument passed to this file. */ - withSummary: Tree.map(asHtml, extractSummary.js) + (list): .. + allfiles: Tree.filter(list, + (val, key) => key.endsWith('.md') && !key.startsWith('_')) + pubfiles: Tree.filter(allfiles, + (val, key) => key.includes('_pub')) - /* - Removing private content coming below the html comment `` - 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) - - }.final - - renderedPages: Tree.map(pages, page.ori) - - /* - assets are relative to the pubfiles directory - */ - css - - /* - Now, I think I have enough to build both the individual pages and the index page! - */ - index.html: indexPage.ori(pages) - ...renderedPages/ }