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

Access to pass 2 variables #162

Open
tlienart opened this issue Aug 12, 2022 · 2 comments
Open

Access to pass 2 variables #162

tlienart opened this issue Aug 12, 2022 · 2 comments
Labels
addition documentation Improvements or additions to documentation

Comments

@tlienart
Copy link
Owner

e.g. :_generated_body

also, possibly, if there's function called in pass 2 that allocates variables like {{allocate x 5}} then x wouldn't be available from getvarfrom.

Probably best to tell users not to do the latter, but :_generated_body might make sense (also :_relative_url and prepath prefix in the pass 2). Might make sense to have a restricted list of pass 2 variables, and have getvar behave differently with those (though we should proceed with care to avoid the kind of Franklin fuckups...)

@tlienart
Copy link
Owner Author

@tlienart
Copy link
Owner Author

safest (to avoid adding passes and risking to fall back in the @delay pit of doom) is probably to tell people that they should use a dedicated hfun which does:

  1. gets _generated_ihtml
  2. runs html2(...)

this will do more work than required (2x html2 of some content) but is likely easier than to figure out some form of 3d pass re-trigger.

need to have some form of error handling to stop this from looping though... so maybe the function should have a depth indicator so that if a _generated_ihtml contains something that itself wants to call that function, it just fails (depth 1).

Seems like a valid use case is to be able to retrieve something like {{getbodyfrom ...}} / Utils.hfun_getbodyfromUtils.getbodyfrom(...). The Utils.getbodyfrom` would allow users to do some post-processing e.g. if they only want a chunk of it.

@tlienart tlienart added addition documentation Improvements or additions to documentation labels Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant