diff options
| author | Albert Krewinkel <[email protected]> | 2023-03-13 17:26:56 +0100 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2023-03-13 17:31:12 +0100 |
| commit | 51750d6d9aa03c295a050db3c96a51ea27727c5e (patch) | |
| tree | 06819bd9e05a02488f6be9559cdb35ecdce3ab0a /src | |
| parent | 39eb4145baa96909053fc2b9751ca3041d9efe53 (diff) | |
Jira reader: add panel title as nested div
The title of a jira panel is added in a nested div as the first element
of the div panel.
Fixes: #8681
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/Jira.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Jira.hs b/src/Text/Pandoc/Readers/Jira.hs index 4eb637895..7a58c7643 100644 --- a/src/Text/Pandoc/Readers/Jira.hs +++ b/src/Text/Pandoc/Readers/Jira.hs @@ -12,6 +12,7 @@ Conversion of jira wiki formatted plain text to 'Pandoc' document. module Text.Pandoc.Readers.Jira ( readJira ) where import Control.Monad.Except (throwError) +import Data.List (partition) import Data.Text (Text, append, pack, singleton) import Text.Pandoc.XML (lookupEntity) import Text.Jira.Parser (parse) @@ -76,7 +77,16 @@ toPandocCodeBlocks langMay params txt = -- | Create a pandoc @'Div'@ from a panel. toPandocDiv :: [Jira.Parameter] -> [Jira.Block] -> Blocks toPandocDiv params = - divWith ("", ["panel"], map paramToPair params) . foldMap jiraToPandocBlocks + let (titles, params') = partition ((== "title") . Jira.parameterKey) params + addTitle = case titles of + [] -> + id + (title:_) -> \blks -> + (divWith ("", ["panelheader"], []) . plain . strong $ + text (Jira.parameterValue title)) <> blks + in divWith ("", ["panel"], map paramToPair params') + . addTitle + . foldMap jiraToPandocBlocks paramToPair :: Jira.Parameter -> (Text, Text) paramToPair (Jira.Parameter key value) = (key, value) |
