-
Notifications
You must be signed in to change notification settings - Fork 25
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
Integrate to the bootstrap process of rust-lang/rust #193
Conversation
b8b7f91
to
065a045
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #193 +/- ##
==========================================
- Coverage 90.27% 89.74% -0.54%
==========================================
Files 12 13 +1
Lines 3034 3052 +18
Branches 3034 3052 +18
==========================================
Hits 2739 2739
- Misses 207 225 +18
Partials 88 88 ☔ View full report in Codecov by Sentry. |
@@ -19,7 +19,7 @@ mdbook.workspace = true | |||
polib.workspace = true | |||
pulldown-cmark = { version = "0.9.2", default-features = false } | |||
pulldown-cmark-to-cmark = "11.2.0" | |||
regex = "1.10.4" | |||
regex = "1.9" |
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.
We might get a PR from the dependabot, but we can then tell it to ignore the 1.10 releases.
i18n-helpers/src/preprocessors.rs
Outdated
pub mod gettext; | ||
pub use gettext::Gettext; |
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.
I'm not a fan of giving multiple public names for the same thing — could you instead make the module private?
pub mod gettext; | |
pub use gettext::Gettext; | |
mod gettext; | |
pub use gettext::Gettext; |
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.
I've fixed it.
let gettext = Gettext; | ||
if gettext.supports_renderer(renderer) { |
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.
Would this work as well:
let gettext = Gettext; | |
if gettext.supports_renderer(renderer) { | |
if Gettext::supports_renderer(renderer) { |
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.
I can't change the definition of supports_renderer
and run
because they are defined as methods of Preprocessor
trait at https://docs.rs/mdbook/latest/mdbook/preprocess/trait.Preprocessor.html.
I can define another static method like impl_supports_renderer
, and change it to Gettext::impl_supports_renderer
,
but it may be redundant.
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.
Ah, I see now! The syntax I used above would only work if the supports_renderer
method had no &self
argument.
Then let's merge this PR as it is — and then later change the code here to create a single Gettext
value and pass this around. That would be a little more natural, I think (thought it would just be a small refactor).
let gettext = Gettext; | ||
let book = gettext.run(&ctx, book)?; |
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.
Like above, I think we don't need the variable:
let gettext = Gettext; | |
let book = gettext.run(&ctx, book)?; | |
let book = Gettext::run(&ctx, book)?; |
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.
Hi @dalance, can you try out this change and see if it compiles? If so, please add it to the PR. Thanks!
Hi @dalance, thanks a lot for the PR! I would like to merge it after the small conflicts are resolved. |
065a045
to
b44611b
Compare
Thank you for your review. I resolved conflict and fixed the module visibility. |
This PR changes the followings for rust-lang/rust#124731:
Gettext
preprocessorCloses #191