Open mbloch opened 6 years ago
I recently made some changes to ai2html configuration. Now you can put organization-specific settings in a JSON file (ai2html-config.json
) in the script directory, and project-specific settings in an ai2html-config.json
file in the same folder as the .ai
file.
These loadable settings should contain only the subset of settings that are different from the default settings in the ai2html.js
script.
The default settings are no longer in a tabular format. They are now containing in a JS object at the top of the script, rather than in an array exported from a Google spreadsheet.
There is currently some bare-bones documentation of this change on the ai2html.org site, which I hope to flesh out in the near future.
One goal for this update is to let users outside the NYTimes keep their configuration settings in an external file, rather than having to maintain a custom version of the ai2html.js
script.
To this end, I hope some of you will tell me about customizations that you've had to make to the script. We can talk about whether it makes sense to incorporate your changes into the release version of ai2html.
I'd like to propose a new way of organizing configuration settings.
The current script uses JSON records exported from a spreadsheet for configuration. There are some limitations with this system: the comments (in the "notes" field) are hard to read; some of the fields only apply to a handful of settings; all the settings are duplicated between the default and NYT configurations; it's a tabular structure, so there's no good way to include nested objects like the list of fonts.
Here's a proposal for better configurability. Maintain a main configuration file containing all of the configurable default settings. The Times would then maintain an organization-specific set of override settings in a separate file. Other organizations would maintain their own files. There could be additional files with settings that are specific to different types of projects. The settings would be applied in a cascade.
Instead of the current array of JSON records, I'd like to consider switching to YAML, which allows for comments and nested objects.
Here's a link to a Gist showing one way that YAML config files might look: https://gist.github.com/mbloch/c7f0db9d9d8c34efbbb33539c23ff037
The config settings could either be loaded at run time or baked into customized versions of the script as part of a build process.