Done and pushed to the PR
By using CSL it will be the CSL definition file that holds all the different formats for different sources…
All Gramps as a software need to do is to read the correct style and format for the different types.
And if Gramps as a project creates its own Citation Style, it can be sent back to the CSL organisation with a request to add it to the database of formats, CSL also support translations that can be added to the style…
PS. I do know that it is a little more than “just …” to make this working, but the features are already defined in the CSL style used, regardless of if it is APA, Chicago, or any other style.
In 5.2, the Citation plugin is a Global preference selection.
Is there a way to make a CITE plugin override (similar to the Name format and grouping can be overridden for an individual or a surname)?
Does the Citation plugin specification allow a FALLBACK to the Preference CITE plugin if criteria are not met?
2 examples:
- For all my Serial/Periodicals (or similarly ephemeral website sources), a different CITE formatter plugin is desireable. But these are exceptions or “edge cases”, unless specifed otherwise, the Preferences CITE plugin.
- if a Source (or Citation) had a specifically named Attribute (for inline, footnote, or endnote format) with hard‐coded Citation, then could the Preferences CITE selection be ignored?
I envisioned having the Style selected in Preferences, i.e. Chicago. Then for each Source, it would self-select its formatting from within the master Style based upon the Media Type from its Repository or manually set by the user. A Book source could have a different format than a magazine or electronic source.
The Citation may need an override for the best output option. Maybe have the citation editor display how it would actually appear in a report.
Reports generate a bibliography object and pass it to a CITE plugin. The bibliography object contains lists of source and citation handles for which a text representation is required.
A CITE plugin can generate the formatted citations in various ways. The legacy plugin just combines a few fields from the source and citation objects. A CSL formatter could take CSL variables stored in attributes and pass them to a library such as citeproc-py.
So you could write a CITE plugin to look for hard-coded citations stored in attributes. It could also look for a format string in an attribute that could be used to build a formatted citation from other attributes.
The style name would have to be specified in a configuration file, but you should be able to do all of this in v5.2.
A Style can be set in Preferences.
But within any given style it dictates that a book has one format:
Sam Staggs, Born to Be Hurt: The Untold Story of Imitation of Life (New York: St. Martin’s Press, 2009), 84.
while a magazine article is different:
First name, Last name of Chapter Author, “Chapter or Article Title,” in Book Title , ed. First Name Last Name of Editor (Publication Place: Publisher, Year), page range.
These two examples are both Chicago style. And there are others,
Currently 5.2 allows only one option (yes selected by the user) to be printed in a report regardless of the type of the source.
In my testing I used the style “chicago-fullnote-bibliography” and I hard-coded the CSL style to “article”, but you could store it in an attribute.
I have written some code that converts a Gramps citation object into JSON suitable for CSL input. The styles are available as XML files.
If anyone is interested in developing this further I can give them my experimental code.
The wiki needs some documentation for the use of the CITE (citation formatter) plugins. Created a landing page but it needs some illustrations.
The Enhanced citation formatter is supposedly the same as the Legacy version except that it includes the Repository Title (labeled “Name” in the Repository object editor) and Call Number.
Could the Biography quickview addon be modified as an example of how to use the CITE formatter?
The citation formatters are still experimental. They format Bibliography objects used in reports.
QuickView reports are still reports. Wouldn’t the Biography be a good representation of the use of a citation formatter of a Bibliography and its output? It would have far less latency than generating a full report and then viewing it.
Users could use the Quick View gramplet to aid validation of the selection.
Having immediate feedback in the Preferences when selecting a “Citation formatter” would probably be unsafe. (Similar to the feedback when creating a new format in the Display Name Editor.) Because if there was a fatal error rendering the sample citation/source/repository using the selected Citation Format, then the interface would be inaccessible for switching to another format.
Any code can use a citation formatter. Just pass it a Bibliography object and it will return formatted results.
OK. So the Reports that reference a Bibliography are:
Builtins:
- Detailed Ancestral Report source text report
- Detailed Descendant Report source text report
- Family source web report
- Individual Complete source text report
- Person source, base page source, Place source, Media source, Statistics source web report