org-mode-lucid 1.3.0 → 1.4.0
raw patch · 3 files changed
+41/−14 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.Org.Lucid: [hrBetweenSections] :: OrgStyle -> Bool
+ Data.Org.Lucid: [sectionStyling] :: OrgStyle -> SectionStyling
+ Data.Org.Lucid: type SectionStyling = Int -> Html () -> Html () -> Html ()
- Data.Org.Lucid: OrgStyle :: Bool -> Maybe TOC -> Bool -> Highlighting -> Maybe Char -> Bool -> OrgStyle
+ Data.Org.Lucid: OrgStyle :: Bool -> Maybe TOC -> Bool -> Highlighting -> SectionStyling -> Maybe Char -> OrgStyle
Files
- CHANGELOG.md +20/−0
- lib/Data/Org/Lucid.hs +20/−13
- org-mode-lucid.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,25 @@ # Changelog +## 1.4.0 (2020-07-13)++#### Added++- Headers and their contents can now be tweaked on the caller's end with the new+ `OrgStyle` field `sectionStyling`.++#### Removed++- The `hrBetweenSections` function has been removed. The same effect can be+ achieved with a custom `SectionStyling`:++```haskell+section :: O.SectionStyling+section depth h b = do+ h+ b+ when (depth == 1) $ hr_ []+```+ ## 1.3.0 (2020-03-24) #### Changed
lib/Data/Org/Lucid.hs view
@@ -21,6 +21,7 @@ , defaultStyle , TOC(..) , Highlighting+ , SectionStyling , codeHTML ) where @@ -40,22 +41,21 @@ -- | Rendering options. data OrgStyle = OrgStyle- { includeTitle :: Bool+ { includeTitle :: Bool -- ^ Whether to include the @#+TITLE: ...@ value as an @<h1>@ tag at the top -- of the document.- , tableOfContents :: Maybe TOC+ , tableOfContents :: Maybe TOC -- ^ Optionally include a Table of Contents after the title. The displayed -- depth is configurable.- , bootstrap :: Bool+ , bootstrap :: Bool -- ^ Whether to add Twitter Bootstrap classes to certain elements.- , highlighting :: Highlighting+ , highlighting :: Highlighting -- ^ A function to give @\<code\>@ blocks syntax highlighting.- , separator :: Maybe Char+ , sectionStyling :: SectionStyling+ , separator :: Maybe Char -- ^ `Char` to insert between elements during rendering, for example having -- a space between words. Asian languages, for instance, might want this to -- be `Nothing`.- , hrBetweenSections :: Bool- -- ^ Whether to insert an @\<hr\>@ element between top-level sections. } -- | Options for rendering a Table of Contents in the document.@@ -69,6 +69,10 @@ -- | A function to give @\<code\>@ blocks syntax highlighting. type Highlighting = Maybe Language -> T.Text -> Html () +-- | A post-processing function to apply to a `Section` to give it extra+-- formatting. The `Int` is the header depth.+type SectionStyling = Int -> Html () -> Html () -> Html ()+ -- | Include the title and 3-level TOC named @Table of Contents@, don't include -- Twitter Bootstrap classes, use no custom syntax highlighting, separate words -- with a whitespace character, and don't insert an @\<hr\>@ between major@@ -80,8 +84,8 @@ , tableOfContents = Just $ TOC "Table of Contents" 3 , bootstrap = False , highlighting = codeHTML- , separator = Just ' '- , hrBetweenSections = False }+ , sectionStyling = \_ a b -> a >> b+ , separator = Just ' ' } -- | Convert a parsed `OrgFile` into a full HTML document readable in a browser. html :: OrgStyle -> OrgFile -> Html ()@@ -127,11 +131,14 @@ traverse_ (sectionHTML os depth) ss sectionHTML :: OrgStyle -> Int -> Section -> Html ()-sectionHTML os depth (Section ws _ od) = do- heading [id_ $ tocLabel ws] $ paragraphHTML os ws- orgHTML' os (succ depth) od- when (hrBetweenSections os && depth == 1) $ hr_ []+sectionHTML os depth (Section ws _ od) = sectionStyling os depth theHead theBody where+ theHead :: Html ()+ theHead = heading [id_ $ tocLabel ws] $ paragraphHTML os ws++ theBody :: Html ()+ theBody = orgHTML' os (succ depth) od+ heading :: [Attribute] -> Html () -> Html () heading as h = case depth of 1 -> h2_ as h
org-mode-lucid.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: org-mode-lucid-version: 1.3.0+version: 1.4.0 synopsis: Lucid integration for org-mode. description: Lucid integration for org-mode. category: Web