packages feed

hyakko 0.5.0 → 0.5.1

raw patch · 2 files changed

+27/−9 lines, 2 files

Files

hyakko.cabal view
@@ -1,5 +1,5 @@ name:             hyakko-version:          0.5.0+version:          0.5.1 cabal-version:    >= 1.6 build-type:       Simple license:          MIT
src/Hyakko.lhs view
@@ -126,19 +126,28 @@ >                                   ] : [] >         sectionOff code docs (y:ys) = >           if T.unpack y =~ r then->             handleDocs+>             handleDocs code >             else >               sectionOff (code ++. y ++. "\n") docs ys->           where handleDocs =->                   if T.null code then->                     sectionOff code (newdocs docs) ys->                   else->                     [ ("codeText", code)->                     , ("docsText", docs)->                     ] : sectionOff "" (newdocs "") ys +>           where handleDocs "" = handleHeaders code (newdocs docs) ys+>                 handleDocs _  = [ ("codeText", code)+>                                 , ("docsText", docs)+>                                 ] : handleHeaders "" (newdocs "") ys+ >                 newdocs d = d ++. (replace r y "") ++. "\n" +If there is a header markup, only for `---` and `===`, it will get its own+line from the other documentation.++>                 handleHeaders c d zs =+>                   if T.unpack d =~ L.pack "^(---|===)+" then+>                     [ ("codeText", c)+>                     , ("docsText", d)+>                     ] : sectionOff "" "" zs+>                     else+>                       sectionOff c d zs+ > parse :: Maybe (Map String ByteString) -> Text -> [Map String Text] > parse Nothing _       = [] > parse (Just src) code =@@ -147,6 +156,10 @@ >   where line :: [Text] >         line = filter ((/=) "#!" . T.take 2) $ T.lines code +Transforms a literate style language file into its normal, non-literate+style language. If it is normal, `newlines` for returns the same list of+`Text` that was passed in.+ >         newlines :: [Text] -> Maybe ByteString -> Bool -> [Text] >         newlines [] _ _            = [] >         newlines xs Nothing _      = xs@@ -160,6 +173,11 @@ >                        insert (T.unpack x =~ r1) isText >                          ((T.pack $ L.unpack s)  ++. " " ++. x) >           in x': newlines xs lit y++Inserts a comment symbol and a single space into the documentation line and+check if the last line was code and documentation. If the previous line was+code and the line is blank or has just whitespace, it returns a blank `Text`+datatype; otherwise it will return just the comment symbol.  >           where insert :: Bool -> Bool -> Text -> (Text, Bool) >                 insert True True _  = (T.pack . L.unpack