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

Allow passing configuration values #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexisBRENON
Copy link
Contributor

Add a function to the ldoc API (available in config.ld) to pass some values to the templates.

Typical use case is to use different configuration files between local development and production deployment, using different root address. Hence, you can have a local_config.ld with:

add_config_value('html_root', 'http://localhost:8000')

and the default config.ld with:

add_config_value('html_root', 'https://doc.mydomain.com')

Then in templates, you can use $(ldoc.config.html_root) to reffer to the actual value.

Work to do if PR accepted:

  • Update version number
  • Update documentation

Kind.

Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to contribute. This is a cool little feature and I like it, but why stuff the values into a different table? Why not just use the existing ldoc table? For the use case I was just thinking of this morning that would have made more sense. Is there some reason I'm missing for the extra complexity?

Also, this should be documented in doc/doc.md before it is merged! Of all the projects to not document it's options...

@AlexisBRENON
Copy link
Contributor Author

What do you mean by "a different table" ? The config_values table or the nested ldoc.config table.

It make some times since I opened this PR. But I supposed that I created the nested table to not mix LDoc generated variables (in ldoc) with custom user configuration (in ldoc.config).

If you're OK for mixing everything in the top ldoc table, I will try to update the PR asap.

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

Successfully merging this pull request may close these issues.

2 participants