Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / Documentation / lily-bib.bst
blob13320d46bac5e4f5d7601650f31ec084a08df0da
1 % This template file was written by Phil Holmes to replace the one used for the bibliogrphy
2 % on the LilyPond project.  18 Feb 2011
4 % This section lists the possible fields, although not all are handled by the template
5 ENTRY
6   { abstract
7     address
8     author
9     booktitle
10     chapter
11     comment
12     earlier
13     edition
14     editor
15     howpublished
16     institution
17     journal
18     key
19     keyword
20     later
21     month
22     note
23     number
24     organization
25     pages
26     private
27     publisher
28     school
29     series
30     title
31     type
32     URL
33     volume
34     year
35   }
36   {}
37   { label extra.label sort.label }
39 % s and t came from the original.  The other strings are self explanatory
40 STRINGS { s t }
41 STRINGS { ThesisType ReportType }
43 % from the original
44 INTEGERS { nameptr namesleft numnames }
46 % This was simply copied and pasted from the original
47 FUNCTION {format.names}
48 { 's :=
49   #1 'nameptr :=
50   s num.names$ 'numnames :=
51   numnames 'namesleft :=
52     { namesleft #0 > }
53     % This line was changed: the {ff{ } } entry outputs the first name without allowing bibtex to use
54     % a ~ to replace the spaces where it thinks fit.  The downside is that we lose hyphens...
55     { s nameptr "{ff{ } }{vv }{ll}{, jj}" format.name$ 't :=
56       nameptr #1 >
57         { namesleft #1 >
58             { ", " * t * }
59             { numnames #2 >
60                 { "," * }
61                 'skip$
62               if$
63               t "others" =
64                 { " et al." * }
65                 { " and " * t * }
66               if$
67             }
68           if$
69         }
70         't
71       if$
72       nameptr #1 + 'nameptr :=
73       namesleft #1 - 'namesleft :=
74     }
75   while$
78 FUNCTION {format.authors}
79 % This is a very common construct.  It means "if the author is empty, process the lines in the first pair
80 % of braces {}.  Otherwise process the lines in the second pair.  So if it's empty, an empty string is
81 % stacked.
82 { author empty$
83     { "" }
84     % If it's not empty, it formats author (and stacks the result) and then checks whether editor is empty
85     { author format.names
86       editor empty$
87         % If editor is empty, it appends an empty string (the * is a postfix operator meaning append this
88         % string to the top entry on the stack
89         { "" * }
90         % Otherwise it appends a period, parenthesis.
91         { ". (" * }
92       if$
93     }
94   if$
97 FUNCTION {format.editor}
98 { editor empty$
99     { "" }
100     { editor format.names
101       editor num.names$ #1 >
102         { ", editors" * }
103         { ", editor" * }
104       if$
105       author empty$
106         { "" * }
107         { ")" * }
108       if$
109     }
110   if$
114 FUNCTION {output.bibitem}
115 { newline$
116   "@item " write$ newline$
119 FUNCTION {format.edition}
120 { edition empty$
121     { "" }
122     { edition " edition, " * }
123   if$
126 FUNCTION {format.date}
127 { year empty$
128     { month empty$
129         { "" }
130         { "there's a month but no year in " cite$ * warning$
131           month
132         }
133       if$
134     }
135     { month empty$
136         'year
137         { month " " * year * }
138       if$
139     }
140   if$
143 FUNCTION {format.address}
144 { address empty$
145     { "" }
146     { address
147     year empty$
148       { "" * }
149       { ", " * }
150     if$
151     }
152   if$
155 FUNCTION {format.publisher}
157   publisher empty$
158     { "" }
159     { publisher
160       address empty$
161         { year empty$
162             { "" * }
163             { ", " * }
164           if$
165         }
166         { ", " * }
167       if$
168     }
169   if$
172 FUNCTION {format.note}
173 { note empty$
174     { "" }
175     { note
176       add.period$
177     }
178   if$
181 FUNCTION {format.title}
182 { title empty$
183     { "" }
184     { "@strong{" title * "}" *
185     journal empty$
186     {
187       volume empty$
188         { "" * }
189         { ", " * }
190       if$
191     }
192     { "" * }
193     if$
194   }
195   if$
198 FUNCTION {format.number}
200   % ReportType is set by us when we call the correct function for the bibliography type
201   ReportType empty$
202   {
203     volume empty$
204       {number empty$
205         { "" }
206         { "Number " number * ". " * }
207       if$
208       }
209       { "" }
210     if$
211     }
212     { ReportType
213       number empty$
214         { ", " * }
215         { " " * number * ", " * institution * ", " * }
216       if$
217     }
218   if$
221 FUNCTION {format.volume}
222 { journal empty$
223   {
224     volume empty$
225       { "" }
226       { "volume " volume * }
227     if$
228   }
229   { "" }
230   if$
233 FUNCTION {format.journal}
234 { journal empty$
235   { "" write$ }
236   { "@emph{" journal * "}" *
237     write$
238     volume empty$
239       { "" }
240       { ", " volume * }
241     if$
242     write$
243     number empty$
244       { "" }
245       { "(" number * ")" * }
246     if$
247     write$
248     pages empty$
249       { "" }
250       { ":" pages * }
251     if$
252     write$
253     year empty$
254       { "" }
255       { ", " }
256     if$
257     write$
259   if$
262 FUNCTION {format.series}
263 { series empty$
264     { "" }
265     { series
266       % This is an inbuilt function that adds a period when appropriate.
267       add.period$
268       " " *
269     }
270   if$
273 FUNCTION {format.booktitle}
274 { booktitle empty$
275     { "" }
276     { "In @emph{" booktitle * "}, " *
277       pages empty$
278         { "" * }
279         { "pages " * pages * ", " * }
280       if$
281     }
282   if$
285 FUNCTION {format.thesis}
286 { ThesisType empty$
287     { "" }
288     { ThesisType school * ", " *}
289   if$
292 % This is the function that runs the formatting code.  It's called when the biblio type is @Book
293 FUNCTION {book}
294 { output.bibitem
295   format.authors write$
296   format.editor write$
297   "." write$ newline$
298   format.title write$
299   format.volume write$
300   "." write$ newline$
301   format.number write$
302   format.journal
303   format.series write$
304   format.publisher write$
305   format.address write$
306   format.edition write$
307   format.booktitle write$
308   format.thesis write$
309   format.date write$
310   "." write$ newline$
311   format.note write$
312   newline$
313   newline$
314   newline$
315   newline$
318 % All the following functions are called for the other biblio types. This is @article
319 FUNCTION {article}
321   % And we just call the book function
322   book
325 FUNCTION {booklet}
327   book
330 FUNCTION {PhDThesis}
332   % This sets the string ThesisType to be equal to "PhD Thesis"
333   "PhD thesis, " 'ThesisType :=
334   book
335   % And this sets it back to an empty string
336   "" 'ThesisType :=
339 FUNCTION {TechReport}
341   "Technical Report" 'ReportType :=
342   book
343   "" 'ReportType :=
346 FUNCTION {InProceedings}
348   book
351 FUNCTION {MastersThesis}
353   "Master's thesis, " 'ThesisType :=
354   book
355   "" 'ThesisType :=
358 FUNCTION {InBook}
360   book
363 % Haven't dug too deeply into this, but it seems to set the sort key
364 FUNCTION {presort}
365 { cite$
366   #1 entry.max$ substring$
367   'sort.key$ :=
370 % The entry point for processing
372 % Read the .bib file
373 READ
375 % Work through the entries, calling the presort function
376 ITERATE {presort}
378 % Sort the entries
379 SORT
381 % This could go higher with all the other functions, but it _has_ to be above the call
382 FUNCTION {begin.bib}
383 { "@c bib -> itexi intro" write$ newline$
384   "@itemize" write$ newline$
387 % Run the begin.bib function
388 EXECUTE {begin.bib}
390 % For each bibliogrpahy entry call the relevant function (e.g. book, article, booklet, etc.)
391 ITERATE {call.type$}
393 FUNCTION {end.bib}
394 { newline$
395   "@end itemize" write$ newline$
396   "@c bib -> itexi end" write$ newline$
399 EXECUTE {end.bib}
400 % And that's it.