• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[JS] Toc makeAnchor

Enthusiast ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

Good morning all How is it possible to retrieve the information from the anchor text (make text anchor in source paragraph.) That the table of contents insert when the option is checked?

 

I have nothing on the command:

leDoc.hyperlinks[lePosition].properties

and no longer on:

leDoc.hyperlinks[lePosition].destination.properties

 

thank you

Liphou

 

Bonjour à Tous

Comment est-il possible de recupé les informations de l'ancre de texte (make text anchor in source paragraph.) que le table des matière inser quand l'option est coché ?

 

je n'ai rien sur la commande :

leDoc.hyperlinks[lePosition].properties

et non plus sur:

leDoc.hyperlinks[lePosition].destination.properties

 

merci à vous

 

Liphou

 

TOPICS
Scripting

Views

540

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Hi Liphou,

I'm a little confused. What exactly are you after?

Could you post a screenshot showing that part of a TOC with invisible characters and the Story Editor window?

What information do you want to retrieve?

 

Thanks,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

 

 

 

Hello Laubender,

I am trying to retrieve the information on the text anchors that the table of contents when the option is selected: "Create a text anchor in the source paragraph", retrieve the information on these Anchors which links them with the table.

 

Merci

 

Liphou

 

Bonjour Laubbender,

 

Je cherche à récupérer les informations sur les ancres de textes que la table des matièrs quand l'option est selectioné : " Créer une ancre de texte dans le paragraphe source", récupérer les information sur ces Ancres qui les lie avec la table.

 

Capture d’écran 2021-06-10 à 08.36.40.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

Hi Liphou,

are you sure that you are really after the option

"Make text anchor in source paragraph" ?

 

That feature was introduced with InDesign version 9. The first version of Creative Cloud.

Before, e.g. with InDesign CS6 version 8, this feature did not exist.

 

Nevertheless, InDesign's TOC feature added hyperlinks to a document when the TOC was built in CS6.

With text anchors in the source paragraphs. And this is still the case with InDesign CC 2021.

 

 

hyperlink.source.sourceText
hyperlink.source.name

 

 

should give you the needed information.

 

And you will see, that:

 

hypelink.visible

 

returns false in the case of a hyperlink that was added with the TOC functionality of InDesign.

 

 

hyperlink.destination

 

 

will return a HyperlinkPageDestination.

 

You now know the building blocks of a Table Of Contents in a document.

 

FWIW:

"Make text anchor in source paragraph" is an option, it is part of a TOCStyle and was, as I already said, introduced with InDesign version 9. In the ExtendScript DOM you can turn that option on and off with:

 

TOCStyle.makeAnchor

 

Set makeAnchor to true or false. It has no influence on adding hyperlinks to the document when a TOC is added or updated.

 

What's left? Hm…
What is the real purpose of option "Make text anchor in source paragraph" in a TOC style?

My guess is, this is for an output format like EPUB perhaps. Documentation does not mention this option at all:

https://helpx.adobe.com/in/indesign/using/creating-table-contents.html

 

And DOM documentation does not tell a bit more:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#TOCStyle.html

 

Maybe I detected a glimpse of information in James Wamser's New Features of InDesign pdf:

 

Adobe InDesign CC | June 17, 2013
Version 9.0
EPUB enhancements
New features make it easier to produce high-quality EPUB files from InDesign.

You have greater control over the table of contents and CSS export, and CSS editing is simpler.…

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2021 Jun 13, 2021

Copy link to clipboard

Copied

Hi Uwe,

 

>What is the real purpose of option "Make text anchor in source paragraph" in a TOC style?

>My guess is, this is for an output format like EPUB perhaps

 

Correct: InDesign uses it to create a multi-level TOC when a document is exported to Epub.

 

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Hi Laubender,

This option actually linked to the creation of ePub for the realization of the toc.ncx and the table of contents in the ePub and that made things easier.

 

When we convert a table of contents there are still hyperlines which point to pages (HyperlinkPageDestination, ok) and not to the exact content of the text ... pagination update impossible.

 

I have already written a script which creates a fake table of contents based on the TOC style and which uses links and anchors, but which has the disadvantage of not keeping the text enrichments (bold, italic, etc.) .


Here in our case, we make a lot of modification in the automatically generated table of contents but with each update of the TOC, we have to start the modifications again with the risks that this implies.

 

My goal is to start again from the TOC converted into text to recreate cross-references only on the paginations of the CT to anchors which correspond to the titles of the table, hence the interest of retrieved which is already created.

 

Thanks

 

Philippe

 

Cet option effectivement lié à la création d'ePub pour la réalisation du toc.ncx et de la table des matière dans l'ePub et cela à facilité les choses.

Quand on convertie une table des matière il reste des hyperlines qui pointe vers des pages (HyperlinkPageDestination, ok) et non sur le contenu exacte du texte ... mise à jour des paginations impossible.

J'ai déjà écris un script qui réalise une fausse table des matière sur base du style de TDM et qui utilise des liens et ancres, mais qui a l'inconvénient de ne pas gardé les enrichissement de textes (gras, italic, etc.).
Ici dans notre cas, nous apportons beaucoup de modification dans la table des matières généré automatiquement mais à chaque mise à jour de la TDM, il faut recommencé les modifications avec les risque que cela implique.

Mon but est de repartir de la TDM convertie en texte pour recrée des référence croisé uniquement sur les paginations de la TDM vers des ancres qui correspond aux titres de la table, d'ou l'intérêt de récupéré se qui est déjà crée.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Thanks, Peter!

Ok, I did some more tests at the weekend and started from scratch. So:

 

makeAnchor is adding hyperlinkTextDestinations to a document.

With a distinct name that has some numbering in it:

_idTOCAnchor-n

where n is the number.

 

The thing is, that all the hyperlinkTextDestinations are not removed from the document if you do a new TOC with a new TOCStyle where makeAnchor is set to false. That was my source of confusion first and where I was wrong when I stated that nothing changes in the document when you set makeAnchor to true or false. I started with a test where I first set makeAnchor to true, then set makeAnchor to false.

 

Back to Liphou:

If you want to update a TOC with a changed TOCStyle or an edited documents, e.g. you want no headline in your TOC, but only subhead and you would like to minimize your hyperlinkTextDestinations to the needed ones, you could consider first to remove all hyperlinkTextDestinations with that _idTOCAnchor-n name and then update the TOC.

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Hi Peter

yes it's for the ePub, I wanted to recover them so as not to recreate them

oui c'est pour l'ePub, j'aurai voulus les récupérer pour ne pas les recrées

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

LATEST

Hello, is it possible to change the # in the palette to something else?

 

Bonjour est-il possible de changé le # dans la palette par autre chose ?Capture d’écran 2021-06-14 à 15.27.22.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines