Giter Club home page Giter Club logo

goasciidoc's People

Contributors

mariotoffia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alanconway

goasciidoc's Issues

Cannot handle type Time time.Time

When generating a source with

// Time defines a _Unix Timestamp_ encoded as epoch seconds in JSON
//
// It is also able to create _time.Time_ with a specific timezone from
// this _UTC_ timestamp that have https://www.iana.org/time-zones[IANA compatible zone names].
// In order to create such _time.Time_ use the extension function
// @WithTimeZone.
type Time time.Time

the internal_parser prints the ast (meaning not supported):

0  *ast.SelectorExpr {
     1  .  X: *ast.Ident {
     2  .  .  NamePos: /home/martoffi/progs/crossbreed/platform/go-core/model/jsontime.go:17:11
     3  .  .  Name: "time"
     4  .  }
     5  .  Sel: *ast.Ident {
     6  .  .  NamePos: /home/martoffi/progs/crossbreed/platform/go-core/model/jsontime.go:17:16
     7  .  .  Name: "Time"
     8  .  }
     9  }

Line 17 is: type Time time.Time.

Ability to crossreference types, methods, packages

Initial thought is - around the figures of...

Type Example
type @mypackagename.MyType
type @github.com/mariotoffia/goasciidoc/mypackagename.MyType
method @Mymethod
method @mypackagename.MyMethod
method @github.com/mariotoffia/goasciidoc/mypackagename.MyMethod
method @myStruct.MyMethod
method @mypackagename.myStruct.MyMethod
method @github.com/mariotoffia/goasciidoc/mypackagename.myStruct.MyMethod
method @myInterface.MyMethod
method @mypackagename.myInterface.MyMethod
method @github.com/mariotoffia/goasciidoc/mypackagename.myInterface.MyMethod
package @mypackage
package @github.com/mariotoffia/goasciidoc/mypackagename

not implemented: ArrayType

Hi.
I'm getting an error with Arrays:

type Color string
type Label struct {
	Name        string
	Description string
	color       Color
}
type LabelSet []Label

log:

not-implemented typeSpec.Type.(type) = *ast.ArrayType, ast-dump:
----------------------
     0  *ast.ArrayType {
     1  .  Lbrack: domain/labelset.go:5:15
     2  .  Elt: *ast.Ident {
     3  .  .  NamePos: domain/labelset.go:5:17
     4  .  .  Name: "Label"
     5  .  }
     6  }
----------------------

I'm using latest version v0.4.5

The originating error seems to come from here:

default:
buf := bytes.NewBufferString("")
fmt.Fprintf(
buf,
"not-implemented typeSpec.Type.(type) = %T, ast-dump:\n----------------------\n",
typeSpec.Type,
)
ast.Fprint(buf, fset, typeSpecType, ast.NotNilFilter)
fmt.Fprintf(buf, "----------------------")

Would be cool to have this also implemented ๐Ÿ˜„

The listing of constants is not properly documented

The listing of constants is not properly documented

const (
	AuthorizeRemoteTxRequests string = "AuthorizeRemoteTxRequests"
	ClockAlignedDataInterval  string = "ClockAlignedDataInterval"
	ConnectionTimeOut         string = "ConnectionTimeOut"
	ConnectorPhaseRotation    string = "ConnectorPhaseRotation"
	GetConfigurationMaxKeys   string = "GetConfigurationMaxKeys"
	HeartbeatInterval         string = "HeartbeatInterval"
	LocalAuthorizeOffline     string = "LocalAuthorizeOffline"
	LocalPreAuthorize         string = "LocalPreAuthorize"
)

image

Adding a comment to the const group leads to multiple calls

// This is not Working
const (
	AuthorizeRemoteTxRequests string = "AuthorizeRemoteTxRequests"
	ClockAlignedDataInterval  string = "ClockAlignedDataInterval"
	ConnectionTimeOut         string = "ConnectionTimeOut"
	ConnectorPhaseRotation    string = "ConnectorPhaseRotation"
	GetConfigurationMaxKeys   string = "GetConfigurationMaxKeys"
	HeartbeatInterval         string = "HeartbeatInterval"
	LocalAuthorizeOffline     string = "LocalAuthorizeOffline"
	LocalPreAuthorize         string = "LocalPreAuthorize"
)

image

Render Struct Functions Correctly

Currently a Function that is bound to a certain struct is not rendered correctly since it is rendered as a standard function. It needs to be grouped under that particular struct.

Support template directory

Currently, each template override has to be explicitly configured with --overrides name=file, e.g.

go run github.com/mariotoffia/goasciidoc -o godoc.adoc -r import=docs/godoc-templates/import.tpl -r var=docs/godoc-templates/var.tpl

But it would be helpful if we can specify a template directory, and use the file basename as the name for *.tpl files, e.g.

$ ls docs/godoc-templates 
import.tpl  var.tpl

A file named var.tpl would provide a name for the var template (compare with var=... above)

go run github.com/mariotoffia/goasciidoc -o godoc.adoc --template-dir docs/godoc-templates

at the moment, I have to construct each individual argument like this:

$ for file in $(find docs/godoc-templates/*.tpl); do name="$(basename ${file%.*})" && printf "%s %s=%s" '-r' $name $file; done && printf '\n'
-r import=docs/godoc-templates/import.tpl -r var=docs/godoc-templates/var.tpl

which works, but isn't exactly pretty

Use types Check to do verification and allow for proper package prefix parsing

When parsing gopackage.go the go/types - types.Config will segfault!

        conf := types.Config{Importer: importer.For("source", nil)}

	info := &types.Info{
		Types: make(map[ast.Expr]types.TypeAndValue),
		Defs:  make(map[*ast.Ident]types.Object),
		Uses:  make(map[*ast.Ident]types.Object),
	}

	if _, err := conf.Check(file.Name.Name, fset, files, info); err != nil {
		return nil, err
	}

The conf := types.Config(...) and if, _, err := conf.Check(...) are commented out due to this segfault.

Join with other developers to submit a more standardized Go-lang implementation

Asciidoc is a great markup language. At the same time, Hugo is also a very good static website generation tool. I like Asciidoc and Hugo. Therefore, I am very much looking forward to an implementation in Go language.

I searched for relevant information and found at least three implementations:

  1. bytesparadise/libasciidoc: A Golang library for processing Asciidoc files.
  2. mariotoffia/goasciidoc: Document your go code using asciidoc instead of godoc
  3. shuLhan/asciidoctor-go: [mirror] Native Go module for parsing and converting asciidoc markup language.

Asciidoc is now being standardized by the Eclipse Foundation: AsciiDoc Working Group | The Eclipse Foundation. Perhaps, you can work together to submit a more standards-compliant implementation to this working group.

Thanks again and good luck.

function are rendered using incorrect section delimiter

When a plain function

func NewReportBuilder(
	json string,
	produce func(json string),
	rewritePath func(path string) string,
) *ReportBuilder {

	if nil == rewritePath {
		rewritePath = func(path string) string { return path }
	}

	return &ReportBuilder{
		json:        json,
		produce:     produce,
		rewritePath: rewritePath,
	}
}

is rendered. It will be rendered using ----- instead of ..... The above is rendered as:

== Functions

=== NewReportBuilder
[source, go]
----
func NewReportBuilder(
    json string,
    produce func(json string),
    rewritePath func(path string) string,
) *ReportBuilder
----

NewReportBuilder creates a new `ReportBuilder` with the provided _json_ as parameter.

If the _produce_ f...

TabWriter is not used

Since struct, interfaces etc. do not emit \t instead only spaces are used.

for example:

type Producer struct {
        parseconfig goparser.ParseConfig
        paths []string
        outfile string
        index bool
        indexconfig string
        overrides map[string]string
        writer io.Writer
}

This needs to be adressed on type struct, interface, const etc but not on other places.

Remove tag::xyz from documentation

Since, those are only used when included and should not be added to the asciidoc document. This results that all tags are rendered.

Add a pre-processing step to clense tag::tag-name[] from the data

Support for rendering structs as JSON

Allow for rendering a sample JSON document based on go structs. In addition interpret json tag.

type DsBuildingMeta struct {
	TimeZone DsMetaTimeStamp `json:"tz,omitempty"`
	Sensors map[string]DsMetaTimeStamp `json:"sensors,omitempty"`
}

Support for nested structs

E.g. this setup will not extract the fields and documentation:

type Baah struct {
  Foo struct {
    // Baz is a property
    Baz string
  }

The Decl for Baah is now

Foo struct {
  // Baz is a property
  Baz string
}

and that is not correct. It SHOULD be

Baah.Foo.Baz
Fax is a property

and the Foo Struct should be

type Baah struct {
  Foo struct {
   Baz string
  }

This requires more job when parsing the structs...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.