Skip to content

Instantly share code, notes, and snippets.

@travisbrown
Created May 5, 2015 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travisbrown/42f28afbc0bc4c5ff28a to your computer and use it in GitHub Desktop.
Save travisbrown/42f28afbc0bc4c5ff28a to your computer and use it in GitHub Desktop.
import org.syzygist.split.Splitter.whenElt
import scalaz.stream._
val TitleLine = "^~~~ (.*)$".r
val docSplitter = whenElt[String](_.startsWith("~~~")).keepDelimsL.dropBlanks.split
val reformat = io.linesR("input.txt")
.pipe(docSplitter)
.map {
case TitleLine(title) +: body => s"$title: ${ body.mkString(" ") }"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment