jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.8k stars 3.39k forks source link

ICML and its lasts and firsts #2315

Open robsonsobral opened 9 years ago

robsonsobral commented 9 years ago

Hi!

I'm testing pandoc and saw the > first paragraph styles. InDesign is terrible when dealing with lists and this is a good solution, but not enough.

Can we have > last paragraph styles on lists and also blockquote > paragraph > first and blockquote > paragraph > last?

I just noted this need because I'm converting a document full of multiple paragraph quotes.

Thanks.

jgm commented 9 years ago

You'll have to be more specific about exactly what output you're looking for. I'm afraid I know little about ICML.

+++ Robson Sobral [Jul 21 15 04:41 ]:

Hi!

I'm testing pandoc and saw the > first paragraph styles. InDesign is terrible when dealing with lists and this is a good solution, but not enough.

Can we have > last paragraph styles on lists and also blockquote > paragraph > first and blockquote > paragraph > last?

I just noted this need because I'm converting a document full of multiple paragraph quotes.

Thanks.

— Reply to this email directly or [1]view it on GitHub.

References

  1. https://github.com/jgm/pandoc/issues/2315
robsonsobral commented 9 years ago

Oh, I'm sorry!

ICML is a XML file used to input content into InDesign.

For example:

<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
  <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
    <Content>Lorem ipsum...</Content>
  </CharacterStyleRange><Br />
</ParagraphStyleRange>

Currently, pandoc applies the paragraph styles NumList or BulList to the list items and NumList > first or BulList > first to the first one of them. Inside blockquotes, they're Blockquote > BulList > first and Blockquote > NumList > first, while the default paragraph style is Blockquote > Paragraph.

I'm looking for two things:

Why that? Because there's no way to apply margins before or after a blockquote or a list if they have more than one item or paragraph. (Yes, I know. It's stupid!)

Thank you so much for your attention.

mb21 commented 9 years ago

Sounds reasonable, I think I can implement this...

robsonsobral commented 9 years ago

Thanks, @mb21. If you need some testing on your fork, just call me.

Thank you, @jgm !

mb21 commented 9 years ago

@robsonsobral I think the changes I made work. If you don't have any objections I'll make a pull request to jgm.

Note that it's Blockquote > first > Paragraph instead of Blockquote > Paragraph > first. Else how would you name the styles for the following?

> - one
> - two
> - three
>
> other paragraph
robsonsobral commented 9 years ago

I'm sorry about the delay, @mb21 !


Note that it's Blockquote > first > Paragraph instead of Blockquote > Paragraph > first

I think it should be Blockquote > Paragraph > first to match the standard already in use with lists. > first and > last are just "accessory" styles and there isn't a blockquote style; the basic is blockquote > paragraph.

These styles should even be based on the main list or blockquote styles. But you got me thinking about the following issue.


Else how would you name the styles for the following?

- one
- two
- three

other paragraph

Considering that this is intended to cover an InDesign limitation, there's need for "accessory styles" just on first and last children of lists and blockquotes.

Do you think they should be like this?

Or like this?

This option will change the current behavior.

Thanks, @mb21 !

robsonsobral commented 9 years ago

I'm sorry, @mb21! I tried to test, but... I'm to newbie for it. I don't even how to start.

I'm sorry!

mb21 commented 9 years ago

Yeah, maybe it's better to go the first route of your two example lists, e.g. the one with only one > first or > last at the end. (Also, there should probably be a > firstAndLast for lists with only one item or blockquotes with only one paragraph?)

And what exactly would be the rule when to add those? Only when a style previously ended with BulList, OrdList, Blockquote > Paragraph, DefListKey or DefListTerm > Paragraph?

Would that solve all your layout problems? Would be great if you could come up with a couple of examples and expected styles.

btw, there are some instruction how to build pandoc, but I agree it's quite involved when you're doing it the first time, but it boils down to:

git clone -b ICML-Writer-firsts-lasts git@github.com:mb21/pandoc.git
cd pandoc
git submodule update --init
cabal update
cabal sandbox init    
cabal install --dependencies-only
cabal configure
cabal build
./dist/build/pandoc/pandoc
robsonsobral commented 9 years ago

btw, there are some instruction how to build pandoc, but I agree it's quite involved when you're doing it the first time [...]

Thank, @mb21 , but these instructions looks like Greek to me. I felt even more a designer looking at them. I'm sorry.


(Also, there should probably be a > firstAndLast for lists with only one item or blockquotes with only one paragraph?)

Yes, you're absolutely right!


Well... I think I was wrong. Using only one > first or > last at the end isn't enough. Take a look:

<blockquote>
  <ul>
    <li></li>
    <li></li>
    <li></li>
  </ul>
  <p></p>
</blockquote>

Will generate the following paragraph styles:

And:

<blockquote>
  <p></p>
  <ul>
    <li></li>
    <li></li>
    <li></li>
  </ul>
</blockquote>

Will generate:

Have you notice the bold items? They should be different! How could I put a huge margin before the blockquotes in both cases without mess up everything? The first item of list can have different styles in these cases. It is necessary to mark them as the first item of a list or/and the first item on a blockquote. And I'm not even talking about the last!

So, maybe this is preferable:

And:


And what exactly would be the rule when to add those? Only when a style previously ended with BulList, OrdList, Blockquote > Paragraph, DefListKey or DefListTerm > Paragraph?

The logic behind these rules still escapes me. I guess it happens when a style, other than paragraph or a heading, is different from previous, for > first; and different from next, for > last. I'm sorry. I don't have too much expertise to give you a good suggestion.


Thank you so much for your patience and help!