diff options
author | Andreas Krennmair <ak@synflood.at> | 2007-03-07 12:08:12 +0000 |
---|---|---|
committer | Andreas Krennmair <ak@synflood.at> | 2007-03-07 12:08:12 +0000 |
commit | 5fe726369822f0b700a3ce0ef1b6f27cb63feaa4 (patch) | |
tree | 444257f539adbb790dd80cb80e6a99e60ba259c9 | |
parent | f1e61f27da6afaf8ac03b229d7443b10a3014ac0 (diff) |
Andreas Krennmair:
filled table with Latin1 HTML entities
fixed image counter
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/htmlrenderer.cpp | 5 | ||||
-rw-r--r-- | src/xmlpullparser.cpp | 99 |
3 files changed, 98 insertions, 8 deletions
@@ -6,7 +6,6 @@ TODO: - implement podcast support - test more thoroughly - implement "start player" function in podbeuter. -- fill table with html entities - do entitity decoding for titles (this may be controversial...) - implement planet support - create examples @@ -82,3 +81,4 @@ DONE: - planet-limit 50 (display the 50 latest articles) - implement template system - write documentation +- fill table with html entities diff --git a/src/htmlrenderer.cpp b/src/htmlrenderer.cpp index f51f5a95..306f289d 100644 --- a/src/htmlrenderer.cpp +++ b/src/htmlrenderer.cpp @@ -55,6 +55,7 @@ void htmlrenderer::add_link(std::vector<std::string>& links, const std::string& void htmlrenderer::render(std::istream& input, std::vector<std::string>& lines, std::vector<std::string>& links, const std::string& url) { unsigned int link_count = 0; + unsigned int image_count = 0; std::string curline; int indent_level = 0; bool inside_list = false, inside_li = false, is_ol = false, inside_pre = false; @@ -106,8 +107,8 @@ void htmlrenderer::render(std::istream& input, std::vector<std::string>& lines, if (imgurl.length() > 0) { add_link(imglinks,absolute_url(url,imgurl)); std::ostringstream ref; - ref << "[" << _("image") << " " << link_count << "]"; - link_count++; + ref << "[" << _("image") << " " << image_count << "]"; + image_count++; curline.append(ref.str()); } } else if (xpp.getText() == "blockquote") { diff --git a/src/xmlpullparser.cpp b/src/xmlpullparser.cpp index fd18f745..5ebacfce 100644 --- a/src/xmlpullparser.cpp +++ b/src/xmlpullparser.cpp @@ -297,14 +297,103 @@ static struct { char * entity; unsigned int value; } entity_table[] = { - /* TODO: fill table */ - /* a good starting point is this website: http://htmlhelp.com/reference/html40/entities/latin1.html */ - { "auml", 228 }, - { "ouml", 246 }, - { "uuml", 252 }, + // this table was created with some vim regex magic from the this list: http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html + { "nbsp", 160 }, + { "iexcl", 161 }, + { "cent", 162 }, + { "pound", 163 }, + { "curren", 164 }, + { "yen", 165 }, + { "brvbar", 166 }, + { "sect", 167 }, + { "uml", 168 }, + { "copy", 169 }, + { "ordf", 170 }, + { "laquo", 171 }, + { "not", 172 }, + { "shy", 173 }, + { "reg", 174 }, + { "macr", 175 }, + { "deg", 176 }, + { "plusmn", 177 }, + { "sup2", 178 }, + { "sup3", 179 }, + { "acute", 180 }, + { "micro", 181 }, + { "para", 182 }, + { "middot", 183 }, + { "cedil", 184 }, + { "sup1", 185 }, + { "ordm", 186 }, + { "raquo", 187 }, + { "frac14", 188 }, + { "frac12", 189 }, + { "frac34", 190 }, + { "iquest", 191 }, + { "Agrave", 192 }, + { "Aacute", 193 }, + { "Acirc", 194 }, + { "Atilde", 195 }, { "Auml", 196 }, + { "Aring", 197 }, + { "AElig", 198 }, + { "Ccedil", 199 }, + { "Egrave", 200 }, + { "Eacute", 201 }, + { "Ecirc", 202 }, + { "Euml", 203 }, + { "Igrave", 204 }, + { "Iacute", 205 }, + { "Icirc", 206 }, + { "Iuml", 207 }, + { "ETH", 208 }, + { "Ntilde", 209 }, + { "Ograve", 210 }, + { "Oacute", 211 }, + { "Ocirc", 212 }, + { "Otilde", 213 }, { "Ouml", 214 }, + { "times", 215 }, + { "Oslash", 216 }, + { "Ugrave", 217 }, + { "Uacute", 218 }, + { "Ucirc", 219 }, { "Uuml", 220 }, + { "Yacute", 221 }, + { "THORN", 222 }, + { "szlig", 223 }, + { "agrave", 224 }, + { "aacute", 225 }, + { "acirc", 226 }, + { "atilde", 227 }, + { "auml", 228 }, + { "aring", 229 }, + { "aelig", 230 }, + { "ccedil", 231 }, + { "egrave", 232 }, + { "eacute", 233 }, + { "ecirc", 234 }, + { "euml", 235 }, + { "igrave", 236 }, + { "iacute", 237 }, + { "icirc", 238 }, + { "iuml", 239 }, + { "eth", 240 }, + { "ntilde", 241 }, + { "ograve", 242 }, + { "oacute", 243 }, + { "ocirc", 244 }, + { "otilde", 245 }, + { "ouml", 246 }, + { "divide", 247 }, + { "oslash", 248 }, + { "ugrave", 249 }, + { "uacute", 250 }, + { "ucirc", 251 }, + { "uuml", 252 }, + { "yacute", 253 }, + { "thorn", 254 }, + { "yuml", 255 }, { 0, 0 } }; |