jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.41k stars 3.37k forks source link

Feature Request: list construction in ODT #5086

Open selfuryon opened 5 years ago

selfuryon commented 5 years ago

Hello!

Input: I have a gfm file like this:

# Test

Sample Text:

* Sample Item 1
    * Sample Item 1.1
* Sample Item 2
    * Sample Item 2.1

Sample Text:

1. Sample Item 1
    1. Sample Item 1.1
1. Sample Item 2
    1. Sample Item 2.1

And I want to get a ODT with my own style by this command: pandoc -f gfm --toc --reference-doc=my_own_style.odt -o test.odt test.md

A problem: I want to customize a bulleted/numbered list with my own paragraph/list style: test

But I found out that pandoc don't use any included style for that, it create its own both paragraph and list style (as I understand): content.xml:

 <office:automatic-styles>
    <text:list-style style:name="L1">
      <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">
        <style:list-level-properties text:list-level-position-and-space-mode="label-alignment" fo:text-align="right">
          <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.5in" fo:text-indent="-0.1in" fo:margin-left="0.5in" />
        </style:list-level-properties>
      </text:list-level-style-bullet>
      <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦">
        <style:list-level-properties text:list-level-position-and-space-mode="label-alignment" fo:text-align="right">
          <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.0in" fo:text-indent="-0.1in" fo:margin-left="1.0in" />
and so on

...

    <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L1">
      <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0in" />
    </style:style>
    <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L2">
      <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0in" />
    </style:style>
    <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L3">
      <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0in" />
    </style:style>

...

<text:list text:style-name="L1">
  <text:list-item>
    <text:p text:style-name="P1">Sample Item 1</text:p><text:list text:style-name="L2">
      <text:list-item>
        <text:p text:style-name="P2">Sample Item 1.1</text:p>
      </text:list-item>
    </text:list>
  </text:list-item>
  <text:list-item>
    <text:p text:style-name="P1">Sample Item 2</text:p><text:list text:style-name="L3">
      <text:list-item>
        <text:p text:style-name="P3">Sample Item 2.1</text:p>
      </text:list-item>
    </text:list>
  </text:list-item>
</text:list>

Possible solution: I understand that I can change all styles after file generation, but it's hard to do again and again. As a possible solution - maybe use list 1/numbering 1 paragraph style and list style? list style

https://groups.google.com/forum/#!topic/pandoc-discuss/fv5dS0pRO2A

gdg-work commented 5 years ago

Hello, The standard reference document contains 'List 1'.. 'List 5' styles and a bunch of 'Numbering_XXX' styles. But these styles isn't used in a formatted document. Instead, every list (numbered or marked) generates its own style without reference to templates.

I think the good default behaviour would be to create a style for every list, but make it a reference to one of predefined list styles (via style:parent-style-name attribute). Then we'll have consistency of using default and versatility of one style per list.

Next, we have paragraphs inside list items. Styles of these paragraphs are generated, too, and have unique names. But these styles have references (style:parent-style-name=) to a single Text_20_body style. It would be good to have this system in lists' styles.

I'm sorry, but my Haskell level is very close to zero and I cannot make necessary changes in the code by myself. But if you'll point me to the right place in the code I can try it.