//Pre-layout.txt //A support file for the InDesign CS4 JavaScript FindChangeByList.jsx // //This data file is tab-delimited, with carriage returns separating records. // //The format of each record in the file is: //findTypefindPropertieschangePropertiesfindChangeOptionsdescription // //Where: // is a tab character //findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use). //findProperties is a properties record (as text) of the find preferences. //changeProperties is a properties record (as text) of the change preferences. //findChangeOptions is a properties record (as text) of the find/change options. //description is a description of the find/change operation // //Very simple example: //text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash. // //More complex example: //text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"price"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find $10.00 to $99.99 and apply the character style "price". // //All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences. // //If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped" //as shown in the example below: // //{findWhat:"\\s+"} // text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all dash-dash and replace with an em dash. grep {findWhat:"⁄"} {changeTo:"/"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all funky slashes and replace with regular slashes. grep {findWhat:"\d\/\d"} {changeTo:"", myText.otfFraction = true} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Format opentype fractions. grep {findWhat:"(?<=\d) (?=\d\/\d)"} {changeTo:""} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Remove all spaces from mixed fractions. grep {findWhat:"\x{20}\x{20}+"} {changeTo:"\x{20}"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find multiple spaces and replace with single space. grep {findWhat:" +$"} {changeTo:""} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find trailing spaces and delete. grep {findWhat:"([\d\/]+)-([\d\/]+)"} {changeTo:"$1–$2"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find hyphens in number ranges and replace with en-dashes. grep {findWhat:"(?<=\d) (?=seconds?|minutes?|hours?|days?|weeks?|months?|teaspoons?|tablespoons?|cups?|pounds?|ounces?|degrees?|inch|inches|\bto\b|\bby\b)"} {changeTo:" "} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Replace spaces after some numbers with non-breaking spaces. grep {findWhat:"(\d+)-([\u\l]+)"} {changeTo:"$1‑$2"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Replace hyphens after numbers with non-breaking hyphens. grep {findWhat:"([\u\l]+(?=[-­‑–]))|((?<=[-­‑–])[\u\l]+)"} {changeTo:"", myText.noBreak = true} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all hyphenated words and set to no-break.