Browse code

3.99.12

ramon diaz-uriarte (at Phelsuma) authored on 19/10/2022 19:10:17
Showing 7 changed files

... ...
@@ -1,8 +1,8 @@
1 1
 Package: OncoSimulR
2 2
 Type: Package
3 3
 Title: Forward Genetic Simulation of Cancer Progression with Epistasis 
4
-Version: 3.99.11
5
-Date: 2022-10-13
4
+Version: 3.99.12
5
+Date: 2022-10-19
6 6
 Authors@R: c(
7 7
 	      person("Ramon", "Diaz-Uriarte", role = c("aut", "cre"),	
8 8
  	   		     email = "rdiaz02@gmail.com"),
... ...
@@ -1,3 +1,23 @@
1
+Changes in version 4.0 (for BioC 3.16):
2
+	- MAJOR change: users can simulate interventions and adaptive therapy,
3
+	  as well as define, track, and use in fitness-dependent specifications
4
+	  user-defined variables.
5
+	- MAJOR change: users can specify birth and death rates as they want,
6
+	  including making both or just one frequency-dependent.
7
+	- onlyCancer = FALSE by default in all calls to oncoSimul*.
8
+	  This is a possible BRAEKING CHANGE.
9
+	- Plot fails with a meaningful error if simulations
10
+	  had unrecoverable exception or hit max wall time
11
+	  or max num tries.	  
12
+	- Improvements in vignette speed.
13
+	- Improvements in compilation speed.
14
+
15
+Changes in version 3.99.12 (2022-10-19):
16
+	- Try to allow vignette to build successfully in the ARM64 Mac build:
17
+	  use a try(plot) in chunk fdfmutex2.
18
+	- Use apa style citation and a few fixes to bib.
19
+	- Minor additions to vignette.
20
+
1 21
 Changes in version 3.99.11 (2022-10-13):
2 22
 	- Increase max.wall.time of two tests, as in very slow Windoze machines
3 23
 	  they can hit max wall time.
... ...
@@ -96,12 +96,12 @@ test_that("2. Drastically reducing a high-fitness genotype population (Exp) | Tr
96 96
     set.seed(1)
97 97
     df3x <- data.frame(Genotype = c("WT", "B", "R"),
98 98
                        Fitness = c("1 + (n_ * 0)",
99
-                                    "1.5",
100
-                                    "1.003 + 0.002 * (n_B > 120)"))
99
+                                   "1.5",
100
+                                   "1.003 + 0.002 * (n_B > 120)"))
101 101
 
102 102
     afd3 <- allFitnessEffects(genotFitness = df3x,
103
-                          frequencyDependentFitness = TRUE,
104
-                          frequencyType = "abs")
103
+                              frequencyDependentFitness = TRUE,
104
+                              frequencyType = "abs")
105 105
 
106 106
     interventions <- list(
107 107
         list(
... ...
@@ -142,33 +142,31 @@ test_that("2. Drastically reducing a high-fitness genotype population (Exp) | Tr
142 142
     ## }`: argument is of length zero
143 143
     ## So only run if not on a Mac
144 144
     ## FIXME: this is because the above fails hitting wall time
145
-##    if (Sys.info()["sysname"] != "Darwin") {
146
-        flag <- FALSE
147
-        i <- 20002
148
-        while(i <= 70001){
149
-            if(ep2$pops.by.time[i, 3:3] >= 210){
150
-                flag <- TRUE
151
-            }
152
-            i <- i + 1
145
+    ##    if (Sys.info()["sysname"] != "Darwin") {
146
+    flag <- FALSE
147
+    i <- 20002
148
+    while(i <= 70001) {
149
+        if(ep2$pops.by.time[i, 3:3] >= 210) {
150
+            flag <- TRUE
153 151
         }
154
-        testthat::expect_equal(flag, FALSE)
155
-
156
-
157
-        ## then, between the time intervals, T >= 80 and T<=85
158
-        ## we control that the B population
159
-        flag <- FALSE
160
-        i <- 80002
161
-        while(i <= 85000){
162
-            if(ep2$pops.by.time[i, 3:3] > 40){
163
-                flag <- TRUE
164
-            }
165
-            i <- i + 1
152
+        i <- i + 1
153
+    }
154
+    testthat::expect_equal(flag, FALSE)
155
+
156
+
157
+    ## then, between the time intervals, T >= 80 and T<=85
158
+    ## we control that the B population
159
+    flag <- FALSE
160
+    i <- 80002
161
+    while(i <= 85000) {
162
+        if(ep2$pops.by.time[i, 3:3] > 40){
163
+            flag <- TRUE
166 164
         }
165
+        i <- i + 1
166
+    }
167 167
 
168
-        testthat::expect_equal(flag, FALSE)
169
-        ## we plot the simulation when no interventions are specified.
170
-        ## plot(ep2, show = "genotypes", type = "line")
171
-##    }
168
+    testthat::expect_equal(flag, FALSE)
169
+    ##    }
172 170
 })
173 171
 
174 172
 cat(paste("\n Ending interventions tests", date(), "\n"))
... ...
@@ -23,7 +23,8 @@ classoption: a4paper
23 23
 geometry: margin=3cm
24 24
 fontsize: 12pt
25 25
 bibliography: OncoSimulR.bib
26
-biblio-style: "apalike"
26
+biblio-style: apa
27
+csl: apa.csl
27 28
 link-citations: true
28 29
 vignette: >
29 30
   %\VignetteIndexEntry{OncoSimulR: forward genetic simulation in asexual populations with arbitrary epistatic interactions and a focus on modeling tumor progression.}
... ...
@@ -1365,7 +1366,11 @@ starting from BioConductor 3.2 (and, of course, available too from
1365 1366
 development versions of BioC).  So, if you are using the current stable or
1366 1367
 development version of BioConductor, or you grab the sources from GitHub
1367 1368
 (<https://github.com/rdiaz02/OncoSimul>) you are using what we call
1368
-version 2. **The functionality of version has been removed.**
1369
+version 2. **The functionality of version 1 has been removed.**
1370
+
1371
+Version 3 (for BioConductor 3.13) made frequency dependent fitness available in the stable version. 
1372
+
1373
+Version 4 (BioConductor 3.16) introduces interventions and the possibility to specify, separately, birth and death (including frequency dependence).
1369 1374
 
1370 1375
 
1371 1376
 
... ...
@@ -3484,7 +3489,7 @@ Exp and Bozic models, or depends on the population size). This is
3484 3489
 also shown in Table \@ref(tab:osrfeatures), in the rows for "Fitness
3485 3490
 components", under "Evolutionary Features".
3486 3491
 
3487
-In the case of frequency-dependent fitness simulations (\@ref(fdf)), the
3492
+In the case of frequency-dependent fitness simulations (see section \@ref(fdf)), the
3488 3493
 fitness effects must be reevaluated frequently so that birth rate, death
3489 3494
 rate, or both, depending the model used, are updated. To do this it is
3490 3495
 necessary to use a short step to reevaluate fitness; this is done using a
... ...
@@ -3565,7 +3570,7 @@ as possible. Thus, there are two main ways of specifying fitness effects:
3565 3570
   
3566 3571
 * Explicitly passing to OncoSimulR a mapping of genotypes to
3567 3572
   fitness. Here you specify the fitness of each genotype. We will refer to
3568
-  this as the **explicit mapping of genotypes to fitness**.
3573
+  this as the **explicit mapping of genotypes to fitness**. This includes frequency-dependent fitness (section \@ref(fdf)).
3569 3574
 
3570 3575
 
3571 3576
 
... ...
@@ -9856,7 +9861,13 @@ s2fd <- oncoSimulIndiv(afe4,
9856 9861
                      seed = NULL, 
9857 9862
                      errorHitMaxTries = FALSE, 
9858 9863
                      errorHitWallTime = FALSE)
9859
-plot(s2fd, show = "genotypes")
9864
+
9865
+## In the Mac ARM64 architecture, the above
9866
+## run leads to an exception, which is really odd.
9867
+## While that is debugged, use try to prevent
9868
+## failure of the plot to abort vignette building.
9869
+
9870
+try(plot(s2fd, show = "genotypes"))
9860 9871
 ```
9861 9872
 
9862 9873
 ```{r echo=FALSE}
... ...
@@ -243,7 +243,7 @@ year = {1962}
243 243
 }
244 244
 
245 245
 @article{Ortmann2015,
246
-  author =        {Ortmann, Christina a. and Kent, David G. and
246
+  author =        {Ortmann, Christina A. and Kent, David G. and
247 247
                    Nangalia, Jyoti and Silber, Yvonne and
248 248
                    Wedge, David C. and Grinfeld, Jacob and
249 249
                    Baxter, E. Joanna and Massie, Charles E. and
... ...
@@ -314,13 +314,13 @@ year = {1962}
314 314
 
315 315
 
316 316
 @article{McFarland2014,
317
+  author = {McFarland, Christopher D and Mirny, Leonid and Korolev, Kirill S},
317 318
   title = {A Tug-of-War between Driver and Passenger Mutations in Cancer and Other Adaptive Processes},
318 319
   volume = {111},
319 320
   issn = {10916490},
320 321
   doi = {10.1101/003053},
321 322
   number = {42},
322 323
   journal = {Proc Natl Acad Sci U S A},
323
-  author = {McFarland, Christopher and Mirny, Leonid and Korolev, Kirill S.},
324 324
   year = {2014},
325 325
   pages = {15138--15143},
326 326
 }
... ...
@@ -424,7 +424,7 @@ year = {1962}
424 424
 }
425 425
 
426 426
 @phdthesis{McFarland2014-phd,
427
-  author =        {McFarland, CD},
427
+  author =        {McFarland, Christopher D},
428 428
   school =        {Harvard University},
429 429
   title =         {{The role of deleterious passengers in cancer}},
430 430
   year =          {2014},
... ...
@@ -663,18 +663,18 @@ year = {2007}
663 663
 }
664 664
 
665 665
 @article{tomlinson_mutation_1996,
666
+  author = {Tomlinson, I P and Novelli, M R and Bodmer, W F},
666 667
   title = {The mutation rate and cancer},
667 668
   volume = {93},
668 669
   issn = {0027-8424},
669 670
   language = {eng},
670 671
   number = {25},
671 672
   journal = {Proceedings of the National Academy of Sciences of the United States of America},
672
-  author = {Tomlinson, I. P. and Novelli, M. R. and Bodmer, W. F.},
673 673
   month = dec,
674 674
   year = {1996},
675 675
   pages = {14800--14803},
676 676
   pmid = {8962135},
677
-  pmcid = {PMC26216}
677
+  pmcid = {PMC26216},
678 678
 }
679 679
 
680 680
 
... ...
@@ -797,6 +797,7 @@ year = {2007}
797 797
 
798 798
 
799 799
 @article{tomlinson1997a,
800
+  author = {Tomlinson, I P },
800 801
   title = {Game-Theory Models of Interactions between Tumour Cells},
801 802
   volume = {33},
802 803
   issn = {09598049},
... ...
@@ -804,10 +805,9 @@ year = {2007}
804 805
   journal = {European Journal of Cancer},
805 806
   doi = {10.1016/S0959-8049(97)00170-6},
806 807
   url = {https://linkinghub.elsevier.com/retrieve/pii/S0959804997001706},
807
-  author = {Tomlinson, I.P.M.},
808 808
   month = aug,
809 809
   year = {1997},
810
-  pages = {1495-1500}
810
+  pages = {1495-1500},
811 811
 }
812 812
 
813 813
 
814 814
new file mode 100644
... ...
@@ -0,0 +1,1917 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never" page-range-format="expanded">
3
+  <info>
4
+    <title>American Psychological Association 7th edition</title>
5
+    <title-short>APA</title-short>
6
+    <id>http://www.zotero.org/styles/apa</id>
7
+    <link href="http://www.zotero.org/styles/apa" rel="self"/>
8
+    <link href="http://www.zotero.org/styles/apa-6th-edition" rel="template"/>
9
+    <link href="https://apastyle.apa.org/style-grammar-guidelines/references/examples" rel="documentation"/>
10
+    <author>
11
+      <name>Brenton M. Wiernik</name>
12
+      <email>zotero@wiernik.org</email>
13
+    </author>
14
+    <category citation-format="author-date"/>
15
+    <category field="psychology"/>
16
+    <category field="generic-base"/>
17
+    <updated>2022-10-02T20:08:41+00:00</updated>
18
+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
19
+  </info>
20
+  <locale xml:lang="en">
21
+    <terms>
22
+      <term name="editortranslator" form="short">
23
+        <single>ed. &amp; trans.</single>
24
+        <multiple>eds. &amp; trans.</multiple>
25
+      </term>
26
+      <term name="translator" form="short">trans.</term>
27
+      <term name="interviewer" form="short">
28
+        <single>interviewer</single>
29
+        <multiple>interviewers</multiple>
30
+      </term>
31
+      <term name="collection-editor" form="short">
32
+        <single>ed.</single>
33
+        <multiple>eds.</multiple>
34
+      </term>
35
+      <term name="circa" form="short">ca.</term>
36
+      <term name="bc"> B.C.E.</term>
37
+      <term name="ad"> C.E.</term>
38
+      <term name="letter">personal communication</term>
39
+      <term name="letter" form="short">letter</term>
40
+      <term name="issue" form="long">
41
+        <single>issue</single>
42
+        <multiple>issues</multiple>
43
+      </term>
44
+    </terms>
45
+  </locale>
46
+  <locale xml:lang="af">
47
+    <terms>
48
+      <term name="letter">persoonlike kommunikasie</term>
49
+      <term name="letter" form="short">brief</term>
50
+    </terms>
51
+  </locale>
52
+  <locale xml:lang="ar">
53
+    <terms>
54
+      <term name="letter">اتصال شخصي</term>
55
+      <term name="letter" form="short">خطاب</term>
56
+    </terms>
57
+  </locale>
58
+  <locale xml:lang="bg">
59
+    <terms>
60
+      <term name="letter">лична комуникация</term>
61
+      <term name="letter" form="short">писмо</term>
62
+    </terms>
63
+  </locale>
64
+  <locale xml:lang="ca">
65
+    <terms>
66
+      <term name="letter">comunicació personal</term>
67
+      <term name="letter" form="short">carta</term>
68
+    </terms>
69
+  </locale>
70
+  <locale xml:lang="cs">
71
+    <terms>
72
+      <term name="letter">osobní komunikace</term>
73
+      <term name="letter" form="short">dopis</term>
74
+    </terms>
75
+  </locale>
76
+  <locale xml:lang="cy">
77
+    <terms>
78
+      <term name="letter">cyfathrebu personol</term>
79
+      <term name="letter" form="short">llythyr</term>
80
+    </terms>
81
+  </locale>
82
+  <locale xml:lang="da">
83
+    <terms>
84
+      <term name="et-al">et al.</term>
85
+      <term name="letter">personlig kommunikation</term>
86
+      <term name="letter" form="short">brev</term>
87
+    </terms>
88
+  </locale>
89
+  <locale xml:lang="de">
90
+    <terms>
91
+      <term name="et-al">et al.</term>
92
+      <term name="letter">persönliche Kommunikation</term>
93
+      <term name="letter" form="short">Brief</term>
94
+    </terms>
95
+  </locale>
96
+  <locale xml:lang="el">
97
+    <terms>
98
+      <term name="letter">προσωπική επικοινωνία</term>
99
+      <term name="letter" form="short">επιστολή</term>
100
+    </terms>
101
+  </locale>
102
+  <locale xml:lang="es">
103
+    <terms>
104
+      <term name="from">de</term>
105
+      <term name="letter">comunicación personal</term>
106
+      <term name="letter" form="short">carta</term>
107
+    </terms>
108
+  </locale>
109
+  <locale xml:lang="et">
110
+    <terms>
111
+      <term name="letter">isiklik suhtlus</term>
112
+      <term name="letter" form="short">kiri</term>
113
+    </terms>
114
+  </locale>
115
+  <locale xml:lang="eu">
116
+    <terms>
117
+      <term name="letter">komunikazio pertsonala</term>
118
+      <term name="letter" form="short">gutuna</term>
119
+    </terms>
120
+  </locale>
121
+  <locale xml:lang="fa">
122
+    <terms>
123
+      <term name="letter">ارتباط شخصی</term>
124
+      <term name="letter" form="short">نامه</term>
125
+    </terms>
126
+  </locale>
127
+  <locale xml:lang="fi">
128
+    <terms>
129
+      <term name="letter">henkilökohtainen viestintä</term>
130
+      <term name="letter" form="short">kirje</term>
131
+    </terms>
132
+  </locale>
133
+  <locale xml:lang="fr">
134
+    <terms>
135
+      <term name="letter">communication personnelle</term>
136
+      <term name="letter" form="short">lettre</term>
137
+      <term name="editor" form="short">
138
+        <single>éd.</single>
139
+        <multiple>éds.</multiple>
140
+      </term>
141
+    </terms>
142
+  </locale>
143
+  <locale xml:lang="he">
144
+    <terms>
145
+      <term name="letter">תקשורת אישית</term>
146
+      <term name="letter" form="short">מכתב</term>
147
+    </terms>
148
+  </locale>
149
+  <locale xml:lang="hr">
150
+    <terms>
151
+      <term name="letter">osobna komunikacija</term>
152
+      <term name="letter" form="short">pismo</term>
153
+    </terms>
154
+  </locale>
155
+  <locale xml:lang="hu">
156
+    <terms>
157
+      <term name="letter">személyes kommunikáció</term>
158
+      <term name="letter" form="short">levél</term>
159
+    </terms>
160
+  </locale>
161
+  <locale xml:lang="id">
162
+    <terms>
163
+      <term name="letter">komunikasi pribadi</term>
164
+      <term name="letter" form="short">surat</term>
165
+    </terms>
166
+  </locale>
167
+  <locale xml:lang="is">
168
+    <terms>
169
+      <term name="letter">persónuleg samskipti</term>
170
+      <term name="letter" form="short">bréf</term>
171
+    </terms>
172
+  </locale>
173
+  <locale xml:lang="it">
174
+    <terms>
175
+      <term name="letter">comunicazione personale</term>
176
+      <term name="letter" form="short">lettera</term>
177
+    </terms>
178
+  </locale>
179
+  <locale xml:lang="ja">
180
+    <terms>
181
+      <term name="letter">個人的なやり取り</term>
182
+      <term name="letter" form="short">手紙</term>
183
+    </terms>
184
+  </locale>
185
+  <locale xml:lang="ko">
186
+    <terms>
187
+      <term name="letter">개인 서신</term>
188
+      <term name="letter" form="short">편지</term>
189
+    </terms>
190
+  </locale>
191
+  <locale xml:lang="la">
192
+    <terms>
193
+      <term name="letter"/>
194
+      <term name="letter" form="short">epistula</term>
195
+    </terms>
196
+  </locale>
197
+  <locale xml:lang="lt">
198
+    <terms>
199
+      <term name="letter">communicationis personalis</term>
200
+      <term name="letter" form="short"/>
201
+    </terms>
202
+  </locale>
203
+  <locale xml:lang="lv">
204
+    <terms>
205
+      <term name="letter">personīga komunikācija</term>
206
+      <term name="letter" form="short">vēstule</term>
207
+    </terms>
208
+  </locale>
209
+  <locale xml:lang="mn">
210
+    <terms>
211
+      <term name="letter">хувийн харилцаа холбоо</term>
212
+      <term name="letter" form="short">захиа</term>
213
+    </terms>
214
+  </locale>
215
+  <locale xml:lang="nb">
216
+    <terms>
217
+      <term name="et-al">et al.</term>
218
+      <term name="letter">personlig kommunikasjon</term>
219
+      <term name="letter" form="short">brev</term>
220
+    </terms>
221
+  </locale>
222
+  <locale xml:lang="nl">
223
+    <terms>
224
+      <term name="et-al">et al.</term>
225
+      <term name="letter">persoonlijke communicatie</term>
226
+      <term name="letter" form="short">brief</term>
227
+    </terms>
228
+  </locale>
229
+  <locale xml:lang="nn">
230
+    <terms>
231
+      <term name="et-al">et al.</term>
232
+      <term name="letter">personlig kommunikasjon</term>
233
+      <term name="letter" form="short">brev</term>
234
+    </terms>
235
+  </locale>
236
+  <locale xml:lang="pl">
237
+    <terms>
238
+      <term name="letter">osobista komunikacja</term>
239
+      <term name="letter" form="short">list</term>
240
+    </terms>
241
+  </locale>
242
+  <locale xml:lang="pt">
243
+    <terms>
244
+      <term name="letter">comunicação pessoal</term>
245
+      <term name="letter" form="short">carta</term>
246
+    </terms>
247
+  </locale>
248
+  <locale xml:lang="ro">
249
+    <terms>
250
+      <term name="letter">comunicare personală</term>
251
+      <term name="letter" form="short">scrisoare</term>
252
+    </terms>
253
+  </locale>
254
+  <locale xml:lang="ru">
255
+    <terms>
256
+      <term name="letter">личная переписка</term>
257
+      <term name="letter" form="short">письмо</term>
258
+    </terms>
259
+  </locale>
260
+  <locale xml:lang="sk">
261
+    <terms>
262
+      <term name="letter">osobná komunikácia</term>
263
+      <term name="letter" form="short">list</term>
264
+    </terms>
265
+  </locale>
266
+  <locale xml:lang="sl">
267
+    <terms>
268
+      <term name="letter">osebna komunikacija</term>
269
+      <term name="letter" form="short">pismo</term>
270
+    </terms>
271
+  </locale>
272
+  <locale xml:lang="sr">
273
+    <terms>
274
+      <term name="letter">лична комуникација</term>
275
+      <term name="letter" form="short">писмо</term>
276
+    </terms>
277
+  </locale>
278
+  <locale xml:lang="sv">
279
+    <terms>
280
+      <term name="letter">personlig kommunikation</term>
281
+      <term name="letter" form="short">brev</term>
282
+    </terms>
283
+  </locale>
284
+  <locale xml:lang="th">
285
+    <terms>
286
+      <term name="letter">การสื่อสารส่วนบุคคล</term>
287
+      <term name="letter" form="short">จดหมาย</term>
288
+    </terms>
289
+  </locale>
290
+  <locale xml:lang="tr">
291
+    <terms>
292
+      <term name="letter">kişisel iletişim</term>
293
+      <term name="letter" form="short">mektup</term>
294
+    </terms>
295
+  </locale>
296
+  <locale xml:lang="uk">
297
+    <terms>
298
+      <term name="letter">особисте спілкування</term>
299
+      <term name="letter" form="short">лист</term>
300
+    </terms>
301
+  </locale>
302
+  <locale xml:lang="vi">
303
+    <terms>
304
+      <term name="letter">giao tiếp cá nhân</term>
305
+      <term name="letter" form="short">thư</term>
306
+    </terms>
307
+  </locale>
308
+  <locale xml:lang="zh-CN">
309
+    <terms>
310
+      <term name="letter">的私人交流</term>
311
+      <term name="letter" form="short">信函</term>
312
+    </terms>
313
+  </locale>
314
+  <locale xml:lang="zh-TW">
315
+    <terms>
316
+      <term name="letter">私人通訊</term>
317
+      <term name="letter" form="short">信函</term>
318
+    </terms>
319
+  </locale>
320
+  <!-- General categories of item types:
321
+       Periodical: article-journal article-magazine article-newspaper post-weblog review review-book
322
+       Periodical or Booklike: paper-conference
323
+       Booklike: article book broadcast chapter dataset entry entry-dictionary entry-encyclopedia figure
324
+                 graphic interview manuscript map motion_picture musical_score pamphlet patent
325
+                 personal_communication report song speech thesis post webpage
326
+       Legal: bill legal_case legislation treaty
327
+  -->
328
+  <!-- APA references contain four parts: author, date, title, source -->
329
+  <macro name="author-bib">
330
+    <names variable="composer" delimiter=", ">
331
+      <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
332
+      <substitute>
333
+        <names variable="author"/>
334
+        <names variable="illustrator"/>
335
+        <names variable="director">
336
+          <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
337
+          <label form="long" prefix=" (" suffix=")" text-case="title"/>
338
+        </names>
339
+        <choose>
340
+          <if variable="container-title">
341
+            <choose>
342
+              <if type="book entry entry-dictionary entry-encyclopedia" match="any">
343
+                <choose>
344
+                  <if variable="title">
345
+                    <group delimiter=" ">
346
+                      <text macro="title"/>
347
+                      <text macro="parenthetical"/>
348
+                    </group>
349
+                  </if>
350
+                  <else>
351
+                    <text macro="title-and-descriptions"/>
352
+                  </else>
353
+                </choose>
354
+              </if>
355
+            </choose>
356
+          </if>
357
+        </choose>
358
+        <!-- Test for editortranslator and put that first as that becomes available -->
359
+        <names variable="editor" delimiter=", ">
360
+          <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
361
+          <label form="short" prefix=" (" suffix=")" text-case="title"/>
362
+        </names>
363
+        <names variable="editorial-director">
364
+          <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
365
+          <label form="short" prefix=" (" suffix=")" text-case="title"/>
366
+        </names>
367
+        <names variable="collection-editor">
368
+          <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
369
+          <label form="short" prefix=" (" suffix=")" text-case="title"/>
370
+        </names>
371
+        <choose>
372
+          <if variable="title">
373
+            <group delimiter=" ">
374
+              <text macro="title"/>
375
+              <text macro="parenthetical"/>
376
+            </group>
377
+          </if>
378
+          <else>
379
+            <text macro="title-and-descriptions"/>
380
+          </else>
381
+        </choose>
382
+      </substitute>
383
+    </names>
384
+  </macro>
385
+  <macro name="author-intext">
386
+    <choose>
387
+      <if type="bill legal_case legislation treaty" match="any">
388
+        <text macro="title-intext"/>
389
+      </if>
390
+      <else-if type="interview personal_communication" match="any">
391
+        <choose>
392
+          <!-- These variables indicate that the letter is retrievable by the reader.
393
+                If not, then use the APA in-text-only personal communication format -->
394
+          <if variable="archive container-title DOI publisher URL" match="none">
395
+            <group delimiter=", ">
396
+              <names variable="author">
397
+                <name and="symbol" delimiter=", " initialize-with=". "/>
398
+                <substitute>
399
+                  <text macro="title-intext"/>
400
+                </substitute>
401
+              </names>
402
+              <!-- Replace with term="personal-communication" if that becomes available -->
403
+              <text term="letter"/>
404
+            </group>
405
+          </if>
406
+          <else>
407
+            <names variable="author" delimiter=", ">
408
+              <name form="short" and="symbol" delimiter=", " initialize-with=". "/>
409
+              <substitute>
410
+                <text macro="title-intext"/>
411
+              </substitute>
412
+            </names>
413
+          </else>
414
+        </choose>
415
+      </else-if>
416
+      <else>
417
+        <names variable="composer" delimiter=", ">
418
+          <name form="short" and="symbol" delimiter=", " initialize-with=". "/>
419
+          <substitute>
420
+            <names variable="author"/>
421
+            <names variable="illustrator"/>
422
+            <names variable="director"/>
423
+            <choose>
424
+              <if variable="container-title">
425
+                <choose>
426
+                  <if type="book entry entry-dictionary entry-encyclopedia" match="any">
427
+                    <text macro="title-intext"/>
428
+                  </if>
429
+                </choose>
430
+              </if>
431
+            </choose>
432
+            <names variable="editor"/>
433
+            <names variable="editorial-director"/>
434
+            <text macro="title-intext"/>
435
+          </substitute>
436
+        </names>
437
+      </else>
438
+    </choose>
439
+  </macro>
440
+  <macro name="date-bib">
441
+    <group delimiter=" " prefix="(" suffix=")">
442
+      <choose>
443
+        <if is-uncertain-date="issued">
444
+          <text term="circa" form="short"/>
445
+        </if>
446
+      </choose>
447
+      <group>
448
+        <choose>
449
+          <if variable="issued">
450
+            <date variable="issued">
451
+              <date-part name="year"/>
452
+            </date>
453
+            <text variable="year-suffix"/>
454
+            <choose>
455
+              <if type="article-magazine article-newspaper broadcast interview motion_picture pamphlet personal_communication post post-weblog song speech webpage" match="any">
456
+                <!-- Many video and audio examples in manual give full dates. Err on the side of too much information. -->
457
+                <date variable="issued">
458
+                  <date-part prefix=", " name="month"/>
459
+                  <date-part prefix=" " name="day"/>
460
+                </date>
461
+              </if>
462
+              <else-if type="paper-conference">
463
+                <!-- Capture 'speech' stored as 'paper-conference' -->
464
+                <choose>
465
+                  <if variable="collection-editor editor editorial-director issue page volume" match="none">
466
+                    <date variable="issued">
467
+                      <date-part prefix=", " name="month"/>
468
+                      <date-part prefix=" " name="day"/>
469
+                    </date>
470
+                  </if>
471
+                </choose>
472
+              </else-if>
473
+              <!-- Only year: article article-journal book chapter entry entry-dictionary entry-encyclopedia dataset figure graphic
474
+                   manuscript map musical_score paper-conference[published] patent report review review-book thesis -->
475
+            </choose>
476
+          </if>
477
+          <else-if variable="status">
478
+            <group>
479
+              <text variable="status" text-case="lowercase"/>
480
+              <text variable="year-suffix" prefix="-"/>
481
+            </group>
482
+          </else-if>
483
+          <else>
484
+            <text term="no date" form="short"/>
485
+            <text variable="year-suffix" prefix="-"/>
486
+          </else>
487
+        </choose>
488
+      </group>
489
+    </group>
490
+  </macro>
491
+  <macro name="date-sort-group">
492
+    <!-- APA sorts 1. no-date items, 2. items with dates, 3. in-press (status) items -->
493
+    <choose>
494
+      <if variable="issued">
495
+        <text value="1"/>
496
+      </if>
497
+      <else-if variable="status">
498
+        <text value="2"/>
499
+      </else-if>
500
+      <else>
501
+        <text value="0"/>
502
+      </else>
503
+    </choose>
504
+  </macro>
505
+  <macro name="date-sort-date">
506
+    <date variable="issued" form="numeric"/>
507
+  </macro>
508
+  <macro name="date-intext">
509
+    <choose>
510
+      <if variable="issued">
511
+        <group delimiter="/">
512
+          <group delimiter=" ">
513
+            <choose>
514
+              <if is-uncertain-date="original-date">
515
+                <text term="circa" form="short"/>
516
+              </if>
517
+            </choose>
518
+            <date variable="original-date">
519
+              <date-part name="year"/>
520
+            </date>
521
+          </group>
522
+          <group delimiter=" ">
523
+            <choose>
524
+              <if is-uncertain-date="issued">
525
+                <text term="circa" form="short"/>
526
+              </if>
527
+            </choose>
528
+            <group>
529
+              <choose>
530
+                <if type="interview personal_communication" match="any">
531
+                  <choose>
532
+                    <if variable="archive container-title DOI publisher URL" match="none">
533
+                      <!-- These variables indicate that the communication is retrievable by the reader.
534
+                           If not, then use the in-text-only personal communication format -->
535
+                      <date variable="issued" form="text"/>
536
+                    </if>
537
+                    <else>
538
+                      <date variable="issued">
539
+                        <date-part name="year"/>
540
+                      </date>
541
+                    </else>
542
+                  </choose>
543
+                </if>
544
+                <else>
545
+                  <date variable="issued">
546
+                    <date-part name="year"/>
547
+                  </date>
548
+                </else>
549
+              </choose>
550
+              <text variable="year-suffix"/>
551
+            </group>
552
+          </group>
553
+        </group>
554
+      </if>
555
+      <else-if variable="status">
556
+        <text variable="status" text-case="lowercase"/>
557
+        <text variable="year-suffix" prefix="-"/>
558
+      </else-if>
559
+      <else>
560
+        <text term="no date" form="short"/>
561
+        <text variable="year-suffix" prefix="-"/>
562
+      </else>
563
+    </choose>
564
+  </macro>
565
+  <!-- APA has two description elements following the title:
566
+       title (parenthetical) [bracketed]  -->
567
+  <macro name="title-and-descriptions">
568
+    <choose>
569
+      <if variable="title">
570
+        <group delimiter=" ">
571
+          <text macro="title"/>
572
+          <text macro="parenthetical"/>
573
+          <text macro="bracketed"/>
574
+        </group>
575
+      </if>
576
+      <else>
577
+        <group delimiter=" ">
578
+          <text macro="bracketed"/>
579
+          <text macro="parenthetical"/>
580
+        </group>
581
+      </else>
582
+    </choose>
583
+  </macro>
584
+  <macro name="title">
585
+    <choose>
586
+      <if type="post webpage" match="any">
587
+        <!-- Webpages are always italicized -->
588
+        <text variable="title" font-style="italic"/>
589
+      </if>
590
+      <else-if variable="container-title" match="any">
591
+        <!-- Other types are italicized based on presence of container-title.
592
+             Assume that review and review-book are published in periodicals/blogs,
593
+             not just on a web page (ex. 69) -->
594
+        <text variable="title"/>
595
+      </else-if>
596
+      <else>
597
+        <choose>
598
+          <if type="article-journal article-magazine article-newspaper post-weblog review review-book" match="any">
599
+            <text variable="title" font-style="italic"/>
600
+          </if>
601
+          <else-if type="paper-conference">
602
+            <choose>
603
+              <if variable="collection-editor editor editorial-director" match="any">
604
+                <group delimiter=": " font-style="italic">
605
+                  <text variable="title"/>
606
+                  <!-- Replace with volume-title as that becomes available -->
607
+                  <choose>
608
+                    <if is-numeric="volume" match="none">
609
+                      <group delimiter=" ">
610
+                        <label variable="volume" form="short" text-case="capitalize-first"/>
611
+                        <text variable="volume"/>
612
+                      </group>
613
+                    </if>
614
+                  </choose>
615
+                </group>
616
+              </if>
617
+              <else>
618
+                <text variable="title" font-style="italic"/>
619
+              </else>
620
+            </choose>
621
+          </else-if>
622
+          <else>
623
+            <group delimiter=": " font-style="italic">
624
+              <text variable="title"/>
625
+              <!-- Replace with volume-title as that becomes available -->
626
+              <choose>
627
+                <if is-numeric="volume" match="none">
628
+                  <group delimiter=" ">
629
+                    <label variable="volume" form="short" text-case="capitalize-first"/>
630
+                    <text variable="volume"/>
631
+                  </group>
632
+                </if>
633
+              </choose>
634
+            </group>
635
+          </else>
636
+        </choose>
637
+      </else>
638
+    </choose>
639
+  </macro>
640
+  <macro name="title-intext">
641
+    <choose>
642
+      <if variable="title" match="none">
643
+        <text macro="bracketed-intext" prefix="[" suffix="]"/>
644
+      </if>
645
+      <else-if type="bill">
646
+        <!-- If a bill has no number or container-title, assume it is a hearing; italic -->
647
+        <choose>
648
+          <if variable="number container-title" match="none">
649
+            <text variable="title" form="short" font-style="italic" text-case="title"/>
650
+          </if>
651
+          <else-if variable="title">
652
+            <text variable="title" form="short" text-case="title"/>
653
+          </else-if>
654
+          <else>
655
+            <group delimiter=" ">
656
+              <text variable="genre"/>
657
+              <group delimiter=" ">
658
+                <choose>
659
+                  <if variable="chapter-number container-title" match="none">
660
+                    <!-- Replace with label variable="number" as that becomes available -->
661
+                    <text term="issue" form="short"/>
662
+                  </if>
663
+                </choose>
664
+                <text variable="number"/>
665
+              </group>
666
+            </group>
667
+          </else>
668
+        </choose>
669
+      </else-if>
670
+      <else-if type="legal_case" match="any">
671
+        <!-- Cases are italicized -->
672
+        <text variable="title" font-style="italic"/>
673
+      </else-if>
674
+      <else-if type="legislation treaty" match="any">
675
+        <!-- Legislation and treaties not italicized or quoted -->
676
+        <text variable="title" form="short" text-case="title"/>
677
+      </else-if>
678
+      <else-if type="post webpage" match="any">
679
+        <!-- Webpages are always italicized -->
680
+        <text variable="title" form="short" font-style="italic" text-case="title"/>
681
+      </else-if>
682
+      <else-if variable="container-title" match="any">
683
+        <!-- Other types are italicized or quoted based on presence of container-title. As in title macro. -->
684
+        <text variable="title" form="short" quotes="true" text-case="title"/>
685
+      </else-if>
686
+      <else>
687
+        <text variable="title" form="short" font-style="italic" text-case="title"/>
688
+      </else>
689
+    </choose>
690
+  </macro>
691
+  <macro name="parenthetical">
692
+    <!-- (Secondary contributors; Database location; Genre no. 123; Report Series 123, Version, Edition, Volume, Page) -->
693
+    <group prefix="(" suffix=")">
694
+      <choose>
695
+        <if type="patent">
696
+          <!-- authority: U.S. ; genre: patent ; number: 123,445 -->
697
+          <group delimiter=" ">
698
+            <text variable="authority" form="short"/>
699
+            <choose>
700
+              <if variable="genre">
701
+                <text variable="genre" text-case="capitalize-first"/>
702
+              </if>
703
+              <else>
704
+                <!-- This should be localized -->
705
+                <text value="patent" text-case="capitalize-first"/>
706
+              </else>
707
+            </choose>
708
+            <group delimiter=" ">
709
+              <!-- Replace with label variable="number" if that becomes available -->
710
+              <text term="issue" form="short" text-case="capitalize-first"/>
711
+              <text variable="number"/>
712
+            </group>
713
+          </group>
714
+        </if>
715
+        <else-if type="post webpage" match="any">
716
+          <!-- For post webpage, container-title is treated as publisher -->
717
+          <group delimiter="; ">
718
+            <text macro="secondary-contributors"/>
719
+            <text macro="database-location"/>
720
+            <text macro="number"/>
721
+            <text macro="locators-booklike"/>
722
+          </group>
723
+        </else-if>
724
+        <else-if variable="container-title">
725
+          <group delimiter="; ">
726
+            <text macro="secondary-contributors"/>
727
+            <choose>
728
+              <if type="broadcast graphic map motion_picture song" match="any">
729
+                <!-- For audiovisual media, number information comes after title, not container-title -->
730
+                <text macro="number"/>
731
+              </if>
732
+            </choose>
733
+          </group>
734
+        </else-if>
735
+        <else>
736
+          <group delimiter="; ">
737
+            <text macro="secondary-contributors"/>
738
+            <text macro="database-location"/>
739
+            <text macro="number"/>
740
+            <text macro="locators-booklike"/>
741
+          </group>
742
+        </else>
743
+      </choose>
744
+    </group>
745
+  </macro>
746
+  <macro name="parenthetical-container">
747
+    <choose>
748
+      <if variable="container-title" match="any">
749
+        <group prefix="(" suffix=")">
750
+          <group delimiter="; ">
751
+            <text macro="database-location"/>
752
+            <choose>
753
+              <if type="broadcast graphic map motion_picture song" match="none">
754
+                <!-- For audiovisual media, number information comes after title, not container-title -->
755
+                <text macro="number"/>
756
+              </if>
757
+            </choose>
758
+            <text macro="locators-booklike"/>
759
+          </group>
760
+        </group>
761
+      </if>
762
+    </choose>
763
+  </macro>
764
+  <macro name="bracketed">
765
+    <!-- [Descriptive information] -->
766
+    <!-- If there is a number, genre is already printed in macro="number" -->
767
+    <group prefix="[" suffix="]">
768
+      <choose>
769
+        <if variable="reviewed-author reviewed-title" type="review review-book" match="any">
770
+          <!-- Reviewed item -->
771
+          <group delimiter="; ">
772
+            <group delimiter=", ">
773
+              <group delimiter=" ">
774
+                <!-- Assume that genre is entered as 'Review of the book' or similar -->
775
+                <choose>
776
+                  <if variable="number" match="none">
777
+                    <choose>
778
+                      <if variable="genre">
779
+                        <text variable="genre" text-case="capitalize-first"/>
780
+                      </if>
781
+                      <else-if variable="medium">
782
+                        <text variable="medium" text-case="capitalize-first"/>
783
+                      </else-if>
784
+                      <else>
785
+                        <!-- Replace with term="review" as that becomes available -->
786
+                        <text value="Review of"/>
787
+                      </else>
788
+                    </choose>
789
+                  </if>
790
+                  <else>
791
+                    <choose>
792
+                      <if variable="medium">
793
+                        <text variable="medium" text-case="capitalize-first"/>
794
+                      </if>
795
+                      <else>
796
+                        <!-- Replace with term="review" as that becomes available -->
797
+                        <text value="Review of"/>
798
+                      </else>
799
+                    </choose>
800
+                  </else>
801
+                </choose>
802
+                <text macro="reviewed-title"/>
803
+              </group>
804
+              <names variable="reviewed-author">
805
+                <label form="verb-short" suffix=" "/>
806
+                <name and="symbol" initialize-with=". " delimiter=", "/>
807
+              </names>
808
+            </group>
809
+            <choose>
810
+              <if variable="genre" match="any">
811
+                <choose>
812
+                  <if variable="number" match="none">
813
+                    <text variable="medium" text-case="capitalize-first"/>
814
+                  </if>
815
+                </choose>
816
+              </if>
817
+            </choose>
818
+          </group>
819
+        </if>
820
+        <else-if type="thesis">
821
+          <!-- Thesis type and institution -->
822
+          <group delimiter="; ">
823
+            <choose>
824
+              <if variable="number" match="none">
825
+                <group delimiter=", ">
826
+                  <text variable="genre" text-case="capitalize-first"/>
827
+                  <choose>
828
+                    <if variable="archive DOI URL" match="any">
829
+                      <!-- Include the university in brackets if thesis is published -->
830
+                      <text variable="publisher"/>
831
+                    </if>
832
+                  </choose>
833
+                </group>
834
+              </if>
835
+            </choose>
836
+            <text variable="medium" text-case="capitalize-first"/>
837
+          </group>
838
+        </else-if>
839
+        <else-if variable="interviewer" type="interview" match="any">
840
+          <!-- Interview information -->
841
+          <choose>
842
+            <if variable="title">
843
+              <text macro="format"/>
844
+            </if>
845
+            <else-if variable="genre">
846
+              <group delimiter="; ">
847
+                <group delimiter=" ">
848
+                  <text variable="genre" text-case="capitalize-first"/>
849
+                  <group delimiter=" ">
850
+                    <text term="author" form="verb"/>
851
+                    <names variable="interviewer">
852
+                      <name and="symbol" initialize-with=". " delimiter=", "/>
853
+                    </names>
854
+                  </group>
855
+                </group>
856
+              </group>
857
+            </else-if>
858
+            <else-if variable="interviewer">
859
+              <group delimiter="; ">
860
+                <names variable="interviewer">
861
+                  <label form="verb" suffix=" " text-case="capitalize-first"/>
862
+                  <name and="symbol" initialize-with=". " delimiter=", "/>
863
+                </names>
864
+                <text variable="medium" text-case="capitalize-first"/>
865
+              </group>
866
+            </else-if>
867
+            <else>
868
+              <text macro="format"/>
869
+            </else>
870
+          </choose>
871
+        </else-if>
872
+        <else-if type="personal_communication">
873
+          <!-- Letter information -->
874
+          <choose>
875
+            <if variable="recipient">
876
+              <group delimiter="; ">
877
+                <group delimiter=" ">
878
+                  <choose>
879
+                    <if variable="number" match="none">
880
+                      <choose>
881
+                        <if variable="genre">
882
+                          <text variable="genre" text-case="capitalize-first"/>
883
+                        </if>
884
+                        <else-if variable="medium">
885
+                          <text variable="medium" text-case="capitalize-first"/>
886
+                        </else-if>
887
+                        <else>
888
+                          <text term="letter" form="short" text-case="capitalize-first"/>
889
+                        </else>
890
+                      </choose>
891
+                    </if>
892
+                    <else>
893
+                      <choose>
894
+                        <if variable="medium">
895
+                          <text variable="medium" text-case="capitalize-first"/>
896
+                        </if>
897
+                        <else>
898
+                          <text term="letter" form="short" text-case="capitalize-first"/>
899
+                        </else>
900
+                      </choose>
901
+                    </else>
902
+                  </choose>
903
+                  <names variable="recipient" delimiter=", ">
904
+                    <label form="verb" suffix=" "/>
905
+                    <name and="symbol" delimiter=", "/>
906
+                  </names>
907
+                </group>
908
+                <choose>
909
+                  <if variable="genre" match="any">
910
+                    <choose>
911
+                      <if variable="number" match="none">
912
+                        <text variable="medium" text-case="capitalize-first"/>
913
+                      </if>
914
+                    </choose>
915
+                  </if>
916
+                </choose>
917
+              </group>
918
+            </if>
919
+            <else>
920
+              <text macro="format"/>
921
+            </else>
922
+          </choose>
923
+        </else-if>
924
+        <else-if variable="composer" type="song" match="all">
925
+          <!-- Performer of classical music works -->
926
+          <group delimiter="; ">
927
+            <choose>
928
+              <if variable="number" match="none">
929
+                <group delimiter=" ">
930
+                  <choose>
931
+                    <if variable="genre">
932
+                      <text variable="genre" text-case="capitalize-first"/>
933
+                      <!-- Replace prefix with performer label as that becomes available -->
934
+                      <names variable="author" prefix="recorded by ">
935
+                        <name and="symbol" initialize-with=". " delimiter=", "/>
936
+                      </names>
937
+                    </if>
938
+                    <else-if variable="medium">
939
+                      <text variable="medium" text-case="capitalize-first"/>
940
+                      <!-- Replace prefix with performer label as that becomes available -->
941
+                      <names variable="author" prefix="recorded by ">
942
+                        <name and="symbol" initialize-with=". " delimiter=", "/>
943
+                      </names>
944
+                    </else-if>
945
+                    <else>
946
+                      <!-- Replace prefix with performer label as that becomes available -->
947
+                      <names variable="author" prefix="Recorded by ">
948
+                        <name and="symbol" initialize-with=". " delimiter=", "/>
949
+                      </names>
950
+                    </else>
951
+                  </choose>
952
+                </group>
953
+              </if>
954
+              <else>
955
+                <group delimiter=" ">
956
+                  <choose>
957
+                    <if variable="medium">
958
+                      <text variable="medium" text-case="capitalize-first"/>
959
+                      <!-- Replace prefix with performer label as that becomes available -->
960
+                      <names variable="author" prefix="recorded by ">
961
+                        <name and="symbol" initialize-with=". " delimiter=", "/>
962
+                      </names>
963
+                    </if>
964
+                    <else>
965
+                      <!-- Replace prefix with performer label as that becomes available -->
966
+                      <names variable="author" prefix="Recorded by ">
967
+                        <name and="symbol" initialize-with=". " delimiter=", "/>
968
+                      </names>
969
+                    </else>
970
+                  </choose>
971
+                </group>
972
+              </else>
973
+            </choose>
974
+            <choose>
975
+              <if variable="genre" match="any">
976
+                <choose>
977
+                  <if variable="number" match="none">
978
+                    <text variable="medium" text-case="capitalize-first"/>
979
+                  </if>
980
+                </choose>
981
+              </if>
982
+            </choose>
983
+          </group>
984
+        </else-if>
985
+        <else-if variable="container-title" match="none">
986
+          <!-- Other description -->
987
+          <text macro="format"/>
988
+        </else-if>
989
+        <else>
990
+          <!-- For conference presentations, chapters in reports, software, place bracketed after the container title -->
991
+          <choose>
992
+            <if type="paper-conference speech" match="any">
993
+              <choose>
994
+                <if variable="collection-editor editor editorial-director issue page volume" match="any">
995
+                  <text macro="format"/>
996
+                </if>
997
+              </choose>
998
+            </if>
999
+            <else-if type="book">
1000
+              <choose>
1001
+                <if variable="version" match="none">
1002
+                  <text macro="format"/>
1003
+                </if>
1004
+              </choose>
1005
+            </else-if>
1006
+            <else-if type="report" match="none">
1007
+              <text macro="format"/>
1008
+            </else-if>
1009
+          </choose>
1010
+        </else>
1011
+      </choose>
1012
+    </group>
1013
+  </macro>
1014
+  <macro name="bracketed-intext">
1015
+    <group prefix="[" suffix="]">
1016
+      <choose>
1017
+        <if variable="reviewed-author reviewed-title" type="review review-book" match="any">
1018
+          <!-- This should be localized -->
1019
+          <text macro="reviewed-title-intext" prefix="Review of "/>
1020
+        </if>
1021
+        <else-if variable="interviewer" type="interview" match="any">
1022
+          <names variable="interviewer">
1023
+            <label form="verb" suffix=" " text-case="capitalize-first"/>
1024
+            <name and="symbol" initialize-with=". " delimiter=", "/>
1025
+            <substitute>
1026
+              <text macro="format-intext"/>
1027
+            </substitute>
1028
+          </names>
1029
+        </else-if>
1030
+        <else-if type="personal_communication">
1031
+          <!-- Letter information -->
1032
+          <choose>
1033
+            <if variable="recipient">
1034
+              <group delimiter=" ">
1035
+                <choose>
1036
+                  <if variable="number" match="none">
1037
+                    <text variable="genre" text-case="capitalize-first"/>
1038
+                  </if>
1039
+                  <else>
1040
+                    <text term="letter" form="short" text-case="capitalize-first"/>
1041
+                  </else>
1042
+                </choose>
1043
+                <names variable="recipient" delimiter=", ">
1044
+                  <label form="verb" suffix=" "/>
1045
+                  <name and="symbol" delimiter=", "/>
1046
+                </names>
1047
+              </group>
1048
+            </if>
1049
+            <else>
1050
+              <text macro="format-intext"/>
1051
+            </else>
1052
+          </choose>
1053
+        </else-if>
1054
+        <else>
1055
+          <text macro="format-intext"/>
1056
+        </else>
1057
+      </choose>
1058
+    </group>
1059
+  </macro>
1060
+  <macro name="bracketed-container">
1061
+    <group prefix="[" suffix="]">
1062
+      <choose>
1063
+        <if type="paper-conference speech" match="any">
1064
+          <!-- Conference presentations should describe the session [container] in bracketed unless published in a proceedings -->
1065
+          <choose>
1066
+            <if variable="collection-editor editor editorial-director issue page volume" match="none">
1067
+              <text macro="format"/>
1068
+            </if>
1069
+          </choose>
1070
+        </if>
1071
+        <else-if type="book" variable="version" match="all">
1072
+          <!-- For entries in mobile app reference works, place bracketed after the container-title -->
1073
+          <text macro="format"/>
1074
+        </else-if>
1075
+        <else-if type="report">
1076
+          <!-- For chapters in reports, place bracketed after the container title -->
1077
+          <text macro="format"/>
1078
+        </else-if>
1079
+      </choose>
1080
+    </group>
1081
+  </macro>
1082
+  <macro name="secondary-contributors">
1083
+    <choose>
1084
+      <if type="article-journal article-magazine article-newspaper post-weblog review review-book" match="any">
1085
+        <text macro="secondary-contributors-periodical"/>
1086
+      </if>
1087
+      <else-if type="paper-conference">
1088
+        <choose>
1089
+          <if variable="collection-editor editor editorial-director" match="any">
1090
+            <text macro="secondary-contributors-booklike"/>
1091
+          </if>
1092
+          <else>
1093
+            <text macro="secondary-contributors-periodical"/>
1094
+          </else>
1095
+        </choose>
1096
+      </else-if>
1097
+      <else>
1098
+        <text macro="secondary-contributors-booklike"/>
1099
+      </else>
1100
+    </choose>
1101
+  </macro>
1102
+  <macro name="secondary-contributors-periodical">
1103
+    <group delimiter="; ">
1104
+      <choose>
1105
+        <if variable="title">
1106
+          <names variable="interviewer" delimiter="; ">
1107
+            <name and="symbol" initialize-with=". " delimiter=", "/>
1108
+            <label form="short" prefix=", " text-case="title"/>
1109
+          </names>
1110
+        </if>
1111
+      </choose>
1112
+      <names variable="translator" delimiter="; ">
1113
+        <name and="symbol" initialize-with=". " delimiter=", "/>
1114
+        <label form="short" prefix=", " text-case="title"/>
1115
+      </names>
1116
+    </group>
1117
+  </macro>
1118
+  <macro name="secondary-contributors-booklike">
1119
+    <group delimiter="; ">
1120
+      <choose>
1121
+        <if variable="title">
1122
+          <names variable="interviewer">
1123
+            <name and="symbol" initialize-with=". " delimiter=", "/>
1124
+            <label form="short" prefix=", " text-case="title"/>
1125
+          </names>
1126
+        </if>
1127
+      </choose>
1128
+      <!-- When editortranslator becomes available, add a test: variable="editortranslator" match="none"; then print translator -->
1129
+      <choose>
1130
+        <if type="post webpage" match="none">
1131
+          <!-- Webpages treat container-title like publisher -->
1132
+          <choose>
1133
+            <if variable="container-title" match="none">
1134
+              <group delimiter="; ">
1135
+                <names variable="container-author">
1136
+                  <label form="verb-short" suffix=" " text-case="title"/>
1137
+                  <name and="symbol" initialize-with=". " delimiter=", "/>