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

How would dynamic pages work #25

Open
eliocamp opened this issue Jul 19, 2024 · 1 comment
Open

How would dynamic pages work #25

eliocamp opened this issue Jul 19, 2024 · 1 comment

Comments

@eliocamp
Copy link
Owner

Documentation can have code that is run dynamically either at install, build or render time:

https://cran.r-project.org/doc/manuals/R-exts.html#Dynamic-pages

@aitap
Copy link
Contributor

aitap commented Sep 5, 2024

By the time rhelpi18n:::.getHelpFile runs, the \Sexpr[stage=build] and \Sexpr[stage=install] macros have already been evaluated, but \Sexpr[stage=render] have not and will be evaluated by Rd2whatever calling tools:::prepareRd(stage = 'render').

This has consequences for the translation strings. If any translatable strings are produced by Rd macros, they won't be seen by i18n_translation_template without additional work. For an installed package, tools::Rd_db returns all pre-parsed Rd files with \Sexprs processed the same way as .getHelpFile will see them. For a source package, it's probably easier to install the package in a temporary library in order to process everything as expected by code inside the dynamic macros. If you try to run tools:::prepareRd manually, the code may get confused by not running with the same version of the package is has been written for.

Edit: the opposite problem happens for platform-specific chunks wrapped in #ifdef...#endif. They are processed after the build stage but before the install stage. Extracting strings from the value returned by .getHelpFile will miss the documentation for the other platform.

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

No branches or pull requests

2 participants