You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module abcFunctionsModule
using DocStringExtensions
DocStringExtensions.@template TYPES ="""$(TYPEDEF)# Descriptions$(DOCSTRING)"""
DocStringExtensions.@template (FUNCTIONS) ="""$(METHODLIST)# Description$(DOCSTRING)# Examples"""
DocStringExtensions.@template (METHODS, MACROS) ="""$(DOCSTRING)"""include("myFunc1.jl")
include("myFunc2.jl")
end
myFunc1.jl file looks like this
"""An example function which will later be placed in a module to be imported/used elsewhere."""function myFunc1 end#this is the empty function definition (i.e it declares a function with 0 methods) and is where we document the `description of the function."""## Example with no argumentsmyFunc1() ----> $(myFunc1())"""functionmyFunc1()
return"MyFunc1"end"""## Example with intmyFunc1(5) ----> $(myFunc1(5))"""functionmyFunc1(x::Int64)
return"MyFunc1 with an int $x"end"""## Example with stringmyFunc1("me") ----> $(myFunc1("me"))"""functionmyFunc1(x::String)
return"MyFunc1 with a string that says $x"end
This does 99% of what I want it to. i.e. DocStringExtensions correctly adds the #Decription and #Examples heading and then adds each example as per the documentation above each method.
However $METHODLIST outputs this
so for the last two methods of myFunc1 ( one that takes in a string and the other that takes in a int) you can't see immediately what the input is because they both show up as
myFunc(x)
Note I cannot do this with TYPEDSIGNATURES in each individual method docString as i specifically want a doc sting like this
"""# the methods/signatures# then description# then examples# with each example being found in the method DocString to limit duplication/ adhere to single source of truth"""function xyz end....etc
Would it be possible to add the typed signatures/ typed method list by creating a new $TYPEDMETHODLIST abbreviation similar to how it is done for $TYPEDSIGNATURES
I could then create the module as described above and everything would show up nicely/just work. And I would be able to distinguish between which method is which
I would be happy to contribute to a PR. I am a novice when it comes to meta-programming so guidance on what to do/where to look would be appreciated
Many thanks in advance
The text was updated successfully, but these errors were encountered:
unnamedunknownusername
changed the title
Would it be possible to add a TYPEDMETHODLIST constant
Would it be possible to add a TYPEDMETHODLIST abbreviation
May 14, 2023
Currently I have a module set up like this
myFunc1.jl
file looks like thisThis does 99% of what I want it to. i.e. DocStringExtensions correctly adds the
#Decription
and#Examples
heading and then adds each example as per the documentation above each method.However
$METHODLIST
outputs thisso for the last two methods of
myFunc1
( one that takes in a string and the other that takes in a int) you can't see immediately what the input is because they both show up asNote I cannot do this with
TYPEDSIGNATURES
in each individual method docString as i specifically want a doc sting like thisWould it be possible to add the typed signatures/ typed method list by creating a new
$TYPEDMETHODLIST
abbreviation similar to how it is done for$TYPEDSIGNATURES
I could then create the module as described above and everything would show up nicely/just work. And I would be able to distinguish between which method is which
I would be happy to contribute to a PR. I am a novice when it comes to meta-programming so guidance on what to do/where to look would be appreciated
Many thanks in advance
The text was updated successfully, but these errors were encountered: