My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This jEdit macro replaces the following string in selection:
// & -> &
// < -> &lt;
// > -> &gt;
// " -> &quot;
// ' -> &apos;
// Macro has been tested with jEdit 4.3pre14 and 4.3pre16 version

// This is public domain code from WizTools.org

// ######### Macro code starts #########

// Global Search Option
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(false);

// Replace & to &amp;
SearchAndReplace.setSearchString("&");
SearchAndReplace.setReplaceString("&amp;");
SearchAndReplace.replace(view);

// Replace < to &lt;
SearchAndReplace.setSearchString("<");
SearchAndReplace.setReplaceString("&lt;");
SearchAndReplace.replace(view);

// Replace > to &gt;
SearchAndReplace.setSearchString(">");
SearchAndReplace.setReplaceString("&gt;");
SearchAndReplace.replace(view);

// Replace " to &quot;
SearchAndReplace.setSearchString("\"");
SearchAndReplace.setReplaceString("&quot;");
SearchAndReplace.replace(view);

// Replace ' to &apos;
SearchAndReplace.setSearchString("'");
SearchAndReplace.setReplaceString("&apos;");
SearchAndReplace.replace(view);

Change log

r51 by subwiz on Sep 24, 2009   Diff
changed the copyright info
Go to: 
Project members, sign in to write a code review

Older revisions

r43 by subwiz on Sep 11, 2009   Diff
wrong comment fixed
r42 by subwiz on Sep 9, 2009   Diff
added jedit-macros project
All revisions of this file

File info

Size: 1137 bytes, 42 lines
Powered by Google Project Hosting