# quick analysis of macro names in styles

**URL:** <https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634>\
**Category:** CSL Development\
**Created:** [May 10, 2009, 4:12pm UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634 "2009-05-10T16:12:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [May 10, 2009, 4:12pm UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/1 "2009-05-10T16:12:20Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [May 10, 2009, 10:36pm UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/2 "2009-05-10T22:36:48Z")

</div>

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](https://canada1.discourse-cdn.com/flex029/uploads/citationstyles/original/1X/0a75114515f5d64b2119ba7d0187e992cbed0533.txt) (1.54 KB)

[top\_level\_macro\_counts.csv](https://canada1.discourse-cdn.com/flex029/uploads/citationstyles/original/1X/720435c2be80418bb8c1ddd86b495f54ae07b5d7.csv) (1.6 KB)

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [May 11, 2009, 12:27am UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/3 "2009-05-11T00:27:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [May 11, 2009, 1:18am UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/4 "2009-05-11T01:18:14Z")

</div>

> > 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. ☹

Frank

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 8, 2009, 7:09pm UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/5 "2009-08-08T19:09:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [August 9, 2009, 6:46am UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/6 "2009-08-09T06:46:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 9, 2009, 12:55pm UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/7 "2009-08-09T12:55:13Z")

</div>

Maybe loose schema validation that would still allow other values.

Bruce

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [August 9, 2009, 1:37pm UTC](https://discourse.citationstyles.org/t/quick-analysis-of-macro-names-in-styles/634/8 "2009-08-09T13:37:33Z")

</div>

> > 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
