-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add syntax for references #200
base: master
Are you sure you want to change the base?
Conversation
New syntax for refering to documented declarations without writing XML. The AutoDoc code #SomeFunction #SomeOperation[IsInt,IsGroup] is now translated to <Ref Func="SomeFunction" /> <Ref Func="SomeOperation" Label="for IsInt, IsGroup" />
Codecov Report
@@ Coverage Diff @@
## master #200 +/- ##
=========================================
+ Coverage 68.49% 70.1% +1.61%
=========================================
Files 13 13
Lines 2206 2248 +42
=========================================
+ Hits 1511 1576 +65
+ Misses 695 672 -23
|
First of, thanks for the PR, much appreciated! As to the syntax: Why are these rectangular brackets needed? It seems those are for labels. But then they are needlessly restricted, as one can specify arbitrary label texts, but the In any case: personally, I'd prefer something that is closer to Markdown, if possible. That would suggest basing it on the
We could just borrow that. That said, the As to |
Some elaboration: 1. Hash syntax versus Markdown link syntax I also thought about the Markdown style The syntax you mention from Julia --
-- seems very clumsy to me. The On the other hand, I think it would be a very good idea to have the normal Markdown syntax
for creating an external link. Combined with the 2. What is the stuff in square brackets? Ideally, I would like to write just
to be read as "reference to the version of In many cases, of course, there is only one declaration for a given operation name. However, when the 3. References to other things: chapters, sections etc I think the
and get the GAPDoc code
-- given that AutoDoc is able to keep track of all documented names and labels, so that it knows just from a name if that name is a chapter label, or a section label, or a function name, and so on. |
OK, I think you have a valid point regarding the As to labels: Actually, I don't see how AutoDoc could possibly resolve labels automatically: Also, GAPDoc labels are typically used to disambiguate multiple documentation entries for the same identifier, and the label texts can be anything. How should we guess them? Again, your proposal only seems to make sense if we assume that 100% of the manual are written in AutoDoc. But that locks out a lot of users. |
So, here is another concern I have with using Thoughts? |
Regarding whether AutoDoc can have complete control over all labels: It is true that I was only thinking about the case where everything is written in AutoDoc. However, even if there is a mix of AutoDoc and GAPDoc code, AutoDoc can still have control over all labels in those parts of the manual that are written in AutoDoc. This means that for references pointing to something that was written in GAPDoc, the user would need to write a quite long and complicated thing containing all the information needed to generate the proper GAPDoc For example, if the operation
If, on the other hand, it is documented in AutoDoc, and there is no other operation with the same name, then we could refer to it by writing only
In this way, the simple (and common) cases are kept simple, and the complicated cases are a bit complicated, but not impossible. |
About syntax: The syntax The alternatives I don't have strong opinions on the exact choice of syntax, but I really want the ability to make a reference by writing only an identifier (if it is unique) or an identifier and a label, combined with some very few extra characters to say that it is a reference. |
I think we violently agree on this ;-) Also, I find your remark that Github already uses
Agreed, that should indeed be the goal. But precisely that is what worries me (at least about your original proposal), as it seems to only makes short syntax possible for things documented in AutoDoc using default labels, but seems to make short syntax impossible for anything with custom labels, including things documented in AutoDoc using custom labels. To clarify: It's not Perhaps we could say "If it looks like tl;dr: I'll be sold if we can find a syntax we all think is OK and that also supports arbitrary custom labels, both those set in GAPDoc and in AutoDoc, and without forcing me to add a prefix like |
It is not easy to imagine any reference syntax that would handle absolutely every legal GAPDoc label, except GAPDoc's own syntax. For example, even if we say that
means the version of
in GAPDoc. |
A suggestion for syntax: A reference is written as
where:
When referring to something defined in GAPDoc code, we need to include the So we could for example write something like this when referring to GAPDoc-defined things:
Or something like this when referring to AutoDoc-defined things:
This could also be combined with the syntax I suggested initially, so that
means a reference to the version of |
@oysteins that sounds very good to me! Thank you for putting in the time and effort to work on this. Would be good if @sebasguts could also comment to say if he approves as well? |
@oysteins Sorry for being late to the show, and thank you, that all looks good. I agree with the Syntax specified above, just a small comment (which is probably not important): AutoDoc allows you to set, e.g., chapters and sections with the same name. How would you distinguish them using your Syntax? The (automatically set) labels might be tricky to guess for users, ( |
@oysteins: if you were willing to update this PR, that would be great! If not (e.g. you lack time or are annoyed by us being slow in accepting you are right ;-), I totally understand, then we'd try to adapt it (but that may take some more time, esp. since @sebasguts will sadly soon leave us) |
I think it would be nice to have an XML-free syntax for writing references.
I suggest that the name of a function prefixed with a hash symbol should give a reference, so that the AutoDoc code
is translated to the GAPDoc code
For operations, attributes and properties, we need to include the argument filters as well. I suggest the syntax
which is translated to
This pull request is my attempt to implement this, including documentation and tests.
Some points for discussion:
Func
attribute toRef
, instead of usingOper
,Attr
and so on? It is easier to generate the GAPDoc code this way (we don't have to find out what kind of thing we refer to), and I'm not able to see that it makes any difference in the final result.