summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/citation-style-language/README.md
blob: c89a928bcb3e2d1c5dee18ba43c98fbb327591b4 (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
# `citeproc-lua`

## Create an engine instance
```lua
local citeproc = require("citeproc")
local engine = citeproc.new(sys, style)
```

The `sys` is a table which must contain `retrieveLocale()` and `retrieveItem()` functions. Thet are called to feed the engine with inputs.



## `updateItems()`

The `updateItems()` method refreshes the registry of the engine.
```lua
params, result = engine:updateItems(ids)
```
The `ids` is just a list of `id`s.
```lua
ids = {"ITEM-1", "ITEM-2"}
```


## `makeCitationCluster()`

The `makeCitationCluster()` method is called to generate a citation of (possibly) multiple items.

```lua
params, result = engine:makeCitationCluster(cite_items)
```

The `cite_items` is a list of tables which contain the `id` and other options (not implemented).

```lua
cite_items = {
  { id = "ITEM-1" },
  { id = "ITEM-2" }
}
```

Returns:
```lua
"(D’Arcus, 2005; Bennett, 2009)"
```

The more complicated method `processCitationCluster()` is not implemented yet.

## `makeBibliography()`

The `makeBibliography()` method produces the bibliography and parameters required for formatting.
```lua
result = engine:makeBibliography()
```

Returns:
```lua
result = {
  {
    hangingindent = false,
    ["second-field-align"] = false,
  },
  {
    '<div class="csl-entry">B. D’Arcus, <i>Boundaries of Dissent: Protest and State Power in the Media Age</i>, Routledge, 2005.</div>',
    '<div class="csl-entry">F.G. Bennett Jr., “Getting Property Right: ‘Informal’ Mortgages in the Japanese Courts,” <i>Pac. Rim L. &#38; Pol’y J.</i>, vol. 18, Aug. 2009, pp. 463–509.</div>'
  }
}
```