Documentation
¶
Overview ¶
Package doc extracts documentation from Rugo source files.
It uses the compiler's ParseSource API to get AST nodes and struct metadata, then correlates doc comments from the raw source using line numbers. The attachment rule: consecutive # lines immediately before a def/struct declaration (no blank line gap) are attached as the doc comment.
Index ¶
- func FormatAllModules() string
- func FormatBridgePackage(pkg *gobridge.Package) string
- func FormatFile(fd *FileDoc) string
- func FormatModule(m *modules.Module) string
- func FormatSymbol(docStr, signature string) string
- func LookupSymbol(fd *FileDoc, name string) (doc string, signature string, found bool)
- type FileDoc
- type FuncDoc
- type StructDoc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAllModules ¶
func FormatAllModules() string
FormatAllModules lists all available modules and bridge packages.
func FormatBridgePackage ¶
FormatBridgePackage formats a Go bridge package for terminal display.
func FormatFile ¶
FormatFile formats a FileDoc for terminal display. When items have Source set (from recursive extraction), they are grouped by source file with headers.
func FormatModule ¶
FormatModule formats a stdlib module for terminal display.
func FormatSymbol ¶
FormatSymbol formats a single symbol lookup result.
Types ¶
type FileDoc ¶
type FileDoc struct {
Path string
Doc string // file-level doc (first # block before any code)
Funcs []FuncDoc
Structs []StructDoc
}
FileDoc holds all extracted documentation for a single Rugo file.
func Extract ¶
Extract parses raw Rugo source and returns structured documentation. It uses the compiler API for AST and struct metadata, and correlates doc comments from the raw source by line number.
func ExtractDir ¶
ExtractDir reads all Rugo files in a directory (non-recursive) and returns aggregated documentation. The entry file's doc becomes the top-level doc. Other files contribute their functions and structs.
func ExtractDirRecursive ¶ added in v0.14.4
ExtractDirRecursive walks a directory tree and aggregates documentation from all non-test Rugo files. Test files (*_test.rugo) are excluded. The entry file's doc becomes the top-level doc.
func ExtractFile ¶
ExtractFile reads a Rugo file and extracts all documentation.