markdown2svg 0.0.1.11 → 0.0.1.12
raw patch · 4 files changed
+15/−8 lines, 4 files
Files
- markdown2svg.cabal +3/−3
- src/SVG.hs +8/−0
- src/SepWords.hs +3/−0
- src/markdown2svg.hs +1/−5
markdown2svg.cabal view
@@ -2,7 +2,7 @@ cabal-version: >=1.8 name: markdown2svg-version: 0.0.1.11+version: 0.0.1.12 stability: Experimental author: Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer: Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -17,7 +17,7 @@ . Now. Implemented only following features. .- paragraph, header, code, list+ paragraph, header, code, list, image . Not yet implemented following features. .@@ -31,7 +31,7 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/markdown2svg.git- tag: 0.0.1.11+ tag: 0.0.1.12 executable markdown2svg hs-source-dirs: src
src/SVG.hs view
@@ -110,6 +110,14 @@ "large" -> leftMargin r "small" -> ratio * 4 / 10 _ -> ratio * 1 / 3+textToSVGData fp r h (Link txt addrs ttl : ts)+ | h + normalSep r > bottomBorder r = [] : (l : svg') : svgs'+ | otherwise = (l : svg) : svgs+ where+ svg : svgs = textToSVGData fp r (h + normalSep r) ts+ svg' : svgs' = textToSVGData fp r (topMargin r) ts+ l = Text (TopLeft (paraLeftMargin r) (h + normalSep r)) (normal r) (ColorName "blue")+ normalFont $ txt ++ "(" ++ addrs ++ ")" splitAtString :: Int -> String -> (String, String) splitAtString len = sepStr 0
src/SepWords.hs view
@@ -10,6 +10,9 @@ splitWords_ :: Int -> Int -> String -> (String, String) splitWords_ _ _ "" = ("", "")+splitWords_ n k (c : c'@('、') : cs)+ | k > n = ([c, c'], cs)+ | otherwise = let (l, ls) = splitWords_ n (k + 4) cs in (c : c' : l, ls) splitWords_ n k (c : c'@('。') : cs) | k > n = ([c, c'], cs) | otherwise = let (l, ls) = splitWords_ n (k + 4) cs in (c : c' : l, ls)
src/markdown2svg.hs view
@@ -20,11 +20,7 @@ dir = getDir opts idir = getIDir opts cnt <- readFile fp- is <- case idir of- Just d -> do- fps <- getImageFilePath d- mapM pathCont fps- _ -> return []+ is <- mapM pathCont =<< getImageFilePath (fromMaybe "." idir) copy (fromMaybe "." idir) (fromMaybe "." dir) $ map (takeFileName . fst) is case parse cnt of Just t -> forM_ (zip [1 ..] $ textToSVG is True size t) $ \(i, s) ->