Skip to content

Commit

Permalink
[data_scanner] fix DT_H1 detection
Browse files Browse the repository at this point in the history
Fix a broken refactor
  • Loading branch information
tstack committed Oct 7, 2022
1 parent 016bca0 commit 8391de3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/document.sections.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ class structure_walker {
metadata walk()
{
metadata_builder mb;
data_token_t dt = DT_INVALID;
size_t garbage_count = 0;

while (garbage_count < 1000) {
Expand All @@ -260,6 +259,7 @@ class structure_walker {
break;
}

auto dt = tokenize_res->tr_token;
element el(tokenize_res->tr_token, tokenize_res->tr_capture);

switch (dt) {
Expand Down
1 change: 1 addition & 0 deletions src/file_vtab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ CREATE TABLE lnav_file (
loo.loo_include_in_session = true;
this->lf_collection.fc_file_names[path] = std::move(loo);
lf->set_filename(path);
this->lf_collection.regenerate_unique_file_names();

init_session();
load_session();
Expand Down
2 changes: 1 addition & 1 deletion src/text_format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ detect_text_format(string_fragment sf,
static const auto MARKDOWN_EXT = ghc::filesystem::path(".markdown");

static const auto MAN_MATCHERS = lnav::pcre2pp::code::from_const(
R"(^[A-Z]+\(\d\)\s+)", PCRE2_MULTILINE);
R"(^[A-Za-z][A-Za-z\-_\+0-9]+\(\d\)\s+)", PCRE2_MULTILINE);

// XXX This is a pretty crude way of detecting format...
static const auto PYTHON_MATCHERS = lnav::pcre2pp::code::from_const(
Expand Down
1 change: 1 addition & 0 deletions test/document.sections.tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ DESCRIPTION

auto meta = lnav::document::discover_structure(INPUT, line_range{0, -1});

CHECK(meta.m_sections_root->hn_named_children.size() == 3);
meta.m_sections_tree.visit_all([](const auto& intv) {
auto ser = intv.value.match(
[](const std::string& name) { return name; },
Expand Down

0 comments on commit 8391de3

Please sign in to comment.