kristapsdz / sblg

static blog utility
https://kristaps.bsd.lv/sblg
ISC License
94 stars 14 forks source link

Add data-sbgl-navxml to generate XML files without HTML tags. #5

Closed reyk closed 7 years ago

reyk commented 7 years ago

What about adding the possibility to generate basically any XML with sblg?

This experimental feature allows to generate a sitemap.xml using the nav tag. It parses the Tag Symbols and works like a nav, but skips printing the actual nav, ul, and li elements. It could eventually also be used for custom non-Atom feeds using a template.

sblg -t templates/sitemap.xml $(ARTICLES)

The output of this mode could be better, the generated indentation and whitespace of this diff is wrong but the result just works fine. Maybe you have better ideas? See https://reykfloeter.com/sitemap.xml (output) and https://reykfloeter.com/templates/sitemap.xml (input) as an example.

btw., I tried to match your C style - which is not strictly style(9) but maybe it is KNF (kristaps normal form) ;-)

kristapsdz commented 7 years ago

Done, thanks! My "KNF" isn't that different except that I always surround the bang with whitespace (e.g., "if ( ! foo)" instead of "if (!foo)") and switch around literal or null equality checks to prevent assignment.

reyk commented 7 years ago

Ah, now it all makes sense :) Thanks!