Article View: adobe.scripting.indesign
Article #8619Re: Get (relative) index of a paragraph inside a selection of paragraphs
From: Dave_Saunders
Date: Sun, 01 Oct 2006 11:01
Date: Sun, 01 Oct 2006 11:01
22 lines
1515 bytes
1515 bytes
These are already sorted alphabetically, are they? I presume so. The way I tackle this is to loop from the back, along these lines:
function cleanUpBib(textRef) {
var paras = textRef.paragraphs;
var curName = "";
for (var j = paras.length - 1; j >= 0; j--) {
var bibName = getBibName(paras[j]);
if (bibName != curName) {
curName = bibName;
} else {
clearBibName(paras[j+1]);
}
}
}
where getBibName is a function that returns the name from the referenced paragraph and clearBibName replaces the name in the referenced paragraph with the en-dash, comma, tab string (or whatever).
And I'd let this rip on the whole bibiolography, but perhaps test it first on a selection.
Did I understand the need correctly? For jobs like this, it's almost always easier to start from the back and work forwards.
Dave
Technical Details
Message-ID:
<3bc1d60c.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!news.buerger.net!open-news-network.org!news.isoc.lu!webcrossingReferences:
<3bc1d60c.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,11f901afe18132ac X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!news.buerger.net!open-news-network.org!news.isoc.lu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Get (relative) index of a paragraph inside a selection of paragraphs Message-ID: <3bc1d60c.1@webcrossing.la2eafNXanI> Date: Sun, 1 Oct 2006 04:01:11 -0700 References: <3bc1d60c.-1@webcrossing.la2eafNXanI> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit