Skip to content

Instantly share code, notes, and snippets.

@boydkelly
Last active December 31, 2020 11:51
Show Gist options
  • Save boydkelly/9ecb5b45ea5a7d778ef2eec34fa841cd to your computer and use it in GitHub Desktop.
Save boydkelly/9ecb5b45ea5a7d778ef2eec34fa841cd to your computer and use it in GitHub Desktop.
export gnote or tomboy files to asciidoc
#!/usr/bin/bash
ext=.g.adoc
for x in `ls *.note`; do
changedate=`xml_grep last-change-date "$x" --text`
out=`date -d $changedate +%Y-%m-%d`-
out=$out-`xml_grep title "$x" --text|sed 's/ /_/g' | tr '[:upper:]' '[:lower:]'`"${ext}"
xml_grep title "$x" --text > $out
xml_grep text "$x" --text >> $out
sed -i '1 s/^/= /' $out
sed -i "2 i :date: $changedate" "$out"
sed -i '2 a #;' "$out" && sed -i 's/^#;//g' "$out"
done
#!/usr/bin/bash
ext=.t.adoc
for x in `ls *.note`; do
changedate=`xml_grep last-change-date "$x" --text`
out=`date -d $changedate +%Y-%m-%d`-
out=$out-`xml_grep title "$x" --text|sed 's/ /_/g' | tr '[:upper:]' '[:lower:]'`${ext}
xml_grep note-content "$x" --text > $out
sed -i '1 s/^/= /' $out
sed -i "2 i :date: $changedate" $out
done
@boydkelly
Copy link
Author

requires perl xml twig package available on all main distros. .note files are slightly different between gnote and tomboy.

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