Major clean up and improvements to vimwiki compatibility and documentation.
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! Vimwiki parser.
|
||||
//!
|
||||
//! Hand-rolled recursive-descent over `Vec<VimwikiToken>` (SPEC.md §6.7).
|
||||
//! Hand-rolled recursive-descent over `Vec<VimwikiToken>`.
|
||||
//! Resilient: never aborts the document. Anything the dispatcher can't
|
||||
//! claim becomes a `BlockNode::Error(ErrorNode)` so progress is
|
||||
//! guaranteed.
|
||||
@@ -28,7 +28,7 @@
|
||||
//!
|
||||
//! `[[ ]]` payloads are inspected to choose between `WikiLinkNode`
|
||||
//! (the default) and `ExternalLinkNode` (when the target is a URL). The
|
||||
//! `LinkTarget` enum follows SPEC §9: leading `/` is root-relative,
|
||||
//! `LinkTarget` enum follows the vimwiki conventions: leading `/` is root-relative,
|
||||
//! `//` is filesystem-absolute, `wiki<N>:` / `wn.<Name>:` are interwiki,
|
||||
//! `diary:` / `file:` / `local:` are their own kinds, and a trailing `/`
|
||||
//! marks a directory link.
|
||||
@@ -69,10 +69,10 @@ impl Parser for VimwikiParser {
|
||||
struct ParseState<'a> {
|
||||
toks: &'a [VimwikiToken],
|
||||
pos: usize,
|
||||
/// Phase 12: count of `HeadingNode`s already pushed to `children`.
|
||||
/// Count of `HeadingNode`s already pushed to `children`.
|
||||
/// `headings_seen - 1` is the most recent heading's index.
|
||||
headings_seen: usize,
|
||||
/// Phase 12: source line of the most recently-emitted heading.
|
||||
/// Source line of the most recently-emitted heading.
|
||||
/// `tag_line - last_heading_line ∈ {1, 2}` is a header-scope tag.
|
||||
last_heading_line: Option<u32>,
|
||||
}
|
||||
@@ -141,7 +141,7 @@ impl<'a> ParseState<'a> {
|
||||
}
|
||||
let before = self.pos;
|
||||
let block = self.parse_block();
|
||||
// Phase 12: file-scope tags get accumulated into metadata so
|
||||
// File-scope tags get accumulated into metadata so
|
||||
// callers can read page-level tag membership without walking
|
||||
// the AST. The TagNode itself stays in `children` so renderers
|
||||
// see it too.
|
||||
@@ -280,7 +280,7 @@ impl<'a> ParseState<'a> {
|
||||
let inline = parse_inline_seq(&self.toks[inline_start..self.pos]);
|
||||
self.advance();
|
||||
self.eat_newline();
|
||||
// Record for tag-scope resolution (Phase 12).
|
||||
// Record for tag-scope resolution.
|
||||
self.headings_seen += 1;
|
||||
self.last_heading_line = Some(span_end.line);
|
||||
return BlockNode::Heading(HeadingNode {
|
||||
|
||||
Reference in New Issue
Block a user