bdarcus / csln

Reimagining CSL
Mozilla Public License 2.0
12 stars 0 forks source link

string output, substitution #112

Closed bdarcus closed 11 months ago

bdarcus commented 11 months ago

I can't figure out how I want to do #105, so just added a basic refs_to_string function for now so I have some final rendering I can work with.

TODO

23:

I may defer these:

On #105, I was partly getting confused by the symbol names around "render", and so have split the traits and methods into instead "process" (converting input into ProcTemplateComponent items and vectors) and "value" (the strings using in the process output).

Not sure this is ideal ATM, or if I even really need traits for these, but it makes sense conceptually. And since I did make some progress here, and may finish it before merging, so I don't have to revert commits later.

Notes

Tracking author substitutions

I need to add some way to track author substitution, so can know what to do in citations and bibliography respectively. Initially I was adding a variable to the method, but I think maybe it's better to add one to the Processor; maybe to ProcHints ?

So when processing an editor, translator or title (the only substitution options ATM), can just check that, and forego processing if it's the same?

Either way, I think I need to add a author_substitute method.

Values

Right now, a ProcTemplateComponent holds a value string, which is created as part of that process, and incorporates formatting specs in the TemplateComponent.

But I suppose another approach would be to transform the InputReference into a collection of different types of value strings before they get to the templates; something like:

struct formattedReference {
  contributors: HashMap<ContributorRole, ContributorStrings>,
  ...
}

struct ContributorStrings {
  long: String,
  short: String,
  // affixes?
}

Could maybe even add a Trait for it?


Here's the current plain text output from the chicago bib example:


Tom Bissell. (2011). Extra Lives: Why Video Games Matter. Vintage Books.

Meghan Daum. (2015). Selfish, Shallow, and Self-Absorbed: Sixteen Writers on the Decision Not to Have Kids. Picador.

Glass, Jennifer, Levchak, Philip. (2014). Red States, Blue States, and Divorce: Understanding the Impact of Conservative Protestantism on Regional Variation in Divorce Rates. American Journal of Sociology. 119. 10.1086/674703.

Gunderson, Alex R, Leal, Manuel. (2015). Patterns of Thermal Constraint on Ectotherm Activity. American Naturalist. May 1. 10.1086/680849.

Michael Hutter. (2011). Infinite Surprises: Value in the Creative Industries. The Worth of Goods: Valuation and Pricing in the Economy. Oxford University Press.

Lampel, Joseph, Lant, Theresa, Shamsie, Jamal. (2000). Balancing Act: Learning from Organizing Practices in Cultural Industries. Organization Science. 11.

Jui-Ch’i Liu. (2015). Beholding the Feminine Sublime: Lee Miller’s War Photography. Signs. 40. 10.1086/678242.

Eva Meyerovitch. (1959). The Gnostic Manuscripts of Upper Egypt. Diogenes.