FIXED: Improve performance of checking document for metadata, which improves performance when checking for possible transclusion

This commit is contained in:
Fletcher T. Penney 2017-03-06 14:50:39 -05:00
parent d7dd66f6dc
commit d26d2e8668
4 changed files with 403 additions and 438 deletions

View File

@ -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)

View File

@ -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

View File

@ -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]+;