Aliases
This section is empty.
Constants
Sum types
This section is empty.
Functions
fn ast_comment_to_doc_comment(ast_node v.ast.Comment) DocComment
ast_comment_to_doc_comment converts an ast.Comment
node type to a DocComment
fn ast_comments_to_doc_comments(ast_nodes []v.ast.Comment) []DocComment
ast_comments_to_doc_comments converts an array of ast.Comment
nodes to an array of DocComment
nodes
generate_from_mod generates a documentation from a specific module.
generate_with_pos has the same function as the generate
function but accepts an offset-based position and enables the comments by default.
lookup_module returns the result of the lookup_module_with_path
but with the current directory as the provided base lookup path.
lookup_module_with_path looks up the path of a given module name.
Throws an error if the module was not found.
merge_comments merges all the comment contents into a single text.
fn merge_doc_comments(comments []DocComment) string
merge_doc_comments merges all the comments starting from the last up to the first item of the array.
fn new_vdoc_preferences() &v.pref.Preferences
new_vdoc_preferences creates a new instance of pref.Preferences tailored for v.doc.
copy of pref.os_from_string
fn (mut nodes &[]DocNode) sort_by_name()
sort_by_name sorts the array based on the symbol names.
fn (mut nodes &[]DocNode) sort_by_kind()
sort_by_kind sorts the array based on the symbol kind.
Structs
pub struct DocComment {
pub mut:
text string // Raw text content of the comment, excluding the comment token chars ('//, /*, */')
is_multi bool // Is a block / multi-line comment
pos token.Pos
}
#fn (DocComment) is_example
fn (dc DocComment) is_example() bool
is_example returns true if the contents of this comment is an inline doc example.
The current convention is '// Example:
#fn (DocComment) example
fn (dc DocComment) example() string
example returns the content of the inline example body
#fn (DocComment) is_multi_line_example
fn (dc DocComment) is_multi_line_example() bool
is_multi_line_example returns true if an example line has no inline code
#fn (DocComment) has_triple_backtick
fn (dc DocComment) has_triple_backtick() bool
has_triple_backtick returns true if the comment starts or ends a markdown code block
pub struct Doc {
pub mut:
prefs &pref.Preferences = new_vdoc_preferences()
base_path string
table &ast.Table = ast.new_table()
checker checker.Checker = checker.Checker{
table: 0
pref: 0
}
fmt fmt.Fmt
filename string
pos int
pub_only bool = true
with_comments bool = true
with_pos bool
with_head bool = true
is_vlib bool
time_generated time.Time
head DocNode
contents map[string]DocNode
scoped_contents map[string]DocNode
parent_mod_name string
orig_mod_name string
extract_vars bool
filter_symbol_names []string
common_symbols []string
platform Platform
}
file_ast_with_pos has the same function as the file_ast
but instead returns a list of variables in a given offset-based position.
fn (mut d &Doc) generate() !
stmt_signature returns the signature of a given ast.Stmt
node.
stmt_name returns the name of a given ast.Stmt
node.
stmt_pub returns a boolean if a given ast.Stmt
node is exposed to the public.
type_to_str is a wrapper function around fmt.ast.type_to_str
.
expr_typ_to_string has the same function as Doc.typ_to_str
but for ast.Expr
nodes. The checker will check first the node and it executes the type_to_str
method.
pub struct DocNode {
pub mut:
name string
content string
comments []DocComment
pos token.Pos
file_path string
kind SymbolKind
tags []string
parent_name string
return_type string
children []DocNode
attrs map[string]string [json: attributes]
from_scope bool
is_pub bool [json: public]
platform Platform
}
merge_comments returns a string
with the combined contents of DocNode.comments
.
merge_comments_without_examples returns a string
with the combined contents of DocNode.comments
- excluding any examples.
Interfaces
This section is empty.
Enums
pub enum SymbolKind {
none_
const_group
constant
variable
function
method
interface_
typedef
enum_
enum_field
struct_
struct_field
}
SymbolKind categorizes the symbols it documents.
The names are intentionally not in order as a guide when sorting the nodes.
pub enum Platform {
auto
ios
macos
linux
windows
freebsd
openbsd
netbsd
dragonfly
js // for interoperability in prefs.OS
android
termux // like android, but note that termux is running on devices natively, not cross compiling from other platforms
solaris
serenity
vinix
haiku
raw
cross // TODO: add functionality for v doc -os cross whenever possible
}