Skip to content
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

Monkey patch ToHtmlCrossref to modify ref links #297

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

jonathanhefner
Copy link
Member

Prior to this commit, postprocessing was used to unlink unintentional ref links and style unstyled code ref links. Postprocessing only affects the final generator output, which is generally more robust. But in these cases, it would be more consistent for intermediate consumers of RDoc::CodeObject#description to also see these changes.

This commit instead monkey patches RDoc::Markup::ToHtmlCrossref so that it returns bare text for unintentional ref links and wraps unstyled code ref links with <code></code>. Monkey patching RDoc is not ideal, but it allows all consumers of RDoc::CodeObject#description to see these changes.

Prior to this commit, postprocessing was used to unlink unintentional
ref links and style unstyled code ref links.  Postprocessing only
affects the final generator output, which is generally more robust.  But
in these cases, it would be more consistent for intermediate consumers
of `RDoc::CodeObject#description` to also see these changes.

This commit instead monkey patches `RDoc::Markup::ToHtmlCrossref` so
that it returns bare text for unintentional ref links and wraps
unstyled code ref links with `<code></code>`.  Monkey patching RDoc is
not ideal, but it allows all consumers of `RDoc::CodeObject#description`
to see these changes.
@jonathanhefner jonathanhefner merged commit 671db85 into rails:main Sep 1, 2023
@zzak
Copy link
Member

zzak commented Jan 15, 2025

@jonathanhefner This breaks builds with newer RDoc (6.10.0+), could you take a look please? 🙇

We might be able to upstream this patch if we can make it configurable.

@p8
Copy link
Member

p8 commented Jan 16, 2025

At a quick glance, it seems ruby/rdoc#1259 breaks this but added the somewhat similar functionality upstream (although a list has to be provided of terms not to link).

@jonathanhefner
Copy link
Member Author

@zzak @p8 Fixed in #374.

By the way, it looks like unit tests are no longer running via GitHub Actions on PRs...? The last PR they ran for was #365 (not related, just happens to be the last one they ran for).

@zzak
Copy link
Member

zzak commented Jan 16, 2025

@jonathanhefner Thanks for the quick fix and your investigation.

unit tests are no longer running via GitHub Actions on PR

I don't have access to the repo since it moved to the Rails org, so I'm not sure. I just checked and it looks like the transfer happened around March 2023, so they were definitely running after that. 🤔

@jonathanhefner
Copy link
Member Author

Hmm, I checked the GitHub Actions tab, and saw this:

sdoc-tests-disabled

So I clicked "Enable workflow".

I can understand automatically disabling the nightly runs, but disabling the action on PRs seems presumptuous...

@zzak
Copy link
Member

zzak commented Jan 17, 2025

Good catch, I didn't even realize (or forgot) there was a nightly but we probably don't need it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants