quick analysis of macro names in styles

So apropos of the CSL wizard idea, I wrote a little script to iterate
through the zotero csl repo and list the macro names contains in the
styles, but numbers of occurrences. The results are below.

While this suggests we could use some rationalization, I should really
refine the script to distinguish top-level macros.

Code is here:

http://github.com/bdarcus/citeproc-py/blob/16593e4f6da061e2a890c0d1e963021ee542bc75/csl/repository.py

Bruce

Macro Names and Counts======================
publisher : 126
author : 114
title : 107
edition : 95
access : 93
editor : 93
author-short : 64
year-date : 45
pages : 38
issued : 35
editor-translator : 26
event : 25
anon : 25
locators : 24
container-contributors : 24
container-title : 22
secondary-contributors : 20
title-short : 20
contributors-short : 19
collection-title : 18
translator : 17
recipient : 15
interviewer : 15
day-month : 15
sort-key : 14
issue : 13
recipient-note : 12
recipient-short : 12
page : 12
container : 12
contributors : 12
point-locators : 12
archive : 12
description : 12
locators-newspaper : 12
point-locators-subsequent : 11
date : 10
volume : 10
citation-locator : 9
issued-year : 9
series-editor : 9
container-title-note : 8
interviewer-note : 8
editor-note : 8
contributors-sort : 8
edition-note : 8
access-note : 8
contributors-note : 8
locators-note : 8
issue-note : 8
translator-note : 8
archive-note : 8
title-note : 8
description-note : 7
secondary-contributors-note : 7
locators-chapter : 7
container-contributors-note : 7
container-prefix : 6
book-container : 5
locator : 5
published-date : 5
volumes : 5
locators-article : 4
pages-chapter : 4
pages-book-chapter : 4
pages-article : 4
pageno : 4
pageref : 4
locators-journal : 4
volref : 4
issuance : 4
secondary-container-contributors : 3
author-bib : 3
journal : 3
cite-date : 3
contributors-long : 3
collection : 3
secondary-collection-contributors : 3
source : 2
editor-short : 2
refpages : 2
name-macro : 2
at_page : 2
author1 : 2
author-bibliography : 2
day-date : 2
publisher-year : 2
doi : 2
container-editor : 2
author-citation : 1
book-publisher : 1
issued-month : 1
URL : 1
pageField : 1
citation-number : 1
journal-pages : 1
full-issued : 1
vols : 1
referenceDate : 1
series : 1
year : 1
date1 : 1
date2 : 1
original-publisher : 1
citeKey : 1
secondaryAuthor : 1
title-long : 1
locators-specific-note : 1
DOI : 1
patent-specifics : 1
number : 1
composer : 1
conference : 1
author-sort : 1
author-cit : 1
ref-date : 1
volume-macro : 1
editor-translator-short : 1
pagecount : 1
titleField : 1
original-author : 1
author-full : 1
additionaldate : 1
chapter-specifics : 1
rest-of-bib : 1
zotero2bibtexType : 1
year-sort : 1
publisher-place : 1
online : 1
month-date : 1

Here are the counts. I’ve included a CSV, since it might be handy to
have this in a spreadsheet.

Frank

top_level_macro_counts.txt (1.54 KB)

top_level_macro_counts.csv (1.6 KB)

Awesome; thanks!

Aside: I actually started to add a function that looks at the actual
macro calls in the layout elements, though am not quite done.

So there are 94 top-level macros. The top-25 are as follows. I’d like
to think we can rationalize these down to about 15 or so.

title
publisher
editor
author
edition
access
year-date
author-short
issued
pages
editor-translator
locators
collection-title
container-title
point-locators-subsequent
title-short
container-contributors
date
contributors-short
volume
locators-newspaper
container
page
pageref
point-locators

Here are the counts. I’ve included a CSV, since it might be handy to
have this in a spreadsheet.

Awesome; thanks!

Aside: I actually started to add a function that looks at the actual
macro calls in the layout elements, though am not quite done.

My pleasure!

Your python will be the better general tool My fiddle here ran
[citeproc-js hack] -> [file] -> [bash+sed] -> [file] -> [shell
pipeline]. Not exactly clean or transparent. :frowning:

Frank

Going back to this, I’ve been thinking about adding some reserved
macro names based on this. Any thoughts on this?

How will you enforce the proper use of these reserved macro names? Schema
validation or just documentation? How are you going to cope with existing
styles?

Rintze

Maybe loose schema validation that would still allow other values.

Bruce

Going back to this, I’ve been thinking about adding some reserved
macro names based on this. Any thoughts on this?

How will you enforce the proper use of these reserved macro names? Schema
validation or just documentation? How are you going to cope with existing
styles?

Maybe loose schema validation that would still allow other values.

The main reason for this is to align CSL creation tools to use the same
macro names, right? With the hope that that makes it easier to
mix/mash/maintain styles? I can’t say I see how this loose type of
validation would look like, or what kind of benefits it would have over just
documentation.

Rintze