3 ms·
I am using pandocomatic¹ to generate my website. It uses pandoc² to convert all kinds of input files to HTML output and pandocomatic is controlling that convers
by ht_th 9y ago
I am using pandocomatic¹ to generate my website. It uses pandoc² to convert all kinds of input files to HTML output and pandocomatic is controlling that conversion. Applying it to a directory it converts, copies, or skip everything recursively given a flexible templating system. In the end, it gives me total control over the output and I have started using it for all my websites.
¹ Manual: https://heerdebeer.org/Software/markdown/pandocomatic/ https://heerdebeer.org/Software/markdown/pandocomatic/
² https://pandoc.org/ https://pandoc.org/
- freosam 9y agoThe thing I've never figured out with my Pandoc-generated static sites is how to generate RSS feeds from Markdown frontmatter metadata.
- ht_th 9y agoFor these type of task, pandocomatic supports preprocessors, postprocessors, filters, setup scripts, and cleanup scripts in its templates. For your specific issue, and this is a general pandoc solution, filters with side effects could work. For example, you can write a filter that would extract and inspect the metadata and writes it to to an RSS XML file. In Paru¹, the Ruby wrapper and interface to pandoc, a very naive solution could look like: #!/usr/bin/env ruby require "paru/filter" require "rss" RSS_FILE = "my-rss-file.rss" title = "No title" date = Time.now.to_s # Collect metadata information while filtering a document with pandoc Paru::Filter.run do title = metadata["title"] if metadata.has_key? "title" date = metadata["date"] if metadata.has_key? "date" end # Create new Atom item new = RSS::Maker.make("atom") do |maker| maker.channel.author = maker.channel.about = maker.channel.title = "" maker.channel.updated = Time.now.to_s maker.items.new_item do |item| item.title = title item.updated = date item.link = "Some link" end end # Add new item to existing Atom RSS feed rss = RSS::Parser.parse(File.read(RSS_FILE), false) rss.items.concat new.items File.write(RSS_FILE, rss) (My apologies for the bad code, this is my first attempt at working with RSS/Atom) ¹ https://heerdebeer.org/Software/markdown/paru/#writing-and-using-pandoc-filters-with-paru https://heerdebeer.org/Software/markdown/paru/#writing-and-u...