-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICML writer: Differentiate hyperlinks and cross-references #5541
Comments
Thanks for the excellent bug report! |
Thanks a lot for your report, exactly the info I needed! I've started implementing this... most of your points should be implemented, but I haven't looked at the tests yet. A few questions:
|
When the markup chosen here (the "desired-output.icml" file that I provided on pandoc-discuss) is imported into InDesign, an "update" icon appears next to each cross-reference in the Hyperlinks pane. The InDesign reference manual (p. 434) explains: "An update icon indicates that the cross-reference destination text has changed or that the cross-reference source text has been edited." This is because in the file "desired-output.icml", Pandoc's ICML writer has "edited" (written) the cross-reference source text to be whatever is in the <CrossReferenceSource Self="htss-1" AppliedFormat="u1" Name="2017" Hidden="false">
<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Cite Link">
<Content>2017</Content>
</CharacterStyleRange>
</CrossReferenceSource> I can't see any better way to do this given InDesign's limitations, and it works well enough.
This has a simple answer: Here's an analogy to HTML that comes to mind: the There is another relevant way of doing internal links in ICML using
This value is used by InDesign in several link-related dialogue boxes ("Hyperlink Options...", "Cross-Reference Options...", etc.) in a drop-down menu that lists all the links. It appears that the best value for the Thanks so much for working on this. |
Ah, that's what I was missing. Yes, that makes sense, but is somewhat tricky to implement, since a lot of elements can be linked to (every element that can have an id attribute). I'll take a look... |
A year after opening this issue, I just wanted to note that I think this issue is still worth working on, and I am willing to help in any way that I can! |
I just discovered this as well and would be willing to do what I can to help. Is anyone actively working on the ICML writer? |
I've written most of the ICML writer a long time ago... since then, I haven't been actively working on it anymore... but pulls welcome! I'm also happy to answer any questions... |
Looked over the code last night... One question @mb21, have you ever tried to use a Lua filter to write direct ICML? I've used them for other formats incl. docx and HTML, but wonder if it would work here as well because of the XML... |
not sure I understand your question... most of pandoc is written in Haskell, which is a much nicer programming language for big projects. to do a little bit of AST transformations, lua is great though. btw. if you want a lua writer, you should look at https://pandoc.org/MANUAL.html#custom-writers |
Spend some time looking at this today, and there are appears to be two possible approaches to getting internal links works in ICML #2 uses a combination of three things to make it operational
The first two could be done with a pandoc filter (I've done it for docx and could easily adjust for ICML), but since those only allow changes to the content, it's not possible to do #3. That has to be done in the writer itself. I looked at the writer code and while I can read and understand it - haskell is just quirky enough that I might break something. |
thanks for the info! I probably won't have time to implement this anytime soon, but maybe someone else wants to give it a shot? Or a first step would be to figure out some example XML that we'd need to generate...
the compiler and test-suite most probably will catch it :-) |
Thanks @lrosenthol, I am looking forward to testing this when the PR is accepted! |
ICML differentiates between hyperlinks (external links) and cross-references (document-internal links). Pandoc's ICML writer does not correctly write document-internal links. I will summarize below the output changes that are needed to fix this; the full input and output files for the markup below can be found in the related topic on the pandoc-discuss list (see link-citations in ICML writer). It is likely not a simple one-line change but does not require a massive overhaul of the entire writer either, only the part that writes links. I don't know enough about Haskell to fix the writer myself, though I may try if nobody else wants to fix this.
There are essentially four things to change, enumerated below:
<CrossReferenceFormat>
element should be present just before the<Story>
element. The following example worked in my test:<CrossReferenceSource>
element, NOT a<HyperlinkTextSource>
element (which is for external links only). TheSelf
attribute of the<CrossReferenceFormat>
tag (from number 1 above) should be referenced in theAppliedFormat
attribute of<CrossReferenceSource>
tags, and theName
attribute of<CrossReferenceSource>
tags should have a relevant value. For example:<HyperlinkTextDestination>
element, NOT a<HyperlinkURLDestination>
element (which is for external links only).<HyperlinkTextDestination>
elements for internal-link destination points should be written at relevant points in the document, NOT at end of file, and theName
attribute of<HyperlinkTextDestination>
tags should have a relevant value. For example:<Hyperlink>
element at end of file):...in this example, written just before the relevant bibliography entry:
...with the corresponding
<Hyperlink>
element written at end of file, and without theDestinationURL
attribute (which is for external links only):DestinationUniqueKey
attribute of each<Hyperlink>
tag and its corresponding<HyperlinkURLDestination>
or<HyperlinkTextDestination>
tag (for external and internal links respectively) should be unique, NOT the same. For example:<Hyperlink>
tags with identicalDestinationUniqueKey
attributes:<Hyperlink>
tags with uniqueDestinationUniqueKey
attributes (and the last<Hyperlink>
tag, because it is an internal link, correctly lacks a companion<HyperlinkURLDestination>
element):The text was updated successfully, but these errors were encountered: