aboutsummaryrefslogtreecommitdiff
path: root/src/blocks.c
AgeCommit message (Collapse)Author
2015-01-18Readjust parser->current after closing fenced block.John MacFarlane
Added assertion to raise an error if finalize is called on a closed block (as was happening undetected because of the fallback behavior).
2015-01-17Removed some unneeded tests (code clarity).John MacFarlane
2015-01-17Small code clarification.John MacFarlane
2015-01-17Put check for fence close with the other checks for end-of-block.John MacFarlane
This is a more logical arrangement and follows recent changes to the JS implementation.
2015-01-16Fixed #285 in cmark.John MacFarlane
2015-01-16Nonrecursive rewrite of ends_with_blank_line.John MacFarlane
Closes #286.
2015-01-16Renamed parameters cmark_node -> node.John MacFarlane
Minor code reformatting: This corrects an overzealous global replace from earlier.
2015-01-05Reformatted code consistently with astyle.John MacFarlane
2014-12-29Added cmark_ prefix to functions in cmark_ctype.John MacFarlane
2014-12-29Added cmark_ctype.h with locale-independent isspace, ispunct, etc.John MacFarlane
Otherwise cmark's behavior varies unpredictably with the locale. `is_punctuation` in utf8.h has also been adjusted so that everything that counts all ASCII symbol characters count as punctuation, even though some are not in P* character classes.
2014-12-28Improved end column/end line calculations in finalize.John MacFarlane
2014-12-28Added end_column to cmark_node struct.John MacFarlane
API exports cmark_node_get_column. XML writer indicates start and end line and column for block-level nodes.
2014-12-28blocks.c - removed unneeded start_line parameter from make_block.John MacFarlane
2014-12-28blocks.c: removed redundant line_number param in finalize.John MacFarlane
Also break_out_of_lists.
2014-12-28Rename CMARK_NODE_LIST_ITEM -> CMARK_NODE_ITEM.John MacFarlane
2014-12-16Added 'literal' field to 'code' struct.John MacFarlane
In the last few commits we were using as.code.fenced and as.literal at the same time for NODE_CODE_BLOCK, which obviously led to problems.
2014-12-15Re-added cmark_ prefix to strbuf and chunk.John MacFarlane
Reverts 225d720.
2014-12-14Use cmark_iter to avoid stack allocation in process_inlines.John MacFarlane
2014-12-14Use chunk for fenced code info, instead of strbuf.John MacFarlane
2014-12-14Use as.literal instead of string_content for HTML and code blocks.John MacFarlane
This is for consistency with the other types of nodes that have literal strings as contents.
2014-12-13Remove CMARK_NODE_REFERENCE_DEF from API.John MacFarlane
Modified finalize in blocks.c to return parent of finalized block, so we can handle the case of reference definitions, when we simply remove the finalized block.
2014-12-13Removed cmark_ prefix on chunk and strbuf.John MacFarlane
This isn't needed any more since we don't expose these in the API.
2014-12-12Revert "Removed CMARK_NODE_REFERENCE_DEF from API."John MacFarlane
This reverts commit b598b52a4acdc2332be3d34e30237d1b93b7dd03. The change led to some problems, because some of the callers of 'finalize' expected the node to exist after the call. This could all be rewritten, but for now let's just revert.
2014-12-12Removed CMARK_NODE_REFERENCE_DEF from API.John MacFarlane
There's no reason to store these empty nodes in the API. The references have already been resolved.
2014-12-08Fix last_line_blank logicNick Wellnhofer
The broken last_line_blank logic could lead to random failures in the API tests.
2014-12-04Moved source files from src/html into src.John MacFarlane
The separate directory presents problems for some simple extension building systems, like luarocks.
2014-12-02Fix EOF detectionNick Wellnhofer
Fixes issue with Ctrl-D having to be pressed twice when reading from terminal.
2014-11-30Renamed cmark_parser_push -> cmark_parser_feed.John MacFarlane
2014-11-29Push parser interfaceNick Wellnhofer
Replace cmark_parser_process_line with cmark_parser_push that takes arbitrary chunks of data. Also fixes #211.
2014-11-28Renamed identifiers in public API:John MacFarlane
cmark_doc_parser => cmark_parser cmark_new_doc_parser => cmark_parser_new cmark_free_doc_parser => cmark_parser_free cmark_finish => cmark_parser_finish cmark_process_line => cmark_parser_process_line cmark_node_destroy => cmark_node_free Closes #223.
2014-11-28Avoid potential memory leak.John MacFarlane
Previously, if malloc failed to allocate 'newstack', the function would return without freeing 'stack'. Pointed out by clang static analyzer.
2014-11-28Removed unnecessary assignment.John MacFarlane
Clang static analyzer pointed out that the value assigned to 'pos' is never read.
2014-11-28Use prefixed names for symbols from references.hNick Wellnhofer
2014-11-28Use prefixed names for symbols from inlines.hNick Wellnhofer
2014-11-24Cast void* for MSVC compatibilityNick Wellnhofer
2014-11-23Added 'fenced' flag to cmark_code struct, renamed from cmark_fenced_code.John MacFarlane
Technically we could do without this, since we can check for cmark_fence_length > 0. But it makes the code clearer and doesn't really increase the size of the node struct (because the size of the union is set by the data for lists).
2014-11-23Added internal flag to distinguish setext from atx headers.John MacFarlane
2014-11-23Do not distinguish btw fenced and indented code in AST.John MacFarlane
Use a single CMARK_NODE_CODE_BLOCK tag for both. Distinguish them when needed for parsing by looking at the fence_length attribute, which is 0 for indented blocks.
2014-11-23Revert "Revert "Remove distinction btw atx and setext header in AST.""John MacFarlane
This reverts commit 4570eb2bff2e1b71fa5b6408abbc69c98ff5ff24.
2014-11-23Fix segfault on docs without trailing newlineNick Wellnhofer
2014-11-22Revert "Remove distinction btw atx and setext header in AST."John MacFarlane
This reverts commit a71423f6ee1b77d9f79d42599ea00b4ca99f5da0. Not quite sure about this change, so reverting for now. Note that we still have a distinction between fenced and indented code blocks in the AST. These two distinctions seem to stand or fall together.
2014-11-22Remove distinction btw atx and setext header in AST.John MacFarlane
Now we just have 'header' -- Setext and ATX are just two ways of forming these; it's not a semantic difference that should remain in the AST.
2014-11-22Renamed NODE_BQUOTE -> NODE_BLOCK_QUOTE.John MacFarlane
2014-11-22Fixed #192.John MacFarlane
The C and JS implementations were not registering blank lines after atx headers for purposes of tight/loose list calculation. Exmaple: * item * # block1 ## block2
2014-11-22Updated JS and C implementations for #209.John MacFarlane
A setext header was being treated a if it were a blank line for purposes of tight/loose list determination. Closes #209.
2014-11-22Make parser accept a char*Nick Wellnhofer
2014-11-22Fix and test node_checkNick Wellnhofer
2014-11-17Make parse_inlines add directly to parent.John MacFarlane
Previously parse_inlines returned a list of parsed inlines. This had to be added to the parent, and fix_parents had to be called to manually add the 'parent' links to the children, and the 'last_child' link to the parent. Now parse_inlines takes the parent block as a parameter, and uses cmark_node_append_child to add the children, so that the pointers should be properly managed. This avoids the need for the fix_parents pass.
2014-11-17Set prev, parent and last_child for inlinesNick Wellnhofer
2014-11-17Rename ast.h to parser.hNick Wellnhofer