summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/scanpages/replicate.plist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/scanpages/replicate.plist')
-rw-r--r--Master/texmf-dist/doc/latex/scanpages/replicate.plist24
1 files changed, 15 insertions, 9 deletions
diff --git a/Master/texmf-dist/doc/latex/scanpages/replicate.plist b/Master/texmf-dist/doc/latex/scanpages/replicate.plist
index e4a09ea1772..dea502e0e06 100644
--- a/Master/texmf-dist/doc/latex/scanpages/replicate.plist
+++ b/Master/texmf-dist/doc/latex/scanpages/replicate.plist
@@ -15,11 +15,10 @@
--This allows replication of a commented block of text as many times as specified, substituting
--values for 'variables' in the process
-set TSLibAlias to alias ((path to home folder as string) & "Library:TeXShop:Scripts:TSLib.scpt")
-set TSLib to (load script TSLibAlias)
+property trimitems : {" ", tab, ASCII character 10}
+
set lf to (ASCII character 10)
tell application "TeXShop" to set s to content of selection of document 1
-set AppleScript's text item delimiters to {""}
set oldtid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "%Repetitions="
@@ -45,11 +44,9 @@ end if
set ss to (item 2 of tmp)
set AppleScript's text item delimiters to {lf}
set tmp2 to (text items of ss)
---display dialog "tmp2=" & (tmp2 as text)
set AppleScript's text item delimiters to oldtid
set vbllst to (item 1 of tmp2) --like {nnn,0:1+1,1:3+-2}
---tell TSLib to set trimitems to {" ", tab, "{", "}"}
-tell TSLib to set vbllst2 to trim(vbllst)
+set vbllst2 to trim(vbllst)
set vbllst3 to (text 2 thru -2 of vbllst2)
set AppleScript's text item delimiters to {" , ", " ,", " ,", ","}
set vbles to (text items of vbllst3) -- line {nnn,0:1+1,1:3+-2}
@@ -97,7 +94,6 @@ repeat with j from 2 to n
end repeat
set AppleScript's text item delimiters to oldtid
---set v to (vlst as text)
set viniti to {}
set vinci to {}
set kk to (count of vinit)
@@ -130,11 +126,9 @@ end repeat
set AppleScript's text item delimiters to {lf}
set body to (tmp2 as text)
set AppleScript's text item delimiters to oldtid
---Start new method
set repl to {s}
set newbody to body
repeat with p from 1 to numrep
- --copy tmp to newtmp
set newbody to body
repeat with k from 1 to kk
set v to ""
@@ -181,6 +175,18 @@ to switchText of t from s to r
set text item delimiters to d
t
end switchText
+
+on trim(someText)
+ repeat until first character of someText is not in trimitems
+ set someText to text 2 thru -1 of someText
+ end repeat
+
+ repeat until last character of someText is not in trimitems
+ set someText to text 1 thru -2 of someText
+ end repeat
+ return someText
+end trim
+
</string>
<key>name</key>
<string>Replicate</string>