lima 0.1.0.4 → 0.1.0.5
raw patch · 3 files changed
+7/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +1/−2
- lima.cabal +1/−1
- src/Converter.hs +5/−4
README.md view
@@ -26,8 +26,7 @@ - Multiline comments (even `{- -}`) split `Haskell` code into snippets - Special comments like `{- FOURMOLU_ENABLE -}` won't appear in a `.md`. You can supply other comments in a config (`hs-md.special-comments`). See the sample [config](./testdata/config/). - You can ignore parts of a `.hs` file by enclosing them into `{- LIMA_DISABLE -}` and `{- LIMA_ENABLE -}`. The lines between such comments will be commented out in the resulting `.md`.-- You can indent a Haskell snippet by writing a magic comment `{- LIMA_INDENT N -}`, where `N` is an integer denoting the new indentation level. Reset the indentation by writing `{- LIMA_DEDENT -}`.- - If your snippet relates to some text, put the magic comment before that text+- You can indent a Haskell snippet by writing before it a magic comment `{- LIMA_INDENT N -}`, where `N` is an integer denoting the new indentation level. Reset the indentation by writing `{- LIMA_DEDENT -}`. ### lhs <-> md
lima.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: lima-version: 0.1.0.4+version: 0.1.0.5 synopsis: (Haskell or Literate Haskell) <-> Markdown converter description: See the [README.md](https://github.com/deemp/flakes/tree/main/lima#readme) category: Productivity
src/Converter.hs view
@@ -237,8 +237,9 @@ let h_ = stripMC h isIndent = h_ `startsWith` _LIMA_INDENT newIndent_ = if isIndent then indent_ + (read @Int $ drop (length _LIMA_INDENT) h_) else 0+ curIndent_ = if isIndent then newIndent_ else indent_ in (convert inLimaEnable False False newIndent_ hs)- ( [mdcOpenSpace ++ stripMC h ++ mdcCloseSpace]+ ( [indentN curIndent_ $ mdcOpenSpace ++ stripMC h ++ mdcCloseSpace] ++ ["" | inSnippet] ++ [backticks_ indent_ | inSnippet] ++ (if isIndent then squashEmpties else dropEmpties) res@@ -281,7 +282,7 @@ [backticks_ indent_ | inSnippet] ++ dropEmpties res stripMdc :: String -> String-stripMdc x = dropEnd (length mdcCloseSpace) (drop (length mdcOpenSpace) x)+stripMdc x = dropEnd (length mdcCloseSpace) (drop (length mdcOpenSpace) (dropSpaces x)) squashEmpties :: [String] -> [String] squashEmpties = ([""] ++) . dropEmpties@@ -313,12 +314,12 @@ convert False False True dedent_ hs (h : res) | not inSnippet = if- | -- found comments+ | -- found a disable comment h `startsWith` (mdcOpenSpace ++ _LIMA_DISABLE) -> (convert False False True dedent_ hs) ([mcOpenSpace ++ _LIMA_DISABLE ++ mcCloseSpace, ""] ++ closeTextIf inText ++ res) | -- found a special comment- h `startsWithAnyOf` ((mdcOpenSpace ++) <$> specialComments_) ->+ (dropSpaces h) `startsWithAnyOf` ((mdcOpenSpace ++) <$> specialComments_) -> (convert False False False dedent_ hs) ([mcOpenSpace ++ stripMdc h ++ mcCloseSpace] ++ [""] ++ closeTextIf inText ++ dropEmpties res) | -- start of a haskell snippet