Convert faux footnote numbers (superscripted) to actual footnotes
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Convert faux footnote numbers (superscripted) to actual footnotes
Tagged: conversion, false, faux, footnote, script
- This topic has 4 replies, 2 voices, and was last updated 5 years, 10 months ago by Alexandro Cuperus.
-
AuthorPosts
-
-
May 18, 2018 at 7:11 am #103850Alexandro CuperusMember
Hello everyone!
I’ve been trying to patch together different scripts and queries that I found all over the internet to solve this problem, but it seems that GREP is beyond me for now.
The problem I have is rather simple: There’s a book that has lots of ‘fake’ superscript numbers that were used as ‘endnote’ markers (fake endnotes, that is) and now I need to convert everything to proper footnotes.
I’m looking for a way to automatize this process, and replace all those superscript numbers with footnote insertions, where I can afterwards just go in an place the proper text. I ask this because the book is huge, since I would’ve done it manually if it were a few endnotes to deal with…
To summarize, need script that will convert superscripted text to proper footnote insertion.
I have no idea how to make a script that could automatically do this. If anyone can lend a hand, I will be eternally grateful.
Thank you so much,
Alex -
May 18, 2018 at 7:20 am #103851Alexandro CuperusMember
To give a jumpstart to the conversation, I’ve found a script very similar to the one I’m looking to achieve, created by Peter Kahrel in [url=https://creativepro.com/topic/use-grep-to-put-in-footnote-reference]this[/url] post a while back:
[code]
(function () {
var i;
var placeholders;
var fnote;
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = '\\[\\[(.+?)\\]\\]';
placeholders = app.documents[0].findGrep();
for (i = placeholders.length-1; i >= 0; i--) {
fnote = placeholders[i].insertionPoints[0].footnotes.add();
placeholders[i].move (LocationOptions.AFTER, fnote.insertionPoints[-1]);
}
}());
[/code]P.S. I have no idea what the formatting code is for this forum.
-
May 19, 2018 at 5:41 am #103856Alexandro CuperusMember
I think I’ve nailed the script and from primary tests it works fine. Here’s the code:
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = ‘\\d+’;
app.findGrepPreferences.position = Position.SUPERSCRIPT;
found = app.activeDocument.findGrep();
for (i = found.length-1; i >= 0; i–) {
found[i].insertionPoints[0].footnotes.add();
found[i].remove();
} -
May 21, 2018 at 1:29 pm #103886Michel Allio for FRIdNGEParticipant
??? …
-
May 21, 2018 at 1:39 pm #103887Alexandro CuperusMember
I can’t really reply to a set of three question marks. Care to be more explicit?
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.