mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-31 02:04:53 +08:00
ICML writer: base FirstParagraph styles on corresponding...
Paragraph styles. This should ensure that existing documents still work with the FirstParagraph style, without the need to define new styles.
This commit is contained in:
@@ -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 [
|
||||
|
||||
@@ -42,7 +42,7 @@ if you can read this text, [and it's linked]{#spanner} - all good!
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/FirstParagraph" Name="FirstParagraph" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Header1" Name="Header1" LeftIndent="0" PointSize="36">
|
||||
|
||||
@@ -38,7 +38,7 @@ some more text that [links to](https://www.pandoc.org) Pandoc.
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/FirstParagraph" Name="FirstParagraph" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Header1" Name="Header1" LeftIndent="0" PointSize="36">
|
||||
|
||||
@@ -40,7 +40,7 @@ and some text that [links to](#header-1) the first header
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/FirstParagraph" Name="FirstParagraph" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Header1" Name="Header1" LeftIndent="0" PointSize="36">
|
||||
|
||||
+8
-8
@@ -87,7 +87,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Blockquote > Blockquote > FirstParagraph" Name="Blockquote > Blockquote > FirstParagraph" LeftIndent="30">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Blockquote > Blockquote > Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Blockquote > Blockquote > Paragraph" Name="Blockquote > Blockquote > Paragraph" LeftIndent="30">
|
||||
@@ -103,7 +103,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Blockquote > FirstParagraph" Name="Blockquote > FirstParagraph" LeftIndent="10">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Blockquote > Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Blockquote > NumList" Name="Blockquote > NumList" NumberingExpression="^#.^t" NumberingLevel="1" BulletsAndNumberingListType="NumberedList" LeftIndent="20">
|
||||
@@ -214,7 +214,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/BulList > first > FirstParagraph" Name="BulList > first > FirstParagraph" BulletsAndNumberingListType="BulletList" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">BulList > first > Paragraph</BasedOn>
|
||||
<TabList type="list">
|
||||
<ListItem type="record">
|
||||
<Alignment type="enumeration">LeftAlign</Alignment>
|
||||
@@ -256,7 +256,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/DefListDef > Blockquote > FirstParagraph" Name="DefListDef > Blockquote > FirstParagraph" LeftIndent="30">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">DefListDef > Blockquote > Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/DefListDef > CodeBlock" Name="DefListDef > CodeBlock" LeftIndent="10">
|
||||
@@ -292,7 +292,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/FirstParagraph" Name="FirstParagraph" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Footnote > CodeBlock" Name="Footnote > CodeBlock" LeftIndent="0">
|
||||
@@ -303,7 +303,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Footnote > FirstParagraph" Name="Footnote > FirstParagraph" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">Footnote > Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/Footnote > Paragraph" Name="Footnote > Paragraph" LeftIndent="0">
|
||||
@@ -369,7 +369,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/NumList > FirstParagraph" Name="NumList > FirstParagraph" NumberingExpression="^#.^t" NumberingLevel="1" BulletsAndNumberingListType="NumberedList" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">NumList > Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/NumList > NumList > NumList > NumList > first > beginsWith-3 > lowerAlpha" Name="NumList > NumList > NumList > NumList > first > beginsWith-3 > lowerAlpha" NumberingExpression="^#.^t" NumberingLevel="4" BulletsAndNumberingListType="NumberedList" LeftIndent="30">
|
||||
@@ -440,7 +440,7 @@
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/NumList > first > beginsWith-2 > FirstParagraph" Name="NumList > first > beginsWith-2 > FirstParagraph" NumberingExpression="^#.^t" NumberingLevel="1" BulletsAndNumberingListType="NumberedList" LeftIndent="0">
|
||||
<Properties>
|
||||
<BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
|
||||
<BasedOn type="object">NumList > first > beginsWith-2 > Paragraph</BasedOn>
|
||||
</Properties>
|
||||
</ParagraphStyle>
|
||||
<ParagraphStyle Self="ParagraphStyle/NumList > first > upperAlpha" Name="NumList > first > upperAlpha" NumberingExpression="^#.^t" NumberingLevel="1" BulletsAndNumberingListType="NumberedList" LeftIndent="0">
|
||||
|
||||
Reference in New Issue
Block a user