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

Sorting a HRG that contains entries created by different converters #48

Open
RieksJ opened this issue Apr 29, 2024 · 3 comments
Open

Sorting a HRG that contains entries created by different converters #48

RieksJ opened this issue Apr 29, 2024 · 3 comments
Assignees
Labels
bug Something isn't working impact: HRGT

Comments

@RieksJ
Copy link
Member

RieksJ commented Apr 29, 2024

I have come to appreciate the feature of having multiple converters create HRG entries, e.g.,

  • have a 'regular' HRG entry created for every MRG entry, and
  • if an MRG entry has an abbreviation specified (in its glossaryAbbr field), a HRG entry is created that states the abbreviation, and has as its description See: {glossaryTerm} (or so).

Before creating the HRG itself, the set of HRG entries are sorted according to the 'sorter' converter.
The problem is that if the sorter sorts on glossaryTerm, then the abbreviations are listed adjacent to their 'regular' entry, regardless of whether that is appropriate. The same issue exists if we sort on glossaryAbbr.

The problem is that each converters should be able to 'generate' its own sorting-value, so that the regular sorter can output glossaryTerm as its sorting value, and the abbreviation-converter can output glossaryAbbr.

How can we do this?

@RieksJ RieksJ added bug Something isn't working impact: HRGT labels Apr 29, 2024
@RieksJ
Copy link
Member Author

RieksJ commented Apr 29, 2024

one way, perhaps, is that we make pairs (converter, sorter)[i], where the output of each converter is assigned the sorting value provided by the sorter in that pair.

We could do that by expanding the current syntax with multiple sorters.

Alternatively, we could do another parameter that takes two converters, such as -<newparam>[i] <converter>, <sorter>. I would consider this if we were to require mappings, so that we don't allow handlebars templates to be specified - see #46.

@Ca5e
Copy link
Member

Ca5e commented May 20, 2024

Pardon the late reply, I've had little spare time.
I suppose it's possible to start working with converter-sorter pairs. The size of the change doesn't seem that large considering the mappings of these items still have to be reworked.
Thinking about the issue, I believe it might also be solvable by sorting on the converter output of the hrg entries instead of using the sorter before processing the entries. For instance by making the default sorter sort on the output of each generated item instead of the {{term}}{{termType}} default.

@RieksJ
Copy link
Member Author

RieksJ commented May 21, 2024

Good to hear!
If you were to sort the converter output, I would think it is possible that various kinds of layout stuff around the text could be influential to the sorting and provide undesired outputs as well. Also, it would prohibit, e.g., sorting entries according to - say - the 'date of update' (that would typically not occur in the first part of the output).
Unless you can deal with such things, I would think we should stick to the ({converter}, {sorter}) pairs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working impact: HRGT
Projects
None yet
Development

No branches or pull requests

2 participants