-
Notifications
You must be signed in to change notification settings - Fork 125
Remove <base> tag, use hrefs prepended with base #2098
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
Conversation
lib/src/model/package.dart
Outdated
@@ -14,6 +14,10 @@ import 'package:pub_semver/pub_semver.dart'; | |||
|
|||
final RegExp substituteNameVersion = RegExp(r'%([bnv])%'); | |||
|
|||
// Unlikely to be mistaken for an identifier, html tag, or something else that | |||
// might reasonably exist normally. | |||
final String HTMLBASE_PLACEHOLDER = '\%\%HTMLBASE\%\%'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just off the top of my head, happy to replace it with something else.
The backslash escapes are unnecessary, but should prevent this string from being substituted if someone runs Dartdoc on Dartdoc itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string is short enough I can imagine someone else using it reasonably. Maybe: '\%\%__HTMLBASE_dartdoc_internal_only\%\%'
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This in general looks OK.
I'd like to see that a test verifies behavior with manually constructed links to elements using the old and new assumptions.
I added two tests to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, this is looking doable, even if the implementation is more than a bit horrifying in practice. I would like to see this behavior controllable via a flag (OK with default-on, we'll just shut it off anywhere it causes a problem if need be until we can fix downstream users). I also want a big TODO to lock down TemplateData as I discussed in the original bug. But I'm otherwise willing to tolerate it in the meantime.
lib/src/model/package.dart
Outdated
@@ -14,6 +14,10 @@ import 'package:pub_semver/pub_semver.dart'; | |||
|
|||
final RegExp substituteNameVersion = RegExp(r'%([bnv])%'); | |||
|
|||
// Unlikely to be mistaken for an identifier, html tag, or something else that | |||
// might reasonably exist normally. | |||
final String HTMLBASE_PLACEHOLDER = '\%\%HTMLBASE\%\%'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string is short enough I can imagine someone else using it reasonably. Maybe: '\%\%__HTMLBASE_dartdoc_internal_only\%\%'
instead?
- Add a CLI flag (hidden) to use the legacy behavior - Change placeholder string - Detailed comment regarding usage of the placeholder
For technical reasons, we can't really compute and inline the href base when accessing a model's
href
, so instead we use a placeholder and substitute it just after rendering each template.See discussion in #2090