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

Style syntax for formatting multiple locators #342

Open
denismaier opened this issue Aug 4, 2020 · 13 comments
Open

Style syntax for formatting multiple locators #342

denismaier opened this issue Aug 4, 2020 · 13 comments
Milestone

Comments

@denismaier
Copy link
Member

denismaier commented Aug 4, 2020

Some style guides, e.g. Chicago, require certain combinations of locators to be formatted differently. E.g.:

A combination of page and line locators is cited as:

p. 15, line 10

However, a combination of volume and page is not cited as "vol. 5, p. 82", but as:

5:82

I think we could handle this on a style basis, similar to the existing editortranslator collapsing. Like with a style level attribute collapse-volume-page-in-locator.

Say we have this:

"locators": [{"volume": 2}, {"page": 12}]
collapse-volume-page-in-locator="true" => "2:12"
collapse-volume-page-in-locator="false" => "vol. 2, p. 12"

Of course, there's also the question if there are other relevant combinations.

@bdarcus
Copy link
Member

bdarcus commented Aug 4, 2020 via email

@denismaier
Copy link
Member Author

Possible there are other such examples, that would require a more general solution?

There may well be. In classics and theology they have special pattern for "book, chapter, verse, line" combinations. And those may even be different for different works.

@bdarcus
Copy link
Member

bdarcus commented Aug 4, 2020 via email

@denismaier
Copy link
Member Author

So then we'd probably want this configured in a macro at the end; no?

Either this, or a cs:locators sibling to cs:citation. Whatever seems more convenient.

@denismaier
Copy link
Member Author

While we have your attention @andras-simonyi, what do you think about this in light of your locators proposal?

@andras-simonyi
Copy link

andras-simonyi commented Aug 5, 2020

It would be nice to see whether there are other non work-specific (i.e., not valid only for the Bible, for Plato's works etc.) examples of this kind of special rule that are relatively common in addition to the Chicago volume/page requirement. As for work-specific rules, do we want to support this? How could something like this be approached within the CSL framework?

@denismaier
Copy link
Member Author

I don't know about other common combinations besides volume and page.

How could something like this be approached within the CSL framework?

Biblatex knows pagination and bookpagination fields. We could add something similar, and also locatorscheme or similar.
Or we could just make this dependent on item types. E.g. styles could suppress locator terms for items with type classic.

@bwiernik
Copy link
Member

bwiernik commented Aug 12, 2020

Note that the Chicago CSL styles appear to already have some sort of solution already not using locators, but using the volume or issue variables some item types. This works if "Collected Works, Volume 1" is entered as the item, rather than the whole "Collected Works".

If we did want do more here, I think we can handle this generally by expanding on the existing locator style syntax.

We already allow conditional tests (currently used for conditional label formatting):

<if locator="volume">
  <text variable="locator"/>
</if>
<else>
  <label variable="locator" suffix=" "/>
  <text variable="locator"/>
</else>

We need a way to specify the locator delimiter anyway. We could add cs:locator and give it a delimiter attribute for that. The delimiter attribute would indicate the delimter that comes after a locator of that type. So for example:

<if locator="volume">
  <locator delimiter=":"/>
</if>
<else>
  <locator delimiter=", ">
    <label variable="locator" suffix=" ">
  </locator>
</else>

To handle different formatting of the label depending on whether a page has a line number vs. not (e.g., 128 for a page number normally, but p. 15, line 10 if there is a line number, we could add the condition additional-locators="true" or multiple-locators="true":

<if locator="volume">
  <locator delimiter=":"/>
</if>
<else-if additional-locators="true">
  <locator delimiter=", ">
    <label variable="locator" suffix=" ">
  </locator>
</else-if>
<else-if locator="page">
  <locator/>
</else-if>
<else>
  <locator delimiter=", ">
    <label variable="locator" suffix=" ">
  </locator>
</else>

@bwiernik bwiernik added this to the CSL 1.1 milestone Aug 12, 2020
@bwiernik bwiernik changed the title Support for volume-page-locator combinations Style syntax for formatting multiple locators Aug 12, 2020
@bwiernik
Copy link
Member

Changed the title to reflec the more general problem of formatting multiple locators

@denismaier
Copy link
Member Author

Looks like there is one major caveat: volume can be part of the item metadata, or it can be one of the locators. Both situation may require different solutions.

Regarding testing behavior: I think we could add a new value "exact" for @match. This would test true if only the specified locators are present:

<if locators="volume page" match="exact">
formatting if we have volume and page, but nothing else
</if>
<else-if locators="page" match="exact">
formatting if we have only page
</else-if>
<else>
formatting in all other situations
</else>

match="exact" could be made the default when testing for locators.

@bwiernik
Copy link
Member

I don't think that's necessary. It's covered by my example above. If there is volume+page, it will render "volume:page". If there is volume as metadata and page as locator, it will just render page.

@denismaier
Copy link
Member Author

denismaier commented Aug 12, 2020

I don't think that's necessary. It's covered by my example above. If there is volume+page, it will render "volume:page". If there is volume as metadata and page as locator, it will just render page.

Ok. What if you want "p. 15, line 4", but "book 3, part 4, chapter 3, section2" should be rendered as "3:4:3:2"?
(Perhaps not a realistic scenario, though)

@denismaier
Copy link
Member Author

I don't think that's necessary. It's covered by my example above. If there is volume+page, it will render "volume:page". If there is volume as metadata and page as locator, it will just render page.

Ok. What if you want "p. 15, line 4", but "book 3, part 4, chapter 3, section2" should be rendered as "3:4:3:2"?
(Perhaps not a realistic scenario, though)

Or, that might depend more on item type than on the actual presence of certain locators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants