summaryrefslogtreecommitdiff
path: root/src/blocks.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-28 17:52:09 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-28 17:52:09 -0800
commit19a3a5ea4f73e8757b6d208f3be003bc2828e752 (patch)
tree9baf713277778e6812ae4a9b73425a18c1fe2d69 /src/blocks.c
parentd19558961c1b579ddb2f5c62f1b6a65be3324333 (diff)
Added end_column to cmark_node struct.
API exports cmark_node_get_column. XML writer indicates start and end line and column for block-level nodes.
Diffstat (limited to 'src/blocks.c')
-rw-r--r--src/blocks.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/blocks.c b/src/blocks.c
index 7b676b7..0caa4a5 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -64,6 +64,7 @@ cmark_parser *cmark_parser_new()
parser->current = document;
parser->line_number = 0;
parser->curline = line;
+ parser->last_line_length = 0;
parser->linebuf = buf;
return parser;
@@ -198,6 +199,8 @@ finalize(cmark_parser *parser, cmark_node* b)
b->end_line = parser->line_number;
}
+ b->end_column = parser->last_line_length - 1; // -1 because of newline
+
switch (b->type) {
case NODE_PARAGRAPH:
while (cmark_strbuf_at(&b->string_content, 0) == '[' &&
@@ -853,6 +856,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes)
parser->current = container;
}
+ parser->last_line_length = parser->curline->size;
cmark_strbuf_clear(parser->curline);
}