keenwrite
keenwrite copied to clipboard
Create node visitor for each type of document to process
The MainWindow::spellcheck
method performs a spellcheck presuming that the document is Markdown. This isn't always the case: sometimes the document is XML-based. This currently causes no harm because the spellcheck functionality will not operate on XML documents.
Resolving this issue as follows:
- Create a text visitor interface that can, given a document (either complete or partial), extract the textual content from each node.
- Implement the visitor interface for Markdown, R Markdown, XML, and R XML.
- Instantiate the visitor that corresponds to the file type being edited.
- Remove the hard-coded parser from
MainWindow
. - Remove the
TextVisitor
class fromMainWindow
. - Reuse the Markdown Parser from the processor for the Markdown-specific
TextVisitor
.