| 132 | // Block Element Callbacks |
| 133 | |
| 134 | void Parser::handleBlock(Type type, struct buf *ob, struct buf *text, int extra) { |
| 135 | Element block; |
| 136 | block.setType(type); |
| 137 | |
| 138 | if (type == HEADER) { |
| 139 | char levelStr[2]; |
| 140 | snprintf(levelStr, 2, "%d", extra); |
| 141 | block.addAttribute("level", levelStr); |
| 142 | } |
| 143 | |
| 144 | std::string textString(text->data, text->data + text->size); |
| 145 | std::vector<std::string> strs; |
| 146 | boost::split(strs, textString, boost::is_any_of("|")); |
| 147 | |
| 148 | for(vector<std::string>::iterator it = strs.begin(); it != strs.end(); it++) { |
| 149 | int pos = atoi((*it).c_str()); |
| 150 | std::map<int, Element>::iterator elit = elementSoup.find(pos); |
| 151 | |
| 152 | if ( elit != elementSoup.end() ) { |
| 153 | block.append((*elit).second); |
| 154 | elementSoup.erase(pos); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | elementCount++; |
| 159 | |
| 160 | std::ostringstream oss; |
| 161 | oss << elementCount; |
| 162 | elementSoup[elementCount] = block; |
| 163 | oss << '|'; |
| 164 | bufputs(ob, oss.str().c_str()); |
| 165 | } |
| 166 | |
| 167 | void Parser::parsedBlockCode(struct buf *ob, struct buf *text) { |
| 168 | parsedNormalText(ob, text); |
nothing calls this directly
no test coverage detected