[pmwiki-users] Command line pretty-print PmWiki pages

Eemeli Aro eemeli at gmail.com
Thu Jul 30 02:53:10 CDT 2009


In case this might be of use to anyone, I use the following sed
scripts for pretty-printing PmWiki pages to the command line (defined
in ~/.bashrc):

alias pmf="sed 's/^text=/text=\n/;s/%0a/\n/g;s/%3c/</g;s/%25/%/g'"
alias pmp="sed '
  /^text=/ {h;d}
  s/^[^=]\+:.*//
  $ {
    G
    s/\ntext=/\n/
    s/%0a/\n/g
    s/%3c/</g
    s/%25/%/g
  }
  /^$/ d
  :A
    s/^[^=]\{1,9\}=/ &/
  tA
  s/^\([^=]\+\)=/\1 | /
'"

"pmf Group.PageName" will print all of the fields of the page, but
with the urlencoded newlines, < and % characters translated to their
proper values.

"pmf Group.PageName" will reformat the printout to ignore diffs and
other non-current data, print the header fields first and a bit more
clearly formatted, followed by the text with the decoded characters.

There may well be a more elegant way of doing this, but at least the
above works for me. Anyone else have command line scripts that they
use with PmWiki?

eemeli



More information about the pmwiki-users mailing list