Revision 5167
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/tnrs.py | ||
---|---|---|
66 | 66 |
|
67 | 67 |
padding = ' !pad ' # prepend to empty and whitespace-only strings |
68 | 68 |
encode_map = [ |
69 |
('!', ' !exc '), # escape char |
|
70 |
('\t', ' !tab '), |
|
71 |
('\n', ' !nl '), |
|
72 |
('\r', ' !cr '), |
|
73 |
('%', ' !pct '), |
|
74 |
(';', ' !sem '), |
|
75 |
('\\', ' !bsl '), |
|
69 |
('!', ' !exc '), # our escape char
|
|
70 |
('\t', ' !tab '), # TNRS replaces with " "
|
|
71 |
('\n', ' !nl '), # used to separate multiple names
|
|
72 |
('\r', ' !cr '), # used to separate multiple names
|
|
73 |
('%', ' !pct '), # TNRS URL-decodes it in matched fields
|
|
74 |
(';', ' !sem '), # changes TNRS response format
|
|
75 |
('\\', ' !bsl '), # TNRS removes it
|
|
76 | 76 |
('_', ' !und '), # TNRS replaces with " " |
77 | 77 |
] |
78 | 78 |
decode_map = strings.flip_map(encode_map) |
Also available in: Unified diff
tnrs.py: encode_map: Documented why each character needs to be encoded