aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/ICML.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-11-08 15:07:05 +0100
committerJohn MacFarlane <[email protected]>2025-11-08 15:07:05 +0100
commitd13b0bfe8aaf024edbff8525aa3cb2fdb451b429 (patch)
tree362fbf6b980c5c4e3d5b44a8442e97df32b324d0 /src/Text/Pandoc/Writers/ICML.hs
parentf1152c18111889a1ddd376420a717ad9f9b484b0 (diff)
ICML writer: base FirstParagraph styles on corresponding...issue_11268
Paragraph styles. This should ensure that existing documents still work with the FirstParagraph style, without the need to define new styles.
Diffstat (limited to 'src/Text/Pandoc/Writers/ICML.hs')
-rw-r--r--src/Text/Pandoc/Writers/ICML.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
index d5a52ec90..58d48a5e3 100644
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -37,6 +37,7 @@ import Text.Pandoc.Templates (renderTemplate)
import Text.Pandoc.Writers.Math (texMathToInlines)
import Text.Pandoc.Writers.Shared
import Text.Pandoc.XML
+import qualified Data.Text as T
type Style = [Text]
type Hyperlink = [(Int, Text)]
@@ -238,7 +239,11 @@ parStylesToDoc st = vcat $ map makeStyle $ Set.toAscList $ blockStyles st
font = if codeBlockName `Text.isInfixOf` s
then monospacedFont
else empty
- basedOn = inTags False "BasedOn" [("type", "object")] (text "$ID/NormalParagraphStyle") $$ font
+ baseStyle = if firstParagraphName `T.isSuffixOf` s
+ then T.replace firstParagraphName paragraphName s
+ else "$ID/NormalParagraphStyle"
+ basedOn = inTags False "BasedOn" [("type", "object")]
+ (literal baseStyle) $$ font
tabList = if isBulletList
then inTags True "TabList" [("type","list")] $ inTags True "ListItem" [("type","record")]
$ vcat [