Jump to content
You must now use your email address to sign in [click for more info] ×

Publisher 2 and ICML files


Recommended Posts

Hi,

After the new version of Pandoc (v3.0) has been released, I have to reiterate a request for ICML import to Publisher. Pandoc v3 includes an improved ICML converter.

This converter would make going from (nearly) any markup file format to Publisher with no effort. If the source file contains text layout instructions (as you can do with Pandoc markdown, HTML, LaTeX, or Scrivener) Publisher could rebuild the layout faithfully.

ICML is a subset of the IDML file format that Publisher can already import. It is just one of the "Story" XML files inside the IDML package. Unfortunately, there is no way that I could find to convert an ICML file into an IDML one, so at the moment Publisher can't take advantage of this Pandoc converter.

HTML is universally used for the web, webhelp and ebooks. Pandoc and LaTeX are in strong use in the technical industry and in the academia. Such a converter would allow Publisher to be the final tool to generate PDF files from internal or end-user documentation, research materials, or web sites.

Paolo

 

Link to comment
Share on other sites

I found a way to convert ICML files generated by Pandoc to IDML files that Publisher can read. This is tried on very basic files, so I don't know how it works on real, long and complex files.

First of all, I've exported from InDesign CS6 a very basic IDML template. It contains nothing but the default settings generated by InDesign on a new document.

IDML-Template.idml.zip

Then, from Scrivener I've compiled a simple Pandoc-flavored markdown file, containing a text that I want to load in Publisher.

Scrivener-source-in-Pandoc.md.zip

I then used Pandoc to convert it to an ICML file. I used the simplest of the commands, generating the headless output in the Mac Terminal:

pandoc -f markdown -t icml input_file.md

With BBEdit, I opened a copy of the IDML-Template.idml file, and replaced the text included inside the ParagraphStyleRange tags:

image.thumb.png.ff96d929cda530a12ac8f963b226da9a.png

It is very important that the "Story Self=" tag matches the name of the current Story, as shown in the list of XML files inside the IDML package.

The resulting IDML file opens fine in Publisher (V1):

image.png.47fe98e9eca00e0ee8eb22247bb21ef6.png

It would be great if Publisher could at least do the ICML Story replacement in an IDML template, and import it as an IDML file. Even better, it would be if it could even trigger Pandoc when importing a Markdown file, if installed on the system. It seems to be a very easy filter to program.

Paolo

 

Link to comment
Share on other sites

33 minutes ago, PaoloT said:

Shame I don't know how to convert the CSS (also linked) into Publisher styles.

Shouldn't the style info be in the ICML files created by Pandoc?

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

8 hours ago, walt.farrell said:

Shouldn't the style info be in the ICML files created by Pandoc?

As far as I can see, text style definitions are included in the ICML file, just at the beginning. But then they are not in the Publisher file. The same with InDesign CS6.

In the past I've done some other tests, and text styles were converted. So, I don't know what is going wrong here.

Paolo

 

 

Link to comment
Share on other sites

Maybe I can guess why the text styles have not been converted. By reading the ICML filter code, it seems that text styles should have a predefined name. Custom names seem to be allowed, but they have to be declared.

https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Writers/ICML.hs

This would explain why I was successful when trying with an original file (in Scrivener) adhering to these specs, and they don't work when grabbing a web site with too different style names.

Paolo

 

Link to comment
Share on other sites

Something I noticed, while exploring Pandoc, is that the concept could be generalized. It is not just "from Markdown to Affinity Publisher", but "from Pandoc to Affinity Publisher". Pandoc is an incredibly capable tool, opening a world of conversions.

So, an "Import Pandoc" command could let one choose the starting file format, the source file, and end up into Publisher through an intermediate conversion to ICML/IDML. Or through a new Pandoc filter expressly conceived for Publisher.

Paolo

 

Link to comment
Share on other sites

  • 2 months later...

I discovered a way to avoid the command-line conversion from .md to .icml. There is a smart text editor called PanWriter, that acts as a graphical user interface for Pandoc. Conversions can be done there.

Paolo

 

Link to comment
Share on other sites

  • 2 months later...

I'm interested in this as well. I don't need ICML specifically, but I want to be able to create a page layout in Publisher and import XML marked up text which has tagged stuff like "this is a chapter", "this is a section", "this is a paragraph in the section". That is, logical document layout markup imported into Publisher which then decides what styles and masters to apply.

slice2.png.cb7417e51279952dd5c1adc42860264d.pngpRiNt! mOnKeY! 🖨️🙊
💻Lenovo Legion 5 Pro*, Intel(R) Core(TM) i7-12700H, 2300 Mhz, 14 Core, 32GB DDR5-4800, nVidia RTX 3070 Ti 8GB, Windoze 11 💻
*Sometimes gets used for something other than games.

 

Link to comment
Share on other sites

33 minutes ago, Print Monkey said:

import XML marked up text which has tagged stuff like "this is a chapter", "this is a section", "this is a paragraph in the section". That is, logical document layout markup imported into Publisher which then decides what styles and masters to apply.

This is exactly what you could do with a markdown document, converted via Pandoc into a format that Publisher can understand. At the moment, the most immediate way of doing it for structured text is converting markdown to DOCX, and then import it into Publisher.

If you need more sophisticate layout, I guess the only way is to follow the ICML-to-IDML path described above.

Paolo

 

Link to comment
Share on other sites

  • 7 months later...

I've had a pandoc-to-InDesign workflow for years, using icml. It would be fabulous to be able to use Affinity this way, since I've parted ways with InDesign entirely now.

My workflow runs articles (from markdown or html) through pandoc to icml files, which are then 'placed' in custom indesign templates with master pages and paragraph/character styles already set up. That allows me to run the same content to the web (for CSS styling) or to print (with Indesign, or ideally, Affinity Publisher) doing the styling.  Best of both worlds. No compromises.

Currently playing with Typst for thmye print output, which is actually wonderful... but for anything visual, there's no substitute for a visual DTP program.

Link to comment
Share on other sites

16 hours ago, JMaxSFU said:

It would be fabulous to be able to use Affinity this way

Absolutely. The Pandoc to ICML converter is good enough, if the source materials are correctly made and not too complicate from a page layout point of view.

Publisher could be the perfect PDF formatter for a workflow based on Markdown. Typst is great, but it is much less flexible than Publisher.

Publisher could already be the perfect solution for technical and academic documents to be released in different formats.

I'm sure it wouldn't be exceptionally difficult for Serif to extend the IDML importer to include ICML. All considered, it is the same format, only a headless one.

Paolo

 

Link to comment
Share on other sites

I'll add my voice to this request. I've been using Pandoc and Pandoc-flavored Markdown for years. A direct Markdown > Publisher workflow would be ideal, but I can deal with ICML > Publisher. I could deal with DOCX > Publisher, but without having tried it, I imagine it introduces additional cruft.

Link to comment
Share on other sites

"Small parts loosely joined," is a good old design principle. ICML is pretty pared-down: it's basically just paragraph- and character-style-ranges surrounding text, and some hooks to style definitions. It's pretty fit to purpose. And it is an open standard. Or at least it's transparent.

All Publisher would need to do is read it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.