'Fixed' XHTML Export

Since I need to replace all “ in the generated XHTML with ‘, I use the replace function from the previous post.

 1     (* 
 2     Bugs:
 3     
 4     Does not like no selection: no real way to get the selection from SEE anyway.
 5     Sometimes does not execute if called from Script Menu.  Intermittant.
 6     *)
 7     
 8     -- If called from Script Menu, need to do this.
 9     
10     tell application "SubEthaEdit"
11      activate
12      tell application "System Events" to keystroke "C" using {command down}
13     end tell
14     
15     set theStart to (the clipboard)
16     
17     set the clipboard to (my replace(theStart, "\"", "'"))
18     
19     beep
20     
21     -- Another way of the Replace Function being called:
22     
23     -- set the clipboard to (replaceText from theStart to "'" instead of "\"")
24     
25     on replace(theText, find, replace)
26      set OldDelims to AppleScript's text item delimiters
27      set AppleScript's text item delimiters to find
28      set newText to text items of theText
29      set AppleScript's text item delimiters to replace
30      set theResult to newText as text
31      set AppleScript's text item delimiters to OldDelims
32      return theResult
33     end replace
34     
35     -- Alternate version of replace()
36     
37     to replaceText from theText to replace instead of find
38      set OldDelims to AppleScript's text item delimiters
39      set AppleScript's text item delimiters to find
40      set theText to text items of theText
41      set AppleScript's text item delimiters to replace
42      set theText to theText as text
43      set AppleScript's text item delimiters to OldDelims
44      theText
45     end replaceText
blog comments powered by Disqus