Mercurial > projects > dwt-addons
comparison dwtx/jface/internal/text/html/HTML2TextReader.d @ 174:c6d7b1ea700b
First sample running
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 11 Sep 2008 00:32:24 +0200 |
parents | 1a5b8f8129df |
children |
comparison
equal
deleted
inserted
replaced
173:8995e830f75e | 174:c6d7b1ea700b |
---|---|
38 * Moved into this package from <code>dwtx.jface.internal.text.revisions</code>.</p> | 38 * Moved into this package from <code>dwtx.jface.internal.text.revisions</code>.</p> |
39 */ | 39 */ |
40 public class HTML2TextReader : SubstitutionTextReader { | 40 public class HTML2TextReader : SubstitutionTextReader { |
41 | 41 |
42 private static const String EMPTY_STRING= ""; //$NON-NLS-1$ | 42 private static const String EMPTY_STRING= ""; //$NON-NLS-1$ |
43 private static const Map fgEntityLookup; | 43 private static Map fgEntityLookup_; |
44 private static const Set fgTags; | 44 private static Set fgTags_; |
45 | 45 private static Map fgEntityLookup(){ |
46 static this() { | 46 if( fgEntityLookup_ is null ){ |
47 | 47 synchronized(HTML2TextReader.classinfo ){ |
48 fgTags= new HashSet(); | 48 if( fgEntityLookup_ is null ){ |
49 fgTags.add("b"); //$NON-NLS-1$ | 49 fgEntityLookup_= new HashMap(7); |
50 fgTags.add("br"); //$NON-NLS-1$ | 50 fgEntityLookup_.put("lt", "<"); //$NON-NLS-1$ //$NON-NLS-2$ |
51 fgTags.add("br/"); //$NON-NLS-1$ | 51 fgEntityLookup_.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$ |
52 fgTags.add("div"); //$NON-NLS-1$ | 52 fgEntityLookup_.put("nbsp", " "); //$NON-NLS-1$ //$NON-NLS-2$ |
53 fgTags.add("h1"); //$NON-NLS-1$ | 53 fgEntityLookup_.put("amp", "&"); //$NON-NLS-1$ //$NON-NLS-2$ |
54 fgTags.add("h2"); //$NON-NLS-1$ | 54 fgEntityLookup_.put("circ", "^"); //$NON-NLS-1$ //$NON-NLS-2$ |
55 fgTags.add("h3"); //$NON-NLS-1$ | 55 fgEntityLookup_.put("tilde", "~"); //$NON-NLS-2$ //$NON-NLS-1$ |
56 fgTags.add("h4"); //$NON-NLS-1$ | 56 fgEntityLookup_.put("quot", "\""); //$NON-NLS-1$ //$NON-NLS-2$ |
57 fgTags.add("h5"); //$NON-NLS-1$ | 57 } |
58 fgTags.add("p"); //$NON-NLS-1$ | 58 } |
59 fgTags.add("dl"); //$NON-NLS-1$ | 59 } |
60 fgTags.add("dt"); //$NON-NLS-1$ | 60 return fgEntityLookup_; |
61 fgTags.add("dd"); //$NON-NLS-1$ | 61 } |
62 fgTags.add("li"); //$NON-NLS-1$ | 62 private static Set fgTags(){ |
63 fgTags.add("ul"); //$NON-NLS-1$ | 63 if( fgTags_ is null ){ |
64 fgTags.add("pre"); //$NON-NLS-1$ | 64 synchronized(HTML2TextReader.classinfo ){ |
65 fgTags.add("head"); //$NON-NLS-1$ | 65 if( fgTags_ is null ){ |
66 | 66 fgTags_= new HashSet(); |
67 fgEntityLookup= new HashMap(7); | 67 fgTags_.add("b"); //$NON-NLS-1$ |
68 fgEntityLookup.put("lt", "<"); //$NON-NLS-1$ //$NON-NLS-2$ | 68 fgTags_.add("br"); //$NON-NLS-1$ |
69 fgEntityLookup.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$ | 69 fgTags_.add("br/"); //$NON-NLS-1$ |
70 fgEntityLookup.put("nbsp", " "); //$NON-NLS-1$ //$NON-NLS-2$ | 70 fgTags_.add("div"); //$NON-NLS-1$ |
71 fgEntityLookup.put("amp", "&"); //$NON-NLS-1$ //$NON-NLS-2$ | 71 fgTags_.add("h1"); //$NON-NLS-1$ |
72 fgEntityLookup.put("circ", "^"); //$NON-NLS-1$ //$NON-NLS-2$ | 72 fgTags_.add("h2"); //$NON-NLS-1$ |
73 fgEntityLookup.put("tilde", "~"); //$NON-NLS-2$ //$NON-NLS-1$ | 73 fgTags_.add("h3"); //$NON-NLS-1$ |
74 fgEntityLookup.put("quot", "\""); //$NON-NLS-1$ //$NON-NLS-2$ | 74 fgTags_.add("h4"); //$NON-NLS-1$ |
75 fgTags_.add("h5"); //$NON-NLS-1$ | |
76 fgTags_.add("p"); //$NON-NLS-1$ | |
77 fgTags_.add("dl"); //$NON-NLS-1$ | |
78 fgTags_.add("dt"); //$NON-NLS-1$ | |
79 fgTags_.add("dd"); //$NON-NLS-1$ | |
80 fgTags_.add("li"); //$NON-NLS-1$ | |
81 fgTags_.add("ul"); //$NON-NLS-1$ | |
82 fgTags_.add("pre"); //$NON-NLS-1$ | |
83 fgTags_.add("head"); //$NON-NLS-1$ | |
84 } | |
85 } | |
86 } | |
87 return fgTags_; | |
75 } | 88 } |
76 | 89 |
77 private int fCounter= 0; | 90 private int fCounter= 0; |
78 private TextPresentation fTextPresentation; | 91 private TextPresentation fTextPresentation; |
79 private int fBold= 0; | 92 private int fBold= 0; |