Groffmom/Entities.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 88.8% 24 / 27 CC 3 SCAR 7.0
CC
3
Cov
95%
entity_to_num
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Groffmom.pm ↑ Summary Groffmom/Color.pm »
1 package Pod::Parser::Groffmom::Entities;
2  
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Pod::Parser::Groffmom::Entities - Internal entity conversions
9  
10 =head1 VERSION
11  
12 Version 0.042
13  
14 =head1 DESCRIPTION
15  
16 Most characters can be typed direclty into the POD documents you wish to
17 translate, but if you cannot type them, or if processing a document which
18 already has them, the following is our conversion list for named entities
19 entered into POD as C<EE<lt>entity_nameE<gt>>.
20  
21 List gleefully stolen from C<HTML::Entities>.
22  
23 =cut
24  
25 7 our $VERSION = '0.042';
26 7 $VERSION = eval $VERSION;
27  
28 7 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
29 7 our @EXPORT_OK = 'entity_to_num';
30 7 my %entity2char = (
31 amp => 38, # ampersand
32 gt => 62, # greater than
33 lt => 60, # less than
34 quot => 34, # double quote
35 apos => 39, # single quote
36  
37 # PUBLIC ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML
38 AElig => 198, # capital AE diphthong (ligature)
39 Aacute => 193, # capital A, acute accent
40 Acirc => 194, # capital A, circumflex accent
41 Agrave => 192, # capital A, grave accent
42 Aring => 197, # capital A, ring
43 Atilde => 195, # capital A, tilde
44 Auml => 196, # capital A, dieresis or umlaut mark
45 Ccedil => 199, # capital C, cedilla
46 ETH => 208, # capital Eth, Icelandic
47 Eacute => 201, # capital E, acute accent
48 Ecirc => 202, # capital E, circumflex accent
49 Egrave => 200, # capital E, grave accent
50 Euml => 203, # capital E, dieresis or umlaut mark
51 Iacute => 205, # capital I, acute accent
52 Icirc => 206, # capital I, circumflex accent
53 Igrave => 204, # capital I, grave accent
54 Iuml => 207, # capital I, dieresis or umlaut mark
55 Ntilde => 209, # capital N, tilde
56 Oacute => 211, # capital O, acute accent
57 Ocirc => 212, # capital O, circumflex accent
58 Ograve => 210, # capital O, grave accent
59 Oslash => 216, # capital O, slash
60 Otilde => 213, # capital O, tilde
61 Ouml => 214, # capital O, dieresis or umlaut mark
62 THORN => 222, # capital THORN, Icelandic
63 Uacute => 218, # capital U, acute accent
64 Ucirc => 219, # capital U, circumflex accent
65 Ugrave => 217, # capital U, grave accent
66 Uuml => 220, # capital U, dieresis or umlaut mark
67 Yacute => 221, # capital Y, acute accent
68 aacute => 225, # small a, acute accent
69 acirc => 226, # small a, circumflex accent
70 aelig => 230, # small ae diphthong (ligature)
71 agrave => 224, # small a, grave accent
72 aring => 229, # small a, ring
73 atilde => 227, # small a, tilde
74 auml => 228, # small a, dieresis or umlaut mark
75 ccedil => 231, # small c, cedilla
76 eacute => 233, # small e, acute accent
77 ecirc => 234, # small e, circumflex accent
78 egrave => 232, # small e, grave accent
79 eth => 240, # small eth, Icelandic
80 euml => 235, # small e, dieresis or umlaut mark
81 iacute => 237, # small i, acute accent
82 icirc => 238, # small i, circumflex accent
83 igrave => 236, # small i, grave accent
84 iuml => 239, # small i, dieresis or umlaut mark
85 ntilde => 241, # small n, tilde
86 oacute => 243, # small o, acute accent
87 ocirc => 244, # small o, circumflex accent
88 ograve => 242, # small o, grave accent
89 oslash => 248, # small o, slash
90 otilde => 245, # small o, tilde
91 ouml => 246, # small o, dieresis or umlaut mark
92 szlig => 223, # small sharp s, German (sz ligature)
93 thorn => 254, # small thorn, Icelandic
94 uacute => 250, # small u, acute accent
95 ucirc => 251, # small u, circumflex accent
96 ugrave => 249, # small u, grave accent
97 uuml => 252, # small u, dieresis or umlaut mark
98 yacute => 253, # small y, acute accent
99 yuml => 255, # small y, dieresis or umlaut mark
100  
101 # Some extra Latin 1 chars that are listed in the HTML3.2 draft (21-May-96)
102 copy => 169, # copyright sign
103 reg => 174, # registered sign
104 nbsp => 160, # non breaking space
105  
106 # Additional ISO-8859/1 entities listed in rfc1866 (section 14)
107 iexcl => 161,
108 cent => 162,
109 pound => 163,
110 curren => 164,
111 yen => 165,
112 brvbar => 166,
113 sect => 167,
114 uml => 168,
115 ordf => 170,
116 laquo => 171,
117 not => 172, # not is a keyword in perl
118 shy => 173,
119 macr => 175,
120 deg => 176,
121 plusmn => 177,
122 sup1 => 185,
123 sup2 => 178,
124 sup3 => 179,
125 acute => 180,
126 micro => 181,
127 para => 182,
128 middot => 183,
129 cedil => 184,
130 ordm => 186,
131 raquo => 187,
132 frac14 => 188,
133 frac12 => 189,
134 frac34 => 190,
135 iquest => 191,
136 times => 215, # times is a keyword in perl
137 divide => 247,
138 OElig => 338,
139 oelig => 339,
140 Scaron => 352,
141 scaron => 353,
142 Yuml => 376,
143 fnof => 402,
144 circ => 710,
145 tilde => 732,
146 Alpha => 913,
147 Beta => 914,
148 Gamma => 915,
149 Delta => 916,
150 Epsilon => 917,
151 Zeta => 918,
152 Eta => 919,
153 Theta => 920,
154 Iota => 921,
155 Kappa => 922,
156 Lambda => 923,
157 Mu => 924,
158 Nu => 925,
159 Xi => 926,
160 Omicron => 927,
161 Pi => 928,
162 Rho => 929,
163 Sigma => 931,
164 Tau => 932,
165 Upsilon => 933,
166 Phi => 934,
167 Chi => 935,
168 Psi => 936,
169 Omega => 937,
170 alpha => 945,
171 beta => 946,
172 gamma => 947,
173 delta => 948,
174 epsilon => 949,
175 zeta => 950,
176 eta => 951,
177 theta => 952,
178 iota => 953,
179 kappa => 954,
180 lambda => 955,
181 mu => 956,
182 nu => 957,
183 xi => 958,
184 omicron => 959,
185 pi => 960,
186 rho => 961,
187 sigmaf => 962,
188 sigma => 963,
189 tau => 964,
190 upsilon => 965,
191 phi => 966,
192 chi => 967,
193 psi => 968,
194 omega => 969,
195 thetasym => 977,
196 upsih => 978,
197 piv => 982,
198 ensp => 8194,
199 emsp => 8195,
200 thinsp => 8201,
201 zwnj => 8204,
202 zwj => 8205,
203 lrm => 8206,
204 rlm => 8207,
205 ndash => 8211,
206 mdash => 8212,
207 lsquo => 8216,
208 rsquo => 8217,
209 sbquo => 8218,
210 ldquo => 8220,
211 rdquo => 8221,
212 bdquo => 8222,
213 dagger => 8224,
214 Dagger => 8225,
215 bull => 8226,
216 hellip => 8230,
217 permil => 8240,
218 prime => 8242,
219 Prime => 8243,
220 lsaquo => 8249,
221 rsaquo => 8250,
222 oline => 8254,
223 frasl => 8260,
224 euro => 8364,
225 image => 8465,
226 weierp => 8472,
227 real => 8476,
228 trade => 8482,
229 alefsym => 8501,
230 larr => 8592,
231 uarr => 8593,
232 rarr => 8594,
233 darr => 8595,
234 harr => 8596,
235 crarr => 8629,
236 lArr => 8656,
237 uArr => 8657,
238 rArr => 8658,
239 dArr => 8659,
240 hArr => 8660,
241 forall => 8704,
242 part => 8706,
243 exist => 8707,
244 empty => 8709,
245 nabla => 8711,
246 isin => 8712,
247 notin => 8713,
248 ni => 8715,
249 prod => 8719,
250 sum => 8721,
251 minus => 8722,
252 lowast => 8727,
253 radic => 8730,
254 prop => 8733,
255 infin => 8734,
256 ang => 8736,
257 and => 8743,
258 or => 8744,
259 cap => 8745,
260 cup => 8746,
261 int => 8747,
262 there4 => 8756,
263 sim => 8764,
264 cong => 8773,
265 asymp => 8776,
266 ne => 8800,
267 equiv => 8801,
268 le => 8804,
269 ge => 8805,
270 sub => 8834,
271 sup => 8835,
272 nsub => 8836,
273 sube => 8838,
274 supe => 8839,
275 oplus => 8853,
276 otimes => 8855,
277 perp => 8869,
278 sdot => 8901,
279 lceil => 8968,
280 rceil => 8969,
281 lfloor => 8970,
282 rfloor => 8971,
283 lang => 9001,
284 rang => 9002,
285 loz => 9674,
286 spades => 9824,
287 clubs => 9827,
288 hearts => 9829,
289 diams => 9830,
290 );
291  
292 4 ▶sub entity_to_num {
Subroutine entity_to_num: called CC=3 SCAR=11.1
Pod undocumented
293 4 my $entity = shift;
294 4 ▶ return $entity if $entity =~ /^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
if $entity =~ /^\d+$/ 2 2 4
295 2 ▶ return $entity2char{$entity} || '';
Condition50%1/2
$entity2char{$entity} || ''
l!l
20
MC/DC0%0/1
$entity2char{$entity} || ''
$entity2char{$entity}
Truth table50%1/2
A
A= $entity2char{$entity}
Aresult
11
00
296 }
297  
298 7 1;
299  
300 __END__
« Groffmom.pm ↑ Summary Groffmom/Color.pm »