mariotoffia / goasciidoc

Document your go code using asciidoc instead of godoc
Apache License 2.0
17 stars 1 forks source link

Multi module & external package resolving #14

Open mariotoffia opened 3 years ago

mariotoffia commented 3 years ago

This PR supports repositores with multiple modules. It will eliminate the need to specify a module. Therefore, all documentation parsing needs to include atleast one go.mod.

It also adds support for third-party packages that are named differently than the last element on path. It will then also be possible to auto generate links to support the reference link processor.

ReferenceLinkerProcessor will substitute any found reference within backtick tags. By default no prefix is required, but may be set in the prefix in order to be activated.

This will search the package and type in imports and in current package to render a cross reference.

.Allowable Reference Types |=== |Expression |Type

|MyRef |Same package ref |package.MyRef |Other package ref |MyRef.MyRef2 |Struct Field, Interface Function in same package |MyRef(MyRef2) |Receiver function |package.MyRef.MyRef2 |Struct Field, Interface Function in other package |package.MyRef(MyRef2) |Receiver function in other package |===

The MyRef is resolved in the following way

  1. Interface
  2. Struct
  3. Variable
  4. TypeDef Variable
  5. TypeDef Function
  6. Plain method
  7. Receiver, and have only one receiver

If multiple receiver for same function name, use paranthesis and the name of the receiver to address. For example, MyFunc(*MyStruct).