0

The Setup

I'm working on a large book in Indesign. I write in Scrivener and process the text with python. After compiling my text with python, I run the whole manuscript through Pandoc to get ICML for indesign. I then cut that ICML up into chapters to prevent Indesign from choking on it.

The original manuscript in markdown contains some tables. What I'm trying to do is make these tables span columns of text. (NOT cells spanning columns inside the table.) When I edit the copy to make a table span columns in Indesign and read the ICML source generated, I see something like this:

<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption" SpanColumnType="SpanColumns">
    <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Default">
        <Table Self="uf2i18802" HeaderRowCount="1" FooterRowCount="0" BodyRowCount="11" ColumnCount="2" AppliedTableStyle="TableStyle/Table" TableDirection="LeftToRightDirection">
            <Row Self="uf2i18802Row0" Name="0" SingleRowHeight="11.99688720703125" />

Now, my Pandoc output looks more like this:

<Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="11" ColumnCount="2">
    <Column Name="0" />

So what I do is wrap the entire <Table> element in that <ParagraphStyleRange> and <CharacterStyleRange> elements, with the SpanColumnType="SpanColumns" on the paragraph, because this is apparently what happens in ICML when you set a table to span columns.

The Problem

The python script I've got runs fine, and even seems to insert the correct elements and indent the <Table> element properly:

<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption" SpanColumnType="SpanColumns">
  <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Default">
    <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="3" ColumnCount="2">
      <Column Name="0" SingleColumnWidth="120.0" />

But the change doesn't take in Indesign.

I've even noticed that the relevant attribute is removed when I check out the ICML and check it back in, as though the attribute is not accepted and is removed because it's invalid.

Am I doing this wrong? Is there a better way to do this? Is there documentation for how to do this type of thing somewhere?

I haven't found a lot of ICML resources, so I'm basically forced to do this by trial and error. Apparently Pandoc itself is one of the most relevant links on any search string related to ICML, which doesn't much help. This document has a specification for the defaults of ICML documents, but I can't see anything wrong with the solution I'm attempting here. And to top it off, there's no ICML tag here on StackOverflow, so it's pretty rare apparently.

Arcandio
  • 310
  • 2
  • 13
  • There are differences between the first sample that works and the second sample that doesn't work. Have you tried adjusting your ICML to make it more like the first? – user1754036 Dec 02 '16 at 00:11
  • The self and size attributes are added by InDesign's own internal processes, and I don't know how to correctly generate a useful Self attribute that won't introduce more issues. The input ICML works as intended *aside* from the span columns attribute, so it's not that the ICML itself is invalid. I've got a different part of the script that inserts some width attributes and that works fine, so I don't think it's tied to the size. – Arcandio Dec 02 '16 at 00:26
  • Have you checked that the `Cell`s have the right `Name` attribute? Also, you should be using the `ColumnSpan` property of `Cell`s to span columns. – Josh Voigts Dec 02 '16 at 14:53
  • @JoshVoigts I'm not trying to make cells span columns, I'm trying to get the table itself to span columns of text. The main text frame has 2 columns in it, and some of these tables need to stretch across the entire page. I can verify that the cells have the right names anyway, because another part of the script assigns widths to rows based on cell contents grabbed by name. – Arcandio Dec 02 '16 at 17:26

0 Answers0