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

Add ability to insert a value specified in config into the document #4578

Open
nigelmegitt opened this issue Nov 6, 2023 · 2 comments
Open

Comments

@nigelmegitt
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I'd really like to be able to include a link to the document's GitHub repo in the document itself, not just in the header. This information is already part of the Respec config, so I would like to be able to re-use it rather than duplicate it. I found a way to insert Respec config using a post processing script, but it feels as though there ought to be a better way.

I'd generalise this to any Respec config value, not just the repo URL.

Describe the solution you'd like
I'd like to be able to include some kind of macro, maybe nunjucks-style, that inserts values from javascript into the HTML document using a common syntax in the HTML itself.

Additional context

The reason I'm inserting a link to the GitHub repo in this case is because I want to put it into the Registry Definition instructions for requesting a change to an inline Registry Table, and those instructions include "raise an issue on the repo", effectively.

See also spec-prod email thread at https://lists.w3.org/Archives/Public/spec-prod/2023OctDec/0003.html

Describe any alternatives you've considered
Hack that I consider ugly, to do this now, at https://github.com/w3c/dapt/blob/72dae1c652b6ce5e74a7fe4fcc19b49dfaf86fb9/index.html#L8-12 - I then add a specific class value to all the <a> elements whose href attribute I want to replace, and reference this function in the postProcess array in the Respec config.

Can you or your organization fund the work or help with development?
ReSpec is a community maintained project, meaning it doesn't have any dedicated staff or funding.

There are three options to get your feature implemented. You can:

  1. contribute to the project yourself via a pull request. We will guide you!
  2. fund a contributor to prioritize your feature (usually US$500+ depending on complexity).
  3. wait for someone to get to it (usually a few months).
    Funding pays for the feature development, testing, documentation, server costs, etc. We have an open collective where development costs are tracked and shared. Please see our Open Collective.
@marcoscaceres
Copy link
Member

We probably need some kind of new template syntax for that. This feels very much like something a custom element should handle.

we might want to check if we do this in some other way already

@nigelmegitt
Copy link
Contributor Author

I was hoping {{ variable }} would be available, a la nunjucks templating but I see that has been taken for WebIDL linking. Maybe {$ variable $} would work instead?

One thing we should consider is how complex the expressions within that are allowed to be, and if there are any injection risks: where I just wrote variable above, I guess it could be upper(variable) or some other expression that's even more complex.

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

No branches or pull requests

2 participants