Code to generate brief comments from full vdoc doccomments.
Code Map
//! Code to generate brief comments from full vdoc doccomments.
module diode.vdoc.brief;
//! A Markdown visitor that removes most of the special formating.
class PlainText : Visitor
{
public:
this(lineLimit: size_t) { }
fn visit(n: Text, sink: scope (Sink)) { }
fn visit(n: Code, sink: scope (Sink)) { }
fn visit(n: Softbreak, sink: scope (Sink)) { }
fn visit(n: Linebreak, sink: scope (Sink)) { }
fn enter(n: Link, sink: scope (Sink)) { }
fn leave(n: Link, sink: scope (Sink)) { }
fn enter(n: BlockQuote, sink: scope (Sink)) { }
fn enter(n: Item, sink: scope (Sink)) { }
fn enter(n: List, sink: scope (Sink)) { }
fn enter(n: Heading, sink: scope (Sink)) { }
fn leave(n: Paragraph, sink: scope (Sink)) { }
fn enter(n: Document, sink: scope (Sink)) { }
fn enter(n: Image, sink: scope (Sink)) { }
fn enter(n: Paragraph, sink: scope (Sink)) { }
fn enter(n: Strong, sink: scope (Sink)) { }
fn enter(n: Emph, sink: scope (Sink)) { }
fn leave(n: Document, sink: scope (Sink)) { }
fn leave(n: Strong, sink: scope (Sink)) { }
fn leave(n: Emph, sink: scope (Sink)) { }
fn leave(n: Image, sink: scope (Sink)) { }
fn leave(n: Heading, sink: scope (Sink)) { }
fn leave(n: Item, sink: scope (Sink)) { }
fn leave(n: List, sink: scope (Sink)) { }
fn leave(n: BlockQuote, sink: scope (Sink)) { }
fn visit(n: HtmlBlock, sink: scope (Sink)) { }
fn visit(n: CodeBlock, sink: scope (Sink)) { }
fn visit(n: ThematicBreak, sink: scope (Sink)) { }
fn visit(n: HtmlInline, sink: scope (Sink)) { }
protected:
//! Have we stopped processing text.
mStopped: bool;
//! Used to insert spaces between words and instead of softbreaks.
mWriteSpace: bool;
//! The current link that has not yet been flushed to the sink.
mNewLink: Link;
//! Link that has been flushed to the sink, and should be closed.
mAppliedLink: Link;
//! The current length of the line we are writing.
mLineLength: size_t;
//! Limit for the number of characters on a line.
mLineLimit: size_t;
protected:
//! Write a string to the sink, will compact whitespace and insert newlines
//! when the line will break the mLineLimit.
fn writeText(str: string, sink: scope (Sink)) { }
//! Flushes spaces and links to the sink.
fn flushThings(sink: scope (Sink)) { }
//! Inserts a newline and resets link.
fn insertNewLine(sink: scope (Sink)) { }
}
fn generateAutoBrief(str: string) string { }
A Markdown visitor that removes most of the special formating.
Stops outputing after the first text paragraph has been processed or any other block is encountred paragraph.
Have we stopped processing text.
Used to insert spaces between words and instead of softbreaks.
The current link that has not yet been flushed to the sink.
Link that has been flushed to the sink, and should be closed.
The current length of the line we are writing.
Limit for the number of characters on a line.
Parameters
lineLimit |
The number of characters that we should limit the lines we write to the sink to. |
Write a string to the sink, will compact whitespace and insert newlines when the line will break the mLineLimit.
Flushes spaces and links to the sink.
Inserts a newline and resets link.