[Assorted-commits] SF.net SVN: assorted: [629] shell-tools/trunk
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-03-16 22:07:35
|
Revision: 629 http://assorted.svn.sourceforge.net/assorted/?rev=629&view=rev Author: yangzhang Date: 2008-03-16 15:07:36 -0700 (Sun, 16 Mar 2008) Log Message: ----------- added bullets.hs Modified Paths: -------------- shell-tools/trunk/README Added Paths: ----------- shell-tools/trunk/src/bullets.hs Modified: shell-tools/trunk/README =================================================================== --- shell-tools/trunk/README 2008-03-16 21:53:15 UTC (rev 628) +++ shell-tools/trunk/README 2008-03-16 22:07:36 UTC (rev 629) @@ -45,6 +45,9 @@ -------------- ----------------------------------------------- --------------- `ascii-colors` Demo terminal color escape sequences. bash +`bullets` Converts Markdown-style bulleted lists to Some Haskell + MediaWiki-style bulleted lists. implementation + `cleanup` Remove intermediate build files and other gunk Some Haskell from a directory tree. implementation, [HSH] Added: shell-tools/trunk/src/bullets.hs =================================================================== --- shell-tools/trunk/src/bullets.hs (rev 0) +++ shell-tools/trunk/src/bullets.hs 2008-03-16 22:07:36 UTC (rev 629) @@ -0,0 +1,18 @@ +#!/usr/bin/env runhaskell + +module Main where + +import Control.Arrow +import Data.List + +proc line = + let (indent, rest) = span (== ' ') line + nindent = 1 + (length indent `div` 2) + isBullet = "- " `isPrefixOf` rest + content = drop 2 rest + output = if isBullet + then replicate nindent '*' ++ " " ++ content + else line + in output + +main = interact $ lines >>> map proc >>> unlines Property changes on: shell-tools/trunk/src/bullets.hs ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |