bikeshed icon indicating copy to clipboard operation
bikeshed copied to clipboard

Deep linking bibliographic references not working with modifiers

Open CxRes opened this issue 2 years ago • 11 comments

These work:

+ [[RFC9110 inline]]
+ [[RFC9110 direct]]
+ [[RFC9110 index]]

+ [[!RFC9110 inline]]
+ [[!RFC9110 direct]]
+ [[!RFC9110 index]]

and this:

+ [[RFC9110#section-3.5]]

But these don't:

+ [[!RFC9110#section-3.5]]
+ [[RFC9110#section-3.5 inline]]
+ [[RFC9110#section-3.5 direct]]
+ [[RFC9110#section-3.5 index]]

Please fix!

CxRes avatar Jun 12 '23 04:06 CxRes

~~My suspicion (since I have touched python in well over a decade) is that the fix is as simple as replacing~~

([\w.+-]+)

~~with~~

([\w.+-\\#]+)

~~in this line.~~

Something there but more complex...

CxRes avatar Jun 12 '23 05:06 CxRes

No, those are two different categories of autolink; "biblio" vs "section".

The "section" type is already basically "direct" - it links straight to the indicated section of the external document, and uses the heading's actual text (if Bikeshed knows it) for the link. The biblio modifiers don't really make sense in this context, since they're controlling aspects that don't apply to section links (whether to link to the biblio section or the document itself, and whether to display the biblio shortname or the document title itself).

tabatkins avatar Jun 13 '23 23:06 tabatkins

~Unfortunately, direct linking in expanding the heading just does too much. There is very much a use case (at the very least) for section linking that does not expand when referring to an external document.~

~Suppose I could even do [User Agents]([[RFC9110#section-3.5]]) which is not ideal but one can live with it. Isn't that much much more sane than [User Agents](https://www.rfc-editor.org/rfc/rfc9110#section-3.5) which completely defeats the point of Autolinking?~

Nevermind, I reread the docs and found how to customize links buried in it. It is still not ideal and extremely verbose for what I want to achieve. Also, there should be a way to add a title to the link.

CxRes avatar Jun 14 '23 07:06 CxRes

Hm, what would you want the title to be? Is it something automatically inferrable? (Note that you shouldn't put significant information in a title; it's not widely accessible.)

If you just want to add a bespoke title, you can do that by wrapping the link in a span.

what I am trying to achieve is ([RFC2046], Multipart Media Type) where "RFC2046" points to the references section in the document and "Multipart Media Types" links to the section in the external document

([[RFC2046]], [[RFC2046#multipart-media-type|Multipart Media Type]])

That seems about as minimal as it's even theoretically possible to get? The heading we have from the RFC doesn't display the text you want, so you'll have to customize that text anyway.

tabatkins avatar Jun 14 '23 17:06 tabatkins

That is exactly what I have done (and spent more than a couple of hours doing for each link in my spec)! But the spec is painfully less editable as a result. Putting an a tag with section-linking is something I want to avoid, unless I absolutely have too.

The default title could be the default text for the direct link (or the document title).

CxRes avatar Jun 15 '23 07:06 CxRes

I'm not sure what you think could be done better, tho. What I posted above is extremely minimal - it's two links (using shorthand notation, so basically as compact as possible; much better than manual linking) and a textual override that is also as compact as possible (the text itself plus the | character).

If the text you wanted was just the section heading (aka you wanted to suppress the spec name from the section link) then Bikeshed could potentially make this more compact by offering a keyword that gave this behavior, but in the example you gave this isn't the case - the text you wanted is similar to, but less verbose than, the actual section heading.

tabatkins avatar Jun 15 '23 17:06 tabatkins

I don't know where you get the "similar to" impression? Actual heading or even section number (if bikeshed cannot coerce the heading) are OK. My implementation experience is humans (ie me) will always make mistakes when putting in headings manually the way you describe above.

I actually would not mind a keyword for suppressing the spec name and move spec name to a title attribute.

Is that a reasonable request, then? I know... more work for you!

CxRes avatar Jun 16 '23 07:06 CxRes

I was just basing that on the actual markup you provided and I quoted - the text you gave ("Multipart Media Types") is not the actual section title (it's something a bit longer and more verbose).

tabatkins avatar Jun 16 '23 18:06 tabatkins

Huh? RFC2046 section 5.1 is "Multipart Media Type". See https://www.rfc-editor.org/rfc/rfc2046.html#section-5.1

CxRes avatar Jun 17 '23 23:06 CxRes

Oh sorry, I was basing that on what you said in your earlier comment (which you've since rewritten so it says something else, but my email still has the original):

Again, what I am trying to achieve is ([RFC2046], Multipart Media Type) where "RFC2046" points to the references section in the document and "Multipart Media Types" links to the section in the external document. Here I am stuck with multiple instances of Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types § section-5.1 on the same sentence, if I use section links. Madness!

Okay so if it's just a matter of "I'd like a modifier for section links that makes it only output the section title, not the spec title + section title" that's absolutely doable. It'll be a bit since I'm about to go on vacation until July, so for now just use the pattern we already discussed.

tabatkins avatar Jun 20 '23 21:06 tabatkins

Sounds Good. Thanks!

CxRes avatar Jun 21 '23 05:06 CxRes