Create a gist now

Instantly share code, notes, and snippets.

OPML to Markdown Transform
xquery version "3.0";
declare namespace nm = "http://dblfuzzr.com/opml2md/";
declare option saxon:output 'omit-xml-declaration=yes';
declare function nm:lvlText($x)
{
xs:string($x/@text)
};
declare function nm:dumpLevel($lvl)
{
for $x in $lvl/outline
return fn:concat("=! ",nm:lvlText($x)," !=","


", nm:dumpLevel("*",$x),"
")
};
declare function nm:dumpLevel($prefix,$lvl) as xs:string
{
fn:string-join(
for $x in $lvl/outline
return
("==== ", nm:lvlText($x) ,"====",
"
","
",
nm:dumpLevel($prefix," ",$x),
"
","
"
)
)
};
declare function nm:dumpLevel($prefix, $spc, $lvl) as xs:string
{
if (fn:empty($lvl/outline)) then ""
else
fn:string-join(
for $x in $lvl/outline
return fn:concat(
$prefix, $spc, nm:lvlText($x),"
",
nm:dumpLevel(fn:concat($prefix,"*"),fn:concat($spc," "),$x)
))
};
nm:dumpLevel(.//body)
@vladistan
Owner

I just needed a quick transform script to convert outlines generated by OmniOutliner to MarkDown slide deck. The markdown is specific to Wiki2Beamer flavour.

http://www.omnigroup.com/omnioutliner
https://github.com/vladistan/wiki2beamer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment