projectEndings / staticSearch

A codebase to support a pure JSON search engine requiring no backend for any XHTML5 document collection
https://endings.uvic.ca/staticSearch/docs/index.html
Mozilla Public License 2.0
46 stars 21 forks source link

Issue 268 filters #269

Closed martindholmes closed 1 year ago

martindholmes commented 1 year ago

This pull request forms the initial part of work on issue #268, and implements the enhancement in issue #248, allowing users to specify custom HTML label elements including other HTML markup as replacements labels for their filters. A few points to make:

  1. In the section of json.xsl where the user's configuration is serialized into JSON, I haven't bothered to write serialization for the custom labels themselves; I've only recorded the fact that custom labels were specified. This is because a) there will be further features added to the hcmc:filter element which may also have to be serialized, and it'll probably make sense to do all that at the same time, but also b) I'm not really sure if we have any use for the JSON serialization of the configuration file at all, so rather than add build time and complexity I've left this for the future.
  2. I've added tests for one desc filter and one boolean filter into our test suite; I think that's enough to be sure the setup is working, and adding more would require adding new filters into the test so that we have (for example) multiple date filters.
  3. I'm not sure what to do about the "search only in" filter, which is a bit different from other filters in that it doesn't have a filter name arising from a meta tag. Its caption is configurable in the caption set, which is currently limited to plain text.
  4. I haven't added any documentation for this feature yet, following our normal procedure which is to get a feature merged into dev before we add the documentation.
joeytakeda commented 1 year ago

Thanks @martindholmes for this — tested locally with no issues at all. A few minor queries for your consideration, but otherwise looks good to me—feel free to merge whenever you think.

martindholmes commented 1 year ago

I'll merge for now and raise a separate issue about the colon on the end of boolean filter labels.