: Indesign script to add HTML tags based on character styles I have an InDesign document with text styled as one of the following custom character styles throughout the document: character-bold
I have an InDesign document with text styled as one of the following custom character styles throughout the document:
character-bold
character-italic
character-bolditalic
[none]
I am trying to write a script to scan the entire document and wrap each text of a particular character style with the appropriate HTML tag, except of course the text without any assigned character style. Thus, the following text:
The quick brown fox jumps right over the lazy dog.
...should look like:
The quick <b>brown</b> fox <b>jumps ri</b>ght <i>ov</i>er <b><i>the</i></b> lazy dog.
Is this doable? I am sure it is. I don't mind using some kind of GREP/Find-Change method if possible. I don't want to use "Export to HTML" because there are some custom tags that won't show that way.
More posts by @Debbie163
2 Comments
Sorted by latest first Latest Oldest Best
This is definitely doable, and can quite easily be done with the use of a GREP-style script.
For each of your attributes, search for it using the GREP tab and replace with <b>[CO]</b> (so in a script, that would be changeGrep). The codes themselves will probably get some of the formatting but that would not matter if you discard them anyway. (Make sure to change the HTML codes as well, matching the attribute you are changing.)
Before you do this to add attributes, make sure to replace the characters < and > with < and >, and - since this introduces yet another special character - before you do that, replace & with &.
This is definitely doable, and could quite easily be done without the use of a GREP-style script.
InDesign has a built-in "Export to HTML" feature which can be found under File > Export.
You can choose how the HTML will render on it's way out in the export dialogue, including which tags to include (like bold, italic, etc.)
Here is a tutorial detailing the entire process: www.dummies.com/how-to/content/how-to-export-adobe-indesign-cs6-documents-to-html.html
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.