summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-29 13:21:27 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-29 13:21:27 +0200
commitac8ed7851b9a90cea18134c99b34638efd9d52d9 (patch)
treea14305833fbdcf5f697208e84b822270c69ec46b
parentMajor cleanup. (diff)
downloadvimwiki-scripts-ac8ed7851b9a90cea18134c99b34638efd9d52d9.tar.gz
vimwiki-scripts-ac8ed7851b9a90cea18134c99b34638efd9d52d9.tar.xz
Minor bugfixes.
-rw-r--r--hs/Html.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/hs/Html.hs b/hs/Html.hs
index 48f598a..43040e4 100644
--- a/hs/Html.hs
+++ b/hs/Html.hs
@@ -75,9 +75,10 @@ import Vimwiki.Man
isWikiFile = isFiletype "wiki"
-- TODO
--- Colorful headers?
--- All headers should link to themselves
--- remove all fromJust, instead omit those elements
+-- - Colorful headers?
+-- - All headers should link to themselves
+-- - remove all fromJust, instead omit those elements
+-- - Tilde-expand paths from filenames
mailRewriter :: String -> [Inline] -> URI -> ([Inline], Text)
@@ -167,8 +168,8 @@ htmlWrap conf title parts backlinks toc main = docTypeHtml $ do
H.meta ! charset "utf-8"
H.meta ! name "generator" ! content "pandoc"
H.meta ! name "viewport" ! content "width=device-width, initial-scale=1.0, user-scalable=yes"
- H.link ! rel "stylesheet" ! (href . textValue $ (pack $ conf ^. output . webPath </> "style.css"))
- H.script ! (A.src . textValue $ (pack $ conf ^. output . webPath </> "script.js")) $ mempty
+ H.link ! rel "stylesheet" ! (href . textValue $ (pack $ conf ^. output . webPath <> "/style.css"))
+ H.script ! (A.src . textValue $ (pack $ conf ^. output . webPath <> "/script.js")) $ mempty
H.title $ H.string $ title <> " — Vimwiki"
H.body $ do
H.header $ do
@@ -252,6 +253,11 @@ _ .~? Nothing = id
lens .~? (Just x) = lens .~ x
infixr 4 .~?
+stripTrailing :: Eq a => a -> [a] -> [a]
+stripTrailing c s
+ | c == last s = init s
+ | otherwise = s
+
main = do
args <- parseCmdline
@@ -265,6 +271,7 @@ main = do
let conf = (conf' & data' . inputDir .~? indir args
& data' . outputDir .~? outdir args
& output . webPath .~? webp args
+ & output . webPath %~ stripTrailing '/'
)
-- indir' <- expandTilde `mapM` indir args