mirror of
https://github.com/fletcher/MultiMarkdown-6.git
synced 2024-10-04 10:37:08 +03:00
FIXED: Improve performance of checking document for metadata, which improves performance when checking for possible transclusion
This commit is contained in:
parent
d7dd66f6dc
commit
d26d2e8668
@ -567,6 +567,6 @@ ADD_MMD_TEST(mmd-6-latex "-t latex" MMD6Tests tex)
|
||||
|
||||
ADD_MMD_TEST(mmd-6-odf "-t odf" MMD6Tests fodt)
|
||||
|
||||
ADD_MMD_TEST(pathologic "" ../build html)
|
||||
|
||||
ADD_MMD_TEST(pathologic-compat "-c" ../build html)
|
||||
|
||||
ADD_MMD_TEST(pathologic "" ../build html)
|
||||
|
@ -1830,6 +1830,14 @@ void mmd_engine_parse_string(mmd_engine * e) {
|
||||
bool mmd_has_metadata(mmd_engine * e, size_t * end) {
|
||||
bool result = false;
|
||||
|
||||
if (!(scan_meta_line(&e->dstr->str[0]))) {
|
||||
// First line is not metadata, so can't have metadata
|
||||
// Saves the time of an unnecessary parse
|
||||
// TODO: Need faster confirmation of actual metadata than full tokenizing
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Free existing parse tree
|
||||
if (e->root)
|
||||
token_tree_free(e->root);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -136,7 +136,7 @@
|
||||
|
||||
fence_end = non_indent [`~]{3,} sp nl_eof;
|
||||
|
||||
meta_key = [A-Za-z0-9] [A-Za-z0-9_ -\.]*;
|
||||
meta_key = [A-Za-z0-9] [A-Za-z0-9_ \t\-\.]*;
|
||||
|
||||
meta_value = [^\n\r\x00]+;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user