Personal tools

Literate programming/Bird conversion via sed

From HaskellWiki

Jump to: navigation, search
# bird2code.sed
/^>/ !p
/^>/ {
  i\
\\begin{code}

  :loop
  N
  /\n>[^\n]*$/{
    b loop
  }
  s/^> //
  s/\(\n\)> /\1/g
  s/\n$//
  a\
\\end{code}\

  p
}

should be run as:

sed -nf bird2code.sed < code.lhs > code.tex