aboutsummaryrefslogtreecommitdiff
path: root/doc/user/bib.skb
blob: 5b2641748b01866a49f5471464a5cce34923cc84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
;;; bib.skb  --  The Skribe index
;;;
;;; Copyright 2001, 2002, 2003, 2004  Manuel Serrano
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;; USA.

(bibliography "src/bib1.sbib")

;*---------------------------------------------------------------------*/
;*    Index                                                            */
;*---------------------------------------------------------------------*/
(chapter :title "Bibliographies"

   (p [
Skribe supports bibliographies. In order to use bibliography
,(markup-ref "ref") it is needed to:])
   (itemize 
      (item [
Use the default pre-existing ,(emph "bibliography table") or create a 
custom one.])
      (item [
Provide a ,(emph "bibliography database").])
      (item [
Load the database by the mean of the ,(markup-ref "bibliography") 
Skribe function call.])
      (item [
Reference to a bibliography entry, with a ,(markup-ref "ref") Skribe 
function call.]))

;*---------------------------------------------------------------------*/
;*    Bibliography tables                                              */
;*---------------------------------------------------------------------*/
(section :title "Bibliography tables"
   
   (p [
This section describes the function of using and creating bibliography 
tables.])
   
   (p [The predicate ,(code "bib-table?") returns ,(code "#t") if and only
if its argument is a bibliography table as returned by 
,(markup-ref "make-bib-table") or ,(markup-ref "default-bib-table"). Otherwise
,(code "bib-table?") returns ,(code "#f").])
   
   (doc-markup 'bib-table?
	       '((obj [The value to be tested]))
	       :see-also '(make-bib-table default-bib-table bibliography the-bibliography)
	       :force-engines *api-engines*
	       :common-args '()
	       :source #f ;;"skribilo/biblio.scm"
               :def '(define-markup (bib-table? obj) ...))
   
   (p [The function ,(code "default-bib-table") returns a global, pre-existing
bibliography-table:])
   (doc-markup 'default-bib-table
	       '()
	       :see-also '(bib-table? make-bib-table bibliography the-bibliography)
	       :force-engines *api-engines*
	       :common-args '()
               :source #f
               :def '(define-markup (default-bib-table) ...))
   
   (p [The function ,(code "make-bib-table") constructs a new 
bibliography-table:])
   (doc-markup 'make-bib-table
	       '((ident [The name of the bibliography table.]))
	       :see-also '(bib-table? default-bib-table bibliography the-bibliography)
	       :force-engines *api-engines*
	       :common-args '()
	       :source #f
               :def '(define-markup (make-bib-table ident) ...)))
   
;*---------------------------------------------------------------------*/
;*    bibliography ... @label bibliography@                            */
;*---------------------------------------------------------------------*/
(section :title "Bibliography"

(p [The function ,(code "bibliography") loads bibliography ,(param 'entries) 
into the Skribe memory. An ,(emph "entry") is either a list
representing one entry (such as an article or book reference) or a
string which denotes a file name that contains several
entries. All the entries loaded in memory are available for the function
,(ref :ident "ref" :text "references"). A bibliography database must be loaded
,(emph "before") any reference is introduced. It is advised to place
the ,(code "bibliography") Skribe function call before the call to the
,(markup-ref "document") function call.])

(doc-markup 'bibliography
	    `((:command ,[An external command to be applied when loading
              the bibliography entries. The sequence ,(code "~a") is replaced
              with the name of the file when the command is invoked.])
	      (:bib-table ,[The ,(ref :mark "make-bib-table" :text "table") 
               where entry is searched.])
	      (#!rest entry... ,[If ,(param 'entry) is a string, it denotes
              a file containing the entry (see ,(ref :mark "skribe-bib-path" 
              :text "bibliograph path")). Otherwise, it is a list described
              by the ,(ref :subsection "Bibliography syntax" :text "syntax") 
              below.]))
	    :see-also '(bib-table? make-bib-table default-bib-table the-bibliography)
	    :force-engines *api-engines*
	    :common-args '())

(p [The ,(param :command) option can be used to import foreign bibliography.
The following example, shows how to directly use a Bibtex bibliography
using the ,(ref :section "Skribebibtex") translator.])

(example-produce 
 (example :legend "Printing a bibliography" (prgm :file "src/bib6.skb")))


;; bibliography syntax
(subsection :title "Bibliography syntax"

(p [The Skribe bibliography database uses a format very close to
the Bibtex one. It is a parenthetic version of Bibtex. Here is the
syntax of an entry:])

(disp :verb #t :bg *prgm-skribe-color* [
<entry>  -->  ,(bold "(")<kind> <key> <field>+,(bold ")")
<kind>   -->  techreport | article | inproceedings | book
<key>    -->  <symbol> | <string>
<field>  -->  ,(bold "(")<symbol> <string>,(bold ")")])

(p [Bibtex files cannot be directly loaded in Skribe but the tool
,(ref :section "Skribebibtex" :text (tt "skribebibtex")) can be use to
automatically convert Bibtex format to Skribe bibliography format.
Here is an example of a simple Skribe database.])

(prgm :file "src/bib1.sbib")))

;*---------------------------------------------------------------------*/
;*    the-bibliography ... @label the-bibliography@                    */
;*---------------------------------------------------------------------*/
(section :title "Printing a bibliography"

(p [The function ,(code "the-bibliography") displays the bibliography. ])

(doc-markup 'the-bibliography
	    `((:bib-table [The bibliography 
               ,(ref :mark "make-bib-table" :text "table") to be displayed.])
              (:pred [A predicate filtering the bibliography entries. It takes
                      two parameters: the bibliography entry and the 
                      ,(code "the-bibliography") node.])
	      (:sort [A function sorting a list of entries.])
	      (:count ,[The symbol ,(code "partial") or ,(code "full")
               specifies the numbering to be applied. The value 
               ,(code "partial") tells Skribe to count only the entries
               filtered in by ,(param :pred). The value ,(code "full")
               tells Skribe to count all entries, event those filtered out
               by ,(param :pred).]))
	    :see-also '(bib-table? make-bib-table default-bib-table bibliography)
	    :force-engines *api-engines*
	    :common-args '())

(example-produce 
 (example :legend "Printing a bibliography" (prgm :file "src/bib2.skb"))
 (disp (include "src/bib2.skb")))

;; filtering bibliography
(subsection :title "Filtering bibliography entries"
(index "the-bibliography" :note "filtering")

(p [The ,(param :pred) option is bound to a function of one argument
that filters bibliography entries. It is used to control which entries
must appears on a bibliography. The default behavior is to display
only the entries referenced to in the text. For instance, in order to
display ,(emph "all") the entries of a bibliography, is it needed to
print the bibliography with a predicate returning always ,(code "#t").])

(example-produce 
 (example :legend "Unfiltering bibliography entries" (prgm :file "src/bib3.skb"))
 (disp (include "src/bib3.skb")))

(p [The second example, filters out the entries that are not ,(emph "book")
or that are not referenced to from the document.])

(example-produce 
 (example :legend "Unfiltering bibliography entries" (prgm :file "src/bib4.skb"))
 (disp (include "src/bib4.skb")))

(p [The last example, illustrates how to change the rendering of a
bibliography. It uses the ,(markup-ref "processor") construction 
and it defines two ,(ref :ident "writer" :text "writers") for
displaying ,(code "&bib-entry-ident") and ,(code "&bib-entry-title")
markups. These two markups are introduced by Skribe when it loads a 
bibliography. All fields of bibliography entries are represented by
markups whose prefix are ,(code "&bib-entry-"). The parent of all these
markups is the bibliography entry itself. The ,(code "&bib-entry-") markups
are options of there parent.])

(example-produce 
 (example :legend "Unfiltering bibliography entries" (prgm :file "src/bib5.skb"))
 (disp (include "src/bib5.skb"))))

;; sorting bibliography
(subsection :title "Sorting bibliography entries"
(index "the-bibliography" :note "sorting")

(p [The ,(param :sort) option of the ,(markup-ref "the-bibliography")
markup is used for sorting the bibliography entries. There are three
pre-existing functions for sorting entries:])

(doc-markup 'bib-sort/authors
	    '((l [The list of entries.]))
	    :force-engines *api-engines*
	    :source "skribilo/biblio.scm"
	    :others '(bib-sort/idents bib-sort/dates)
	    :common-args '())

(p [The first function sorts the entries according to an alphabetic ordering
on authors. The second sorts according to an alphabetic ordering on 
entries identifier. The last one sorts according to entries date.])

(example-produce 
 (example :legend "Sorting bibliography entries" 
	  (prgm :file "skribilo/biblio.scm"
	        :definition 'bib-sort/idents)))))

;*---------------------------------------------------------------------*/
;*    skribebibtex                                                     */
;*---------------------------------------------------------------------*/
(section :title "Skribebibtex"
(index "skribebibtex" :note "manual page")
(index "bibtex")
(p [
In this section we present the Skribebibtex translator that compiles Bibtex
source files into a Skribe bibliography.])

;; Synopsis (FIXME)
;;(subsection :title "SYNOPSIS" :number #f
;;   (compiler-command *skribebibtex-bin* "options" "input"))

;; Description
(subsection :title "DESCRIPTION" :number #f [
This manual page is not meant to be exhaustive. It
documents the ,(tt "skribebibtex"), a tool that translates
,(bold "Bibtex") files into ,(it "Skribe"), bibliography format. These 
files can be used by the ,(bold "skribe") compiler to produce  
bibliography entries.])

;; Suffixes
(subsection :title "SUFFIXES" :number #f [
The ,(ref :chapter "Skribe compiler" :text "skribe") compiler uses file 
suffixes in order to select amongst its possible targets which to choose. 
These suffixes are:

,(description (item :key (it ".bib") [a ,(bold "Bibtex") source file.]))])

;; Options (FIXME)
;;(subsection :title "OPTIONS" :number #f 
;;(compiler-options *skribebibtex-bin*))

   ))