This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick hack of regular expressions to convert twitter bootstrap from LESS to Stylus | |
less2stylus = (string) -> | |
string = string | |
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets | |
.replace(/^(\ *)([^\ ]+)\ +\{\ *\n?\ *?/mg, "$1$2\n$1 ") # remove opening brackets | |
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through) | |
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets | |
.replace(/\;\ *?$/gm, "") # remove semicolons | |
.replace(/@(\w+):(\ *)\ /g, "\$$1$2 = ") # replace @variable: with $variable = | |
.replace(/\@/g, "\$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jade where | |
import Text.Parsec | |
import qualified Text.Parsec.Token as L | |
import Text.Parsec.Language (emptyDef) | |
import Text.Parsec.Text (Parser) | |
import Data.Text (Text) | |
import Control.Monad (mzero) | |
import Control.Applicative ((<$>)) | |
import Data.Maybe (isJust, fromMaybe) |