* Replace all spacing characters in data with spaces. As a special * case, this collapses a newline with the previous space, if possible. */
| 340 | * case, this collapses a newline with the previous space, if possible. |
| 341 | */ |
| 342 | static void |
| 343 | replace_spacing(hoedown_buffer *ob, const uint8_t *data, size_t size) |
| 344 | { |
| 345 | size_t i = 0, mark; |
| 346 | hoedown_buffer_grow(ob, size); |
| 347 | while (1) { |
| 348 | mark = i; |
| 349 | while (i < size && data[i] != '\n') i++; |
| 350 | hoedown_buffer_put(ob, data + mark, i - mark); |
| 351 | |
| 352 | if (i >= size) break; |
| 353 | |
| 354 | if (!(i > 0 && data[i-1] == ' ')) |
| 355 | hoedown_buffer_putc(ob, ' '); |
| 356 | i++; |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | /**************************** |
| 361 | * INLINE PARSING FUNCTIONS * |
no test coverage detected