| 198 | // Span Element Callbacks |
| 199 | |
| 200 | void Parser::handleSpan(Type type, struct buf *ob, struct buf *text, struct buf *extra, struct buf *extra2) { |
| 201 | |
| 202 | std::vector<std::string> strs; |
| 203 | std::string textString; |
| 204 | if (text) { |
| 205 | textString = std::string(text->data, text->data + text->size); |
| 206 | boost::split(strs, textString, boost::is_any_of("|")); |
| 207 | } |
| 208 | if (strs.size() > 0) { |
| 209 | int pos = atoi(strs[0].c_str()); |
| 210 | std::map<int, Element>::iterator elit = elementSoup.find(pos); |
| 211 | |
| 212 | Element element = elit->second; |
| 213 | element.setType(type); |
| 214 | |
| 215 | if (extra != NULL && extra->size) { |
| 216 | if (element.getType() == LINK) { |
| 217 | element.addAttribute("link", std::string(extra->data, extra->data + extra->size)); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | if (extra2 != NULL && extra2->size) { |
| 222 | if (element.getType() == LINK) { |
| 223 | element.addAttribute("title", std::string(extra2->data, extra2->data + extra2->size)); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | elementSoup.erase(pos); |
| 228 | elementSoup[pos] = element; |
| 229 | |
| 230 | bufputs(ob, textString.c_str()); |
| 231 | } |
| 232 | else { |
| 233 | Element element; |
| 234 | element.setType(type); |
| 235 | |
| 236 | createSpan(element, ob); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | void Parser::createSpan(const Element& element, struct buf *ob) { |
| 241 | elementCount++; |
nothing calls this directly
no test coverage detected