Fix headlines parsing and count depth from 0
This commit is contained in:
parent
e65618de08
commit
bb9a2da276
1 changed files with 3 additions and 3 deletions
|
|
@ -50,7 +50,7 @@ namespace sextant
|
|||
|
||||
struct headline_depth
|
||||
{
|
||||
static constexpr auto rule = dsl::list(dsl::capture(dsl::lit_c<'*'>)) + dsl::ascii::space;
|
||||
static constexpr auto rule = dsl::list(dsl::capture(dsl::lit_c<'*'>)) + dsl::ascii::blank;
|
||||
static constexpr auto value = lexy::as_string<std::string>;
|
||||
};
|
||||
|
||||
|
|
@ -58,10 +58,10 @@ namespace sextant
|
|||
{
|
||||
static constexpr auto rule = dsl::p<headline_depth> + dsl::p<line>;
|
||||
static constexpr auto value = lexy::callback<cl_object>([](std::string&& depth, lexy::nullopt&&) {
|
||||
return ast_funcall("MAKE-ORG-HEADLINE", depth.size(), "", depth, "");
|
||||
return ast_funcall("MAKE-ORG-HEADLINE", depth.size() - 1, "", depth, "");
|
||||
},
|
||||
[](std::string&& depth, text_line&& line) {
|
||||
return ast_funcall ("MAKE-ORG-HEADLINE", depth.size(), to_u32string(line.text), to_u32string(depth + " " + line.text), line.eol);
|
||||
return ast_funcall ("MAKE-ORG-HEADLINE", depth.size() - 1, to_u32string(line.text), to_u32string(depth + " " + line.text), line.eol);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue