clld / clld-markdown-plugin

Render CLDF markdown in clld apps
Apache License 2.0
0 stars 0 forks source link

Authors not being displayed ordered in cldf:__all__ call #8

Closed davidainman closed 9 months ago

davidainman commented 9 months ago

When calling cldf:all, authors are written out as they are displayed in the bibtex, rather than with commas. It seems like comma_and_list() is not being called correctly here? Repro:

Source:

@article{michaeletal2014andean,
    title        = {Exploring phonological areality in the circum-Andean region using a Naive Bayes Classifier},
    author       = {Lev Michael and Chang, Will and Tammy Stark},
    year         = {2014},
    journal      = {Language Dynamics and Change},
    volume       = {4},
    number       = {1},
    pages        = {27--86},
    besttxt      = {ptxt\south_america\michael_circum-andean2014.txt},
    cfn          = {south_america\michael_circum-andean2014.pdf},
    delivered    = {south_america\michael_circum-andean2014.pdf},
    fn           = {south_america\michael_circum-andean2014.pdf, south_america\michael_circum-andean2014_o.pdf},
    hhtype       = {overview;comparative},
    inlg         = {English [eng]},
    macro_area   = {South America},
    src          = {hh}
}

When calling via markdown:

References

This appears in the output HTML as:

Lev Michael and Chang, Will and Tammy Stark. 2014. (etc)

xrotwang commented 9 months ago

Ah, the function comma_and_list is only used to string together links in the generated HTML. So, if - say - 3 parameters would be referenced using [](ParameterTable?ids=p1,p2,p3#cldf:__all__), it would create three links as link1, link2 and link3. There's no functionality to manipulate field content from BibTeX, since this would be quite a rabbit hole.

xrotwang commented 9 months ago

That said, I know that the Unified Stylesheet for Linguistics does have some rules for formatting author names. But it's clear that we cannot fullfil all these rules just by formatting. E.g.

All author/editor first names should be spelled out.

is only possible, if they are spelled out in the source data already ...

xrotwang commented 9 months ago

It turns out that it wasn't too hard to get the following:

from clldutils.source import Source
src = Source.from_bibtex("""@article{michaeletal2014andean,
    title        = {Exploring phonological areality in the circum-Andean region using a Naive Bayes Classifier},
    author       = {Lev Michael and Chang, Will and Tammy Stark},
    year         = {2014},
    journal      = {Language Dynamics and Change},
    volume       = {4},
    number       = {1},
    pages        = {27--86},
    besttxt      = {ptxt\south_america\michael_circum-andean2014.txt},
    cfn          = {south_america\michael_circum-andean2014.pdf},
    delivered    = {south_america\michael_circum-andean2014.pdf},
    fn           = {south_america\michael_circum-andean2014.pdf, south_america\michael_circum-andean2014_o.pdf},
    hhtype       = {overview;comparative},
    inlg         = {English [eng]},
    macro_area   = {South America},
    src          = {hh}
}""")
print(src.text())
Michael, Lev, Will Chang & Tammy Stark. 2014. Exploring phonological areality in the circum-Andean region using a Naive Bayes Classifier. Language Dynamics and Change 4. 27--86.

Is that what you would like to see?

davidainman commented 9 months ago

Wow, yes that is perfect!

xrotwang commented 9 months ago

released with clldutils 3.22