Releases: mariotoffia/goasciidoc
Support for generics
It now supports generics and more complicated indexes.
Support for ArrayType
Support for ArrayType
is now added to the parser. Also proper handling of imports is implemented.
Support for maps in parsing as custom stype
Now it properly detects maps as custom types, so e.g. the following will work properly
// GeneratorPrototype is a set of `eqmodel.SensorType` with
// corresponding generator function or value.
//
// The _ID_ is denoting a explicit _ID_, including e.g. ordinal
// and circuit and hence if exist is matched first. If no such
// match, it checks for the base form _ID_. This is just the
// plain _ID_ such as _IDT_. If no match, it checks if there's
// a wildcard match '*' registered. And it will use that.
//
//
// It replaces the _{{ID}}_ in the generator expression so it
// may use the actual _ID_.
//
// .Sample Prototypes
// ====
// 1. IDT_O1: round(generate["IDT_O1"]) - IDT_O1 explicitly
// 2. IDT: round(generate[{{ID}}]) - All IDT matches this one
// 3. *: generate[{{ID}}] - This is last resort, if nothing else matches use this.
// ====
type GeneratorPrototype map[string]string
Added macros
This release just adds three more macros
- ${gad:current:fqdir}
- ${gad:current:dir}
- ${gad:current:file}
in addition to ${gad:current:fq}.
Macros enabled by default
This release enables macros by default since, the same processor also processes and cleans out //tag:tag-name[] in order not be part of the documentation.
Support for current file macro
It is now possible to use the ${gad:current:fq} macro of which will be substituted to the fully qualified filepath to the source file being parsed.
This may be useful to include source code segments from and annotate documentation, e.g.
// ParseConfig to use when invoking ParseAny, ParseSingleFileWalker, and
// ParseSinglePackageWalker.
//
// .ParserConfig
// [source,go]
// ----
// include::${gad:current:fq}[tag=parse-config,indent=0]
// ----
// <1> These are usually excluded since many testcases is not documented anyhow
// <2> As of _go 1.16_ it is recommended to *only* use module based parsing
// tag::parse-config[]
type ParseConfig struct {
// Test denotes if test files (ending with _test.go) should be included or not
// (default not included)
Test bool // <1>
// Internal determines if internal folders are included or not (default not)
Internal bool
// UnderScore, when set to true it will include directories beginning with _
UnderScore bool
// Optional module to resolve fully qualified package paths
Module *GoModule // <2>
}
// end::parse-config[]
The above sample will render the struct as go source and is annotated with two bullets.
Cheers,
Mario :)
Template directory Support
This release brings in support for using a --templatedir [directory] where goasciidoc
will pick up any template override wanted. This is more usable instead of pointing out one by one.
The defaults folder contains all default templates that I use to embed into the binary (using go 1.16 embed directive). This is a great folder to copy to your own template directory and start changing the layout.
The documentation has been updated to reflect the new --templatedir support. This sorts out issue #12
Also fixes a small issue #11
Cheers,
Mario
Exported and non exported support.
breaking changes!!
Now, by default only public symbols are exported. If you want to include non exported symbols use --nonexported switch.
This is still very much experimental. All templates has been updated to support this case. Added a template config property called Private and on each goparser struct an Exported field to denote if the symbol is exported or not.
Renders receivers on custom types
Added support for Receiver methods on custom types in addition to structs.
Support for Receivers Functions
Added template to render Receiver Functions and bound that under struct rendering. Hence, after each struct (if receiver functions do exits) those will be rendered.
Filtering of receiver functions when render the functions has also been implemented.