aminya / AcuteML.jl

Acute Markup Language - HTML/XML in Julia
https://aminya.github.io/AcuteML.jl/dev
MIT License
6 stars 4 forks source link

Cannot add documentation to each field of a type using `@aml` #162

Open singularitti opened 3 years ago

singularitti commented 3 years ago

The suggested way of adding documentation to each field of a type introduced in Julia's official documentation is no longer workable in @aml:

julia> @aml mutable struct Body "body"
           "field h1"
           h1, "~"
           "field p"
           p::Vector{String}, "~"
       end
ERROR: LoadError: UndefRefError: access to undefined reference
Stacktrace:
 [1] getindex
   @ ./array.jl:801 [inlined]
 [2] iterate (repeats 2 times)
   @ ./array.jl:777 [inlined]
 [3] var"@aml"(__source__::LineNumberNode, __module__::Module, expr::Any)
   @ AcuteML ~/.julia/packages/AcuteML/pT7qV/src/AcuteML.jl:428
in expression starting at REPL[8]:4
julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
aminya commented 3 years ago

Is this a new documentation feature?

singularitti commented 3 years ago

Is this a new documentation feature?

It's been introduced since Julia 1.0.

aminya commented 3 years ago

I don't think I will add support for this. It is quite hard to parse it, and also it would be breaking since we are already using the docstring of the first field as the XML name of the struct.

singularitti commented 3 years ago

Can this problem be solved if we move the XML tag before the struct's name, as I mentioned in https://github.com/aminya/AcuteML.jl/issues/161#issuecomment-826303242?