Bookshelf 0.1.6 → 0.2
raw patch · 7 files changed
+23/−24 lines, 7 filesdep ~pandocdep ~pandoc-types
Dependency ranges changed: pandoc, pandoc-types
Files
- Bookshelf.cabal +2/−2
- Bookshelf.hs +3/−4
- Documentation/Manual.shelf +1/−1
- Documentation/Test/Document2.shelf +2/−2
- Generate.hs +12/−14
- Types.hs +1/−1
- bookshelf.css +2/−0
Bookshelf.cabal view
@@ -1,5 +1,5 @@ name: Bookshelf-version: 0.1.6+version: 0.2 synopsis: A simple document organizer with some wiki functionality description: A simple document organizer with some wiki functionality category: Text@@ -27,6 +27,6 @@ location: http://projects.haskell.org/Bookshelf/ executable bookshelf- build-depends: base < 5, filepath, directory, parseargs, pandoc >= 1.8, pandoc-types >= 1.8+ build-depends: base < 5, filepath, directory, parseargs, pandoc >= 1.10, pandoc-types >= 1.10 main-is: Bookshelf.hs
Bookshelf.hs view
@@ -39,8 +39,7 @@ --- | Move down to the given directory (affects `relPath_` and `cssLink_` in--- `Context`).+-- | Move down to the given directory (affects paths in `Context`). moveDown :: Context -> FilePath -> Context moveDown context dir = context { relPath_ = relPath context </> dir@@ -174,7 +173,7 @@ , argName = Just "css" , argAbbr = Just 'c' , argData = argDataOptional "CSS file" ArgtypeString- , argDesc = "Path or URL to CSS style sheet"+ , argDesc = "Path to CSS style sheet" } , Arg { argIndex = "Editor"@@ -188,7 +187,7 @@ , argName = Just "mathjax" , argAbbr = Just 'm' , argData = argDataOptional "MathJax.js file" ArgtypeString- , argDesc = "Path or URL to MathJax.js file"+ , argDesc = "Path to MathJax.js file" } , Arg { argIndex = "NoScript"
Documentation/Manual.shelf view
@@ -79,7 +79,7 @@ * Keyword 2 * etc. -This information will then be used when listing the ordinary document.+(The "Meta" header is also allowed to be a lower-level header.) This information will then be used when listing the ordinary document. Demonstration =============
Documentation/Test/Document2.shelf view
@@ -1,5 +1,5 @@ Meta-====+---- * Title: Document title * Authors:@@ -9,6 +9,6 @@ * Comment: This is a dummy document. Notes-=====+----- There could be some more notes here.
Generate.hs view
@@ -214,6 +214,7 @@ -- > ... -- > ... --+-- (The header can also be a lower-level header.) -- If the document doesn't have the above form, some or all of the returned -- fields may be empty. However, the function does some attempt to handle -- partial specifications. In particular, the fields are matched from the top,@@ -222,8 +223,8 @@ parseMainMeta (Pandoc _ blocks) = MetaInfo title authors date comment keywords where metaBullets = case blocks of- Header 1 [Str "Meta"] : BulletList bulls : _ -> bulls- _ -> []+ Header _ _ [Str "Meta"] : BulletList bulls : _ -> bulls+ _ -> [] bsTit : bsAuth : bsDate : bsComm : bsKeyw : _ = metaBullets ++ repeat [] @@ -285,7 +286,7 @@ ++ makeMainLink shelfInfo ++ [RawBlock "html" "</div>"] - before = writeHtmlString defaultWriterOptions (Pandoc (Meta [] [] []) contextBlocks)+ before = writeHtmlString def (Pandoc (Meta [] [] []) contextBlocks) html = writeHtmlString wOpts@@ -296,8 +297,8 @@ Nothing -> thisMeta _ -> mainMeta - rOpts = defaultParserState- { stateSmart = True+ rOpts = def+ { readerSmart = True } after = editRegenerate shelfInfo ++ bookshelfCreds@@ -309,7 +310,7 @@ , ("include-before", before) ] ++ cssInclude - wOpts = defaultWriterOptions+ wOpts = def { writerStandalone = True , writerTemplate = htmlTemplate $ shelfContext shelfInfo , writerVariables = wVars@@ -379,7 +380,7 @@ , RawBlock "html" "</div>" ] - before = writeHtmlString defaultWriterOptions (Pandoc (Meta [] [] []) contextBlocks)+ before = writeHtmlString def (Pandoc (Meta [] [] []) contextBlocks) after = bookshelfCreds @@ -388,7 +389,7 @@ , ("include-after", after) ] ++ makeCss context - wOpts = defaultWriterOptions+ wOpts = def { writerStandalone = True , writerTemplate = htmlTemplate context , writerVariables = wVars@@ -396,14 +397,11 @@ , writerHTMLMathMethod = makeMath context } - pandoc = Pandoc meta (docBlocks ++ dirBlocks)- where- dir = last $ splitDirectories $ relPath context- meta = Meta (pandocStr dir) [] []+ pandoc = Pandoc (Meta [] [] []) ([Para [LineBreak]] ++ docBlocks ++ dirBlocks) docBlocks = do guard (0 < length shelfs + length infos + length ords)- [ Header 2 [Str "Documents"]+ [ Header 2 nullAttr [Str "Documents"] , BulletList shelfBlocks , BulletList infoBlocks , BulletList ordBlocks@@ -415,7 +413,7 @@ dirBlocks = do guard (not $ null dirs)- [Header 2 [Str "Directories"]] ++ [BulletList $ map listDir $ sort dirs]+ [Header 2 nullAttr [Str "Directories"]] ++ [BulletList $ map listDir $ sort dirs] listShelfDoc (doc,meta) = listDocument docShelfHtml meta' doc' [] where
Types.hs view
@@ -42,7 +42,7 @@ htmlTemplate :: String -- | Optional link to CSS file , cssLink_ :: Maybe FilePath- -- [ Optional link to MathJax.js file+ -- | Optional link to MathJax.js file , mathjaxLink_ :: Maybe FilePath -- | Optional editor command , editor_ :: Maybe String
bookshelf.css view
@@ -24,11 +24,13 @@ background-color: #ececec; color: #1111111; padding: 0.5em;+ white-space: pre-wrap; } code { font-family: monospace; font-size: 115%;+ white-space: pre-wrap; } h1 a {