mirror of
https://github.com/retorquere/zotero-better-bibtex.git
synced 2022-05-23 09:36:29 +03:00
docs
This commit is contained in:
@@ -48,8 +48,6 @@ class NSAutoExport {
|
||||
* @param translator The name or GUID of a BBT translator
|
||||
* @param path The absolute path to which the collection will be auto-exported
|
||||
* @param displayOptions Options which you would be able to select during an interactive export; `exportNotes`, default `false`, and `useJournalAbbreviation`, default `false`
|
||||
* @param displayOptions.exportNotes Export notes
|
||||
* @param displayOptions.useJournalAbbreviation Use Journal abbreviation in export
|
||||
* @param replace Replace the auto-export if it exists, default `false`
|
||||
* @returns Collection ID of the target collection
|
||||
*/
|
||||
|
||||
@@ -392,6 +392,7 @@ class PatternFormatter {
|
||||
|
||||
/**
|
||||
* Tests whether the item is of any of the given types, and skips to the next pattern if not
|
||||
* @param allowed one or more item type names
|
||||
*/
|
||||
public $type(...allowed: string[]) {
|
||||
if (allowed.map(type => type.toLowerCase()).includes(this.item.itemType.toLowerCase())) {
|
||||
@@ -404,6 +405,7 @@ class PatternFormatter {
|
||||
|
||||
/**
|
||||
* Tests whether the item has the given language set, and skips to the next pattern if not
|
||||
* @param name one or more language codes
|
||||
*/
|
||||
public $language(...name: (BabelLanguage | BabelLanguageTag)[]) {
|
||||
if (name.concat(name.map(n => BabelTag[n] as string).filter(n => n)).includes(this.item.babelTag())) {
|
||||
@@ -440,6 +442,7 @@ class PatternFormatter {
|
||||
|
||||
/**
|
||||
* Gets the value of the item field
|
||||
* @param name name of the field
|
||||
*/
|
||||
public $getField(name: string) {
|
||||
const value = this.item.getField(name)
|
||||
@@ -463,15 +466,15 @@ class PatternFormatter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Author/editor information. Parameters are:
|
||||
* - `n`: select the first `n` authors (when passing a number) or the authors in this range (inclusive, when passing two values); negative numbers mean "from the end", default = 0 = all,
|
||||
* - `creator`: select type of creator (`author` or `editor`),
|
||||
* - `name`: sprintf-js template. Available named parameters are: `f` (family name), `g` (given name), `i` (initials)
|
||||
* - `etal`: use this term to replace authors after `n` authors have been named,
|
||||
* - `sep`: use this character between authors
|
||||
* - `clean`: transliterates the citation key and removes unsafe characters
|
||||
* - `min`: skip to the next pattern if there are less than `min` creators
|
||||
* - `max`: skip to the next pattern if there are more than `max` creators
|
||||
* Author/editor information.
|
||||
* @param n select the first `n` authors (when passing a number) or the authors in this range (inclusive, when passing two values); negative numbers mean "from the end", default = 0 = all
|
||||
* @param creator select type of creator (`author` or `editor`)
|
||||
* @param name sprintf-js template. Available named parameters are: `f` (family name), `g` (given name), `i` (initials)
|
||||
* @param etal use this term to replace authors after `n` authors have been named
|
||||
* @param sep use this character between authors
|
||||
* @param clean transliterates the citation key and removes unsafe characters
|
||||
* @param min skip to the next pattern if there are less than `min` creators, 0 = ignore
|
||||
* @param max skip to the next pattern if there are more than `max` creators, 0 = ignore
|
||||
*/
|
||||
public $authors(
|
||||
n: number | [number, number] = 0,
|
||||
@@ -505,7 +508,14 @@ class PatternFormatter {
|
||||
return this.$text(author)
|
||||
}
|
||||
|
||||
/** The first `N` (default: all) characters of the `M`th (default: first) author's last name. */
|
||||
/**
|
||||
* The first `n` (default: all) characters of the `m`th (default: first) author's last name.
|
||||
* @param n the number of characters to take from the name, 0 = all
|
||||
* @param m select the `m`th author
|
||||
* @param creator select from authors or only from editors
|
||||
* @param initials add author initials
|
||||
* @param clean transliterates the citation key and removes unsafe characters
|
||||
*/
|
||||
public $auth(n=0, m=1, creator: 'author' | 'editor' = 'author', initials=false, clean=true) {
|
||||
const family = n ? `%(f).${n}s` : '%(f)s'
|
||||
const name = initials ? `${family}%(I)s` : family
|
||||
@@ -563,7 +573,7 @@ class PatternFormatter {
|
||||
return this.$text(author)
|
||||
}
|
||||
|
||||
/** The beginning of each author's last name, using no more than `N` characters. */
|
||||
/** The beginning of each author's last name, using no more than `n` characters (0 = all). */
|
||||
public $authIni(n=0, creator: 'author' | 'editor' = 'author', initials=false, sep='.', clean=true) {
|
||||
const authors = this.creators(creator === 'editor', initials ? '%(f)s%(I)s' : '%(f)s')
|
||||
if (!authors.length) return this.$text('')
|
||||
@@ -680,13 +690,13 @@ class PatternFormatter {
|
||||
return this.$text(pages.split(/[-\s,–]/).pop() || '')
|
||||
}
|
||||
|
||||
/** Tag number `N` */
|
||||
/** Tag number `n` */
|
||||
public $keyword(n: number) {
|
||||
const tag: string | { tag: string} = this.item.getTags()?.[n] || ''
|
||||
return this.$text(typeof tag === 'string' ? tag : tag.tag)
|
||||
}
|
||||
|
||||
/** The first `N` (default: 3) words of the title, apply capitalization to first `M` (default: 0) of those */
|
||||
/** The first `n` (default: 3) words of the title, apply capitalization to first `m` (default: 0) of those */
|
||||
public $shorttitle(n: number = 3, m: number = 0) { // eslint-disable-line no-magic-numbers, @typescript-eslint/no-inferrable-types
|
||||
const words = this.titleWords(this.item.title, { skipWords: true, asciiOnly: true})
|
||||
if (!words) return this.$text('')
|
||||
@@ -694,7 +704,7 @@ class PatternFormatter {
|
||||
return this.$text(words.slice(0, n).map((word, i) => i < m ? word.charAt(0).toUpperCase() + word.slice(1) : word).join(' '))
|
||||
}
|
||||
|
||||
/** The first `N` (default: 1) words of the title, apply capitalization to first `M` (default: 0) of those */
|
||||
/** The first `n` (default: 1) words of the title, apply capitalization to first `m` (default: 0) of those */
|
||||
public $veryshorttitle(n: number = 1, m: number = 0) { // eslint-disable-line no-magic-numbers, @typescript-eslint/no-inferrable-types
|
||||
return this.$shorttitle(n, m)
|
||||
}
|
||||
|
||||
43
package-lock.json
generated
43
package-lock.json
generated
@@ -98,6 +98,7 @@
|
||||
"regenerate": "^1.4.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"shelljs": "^0.8.5",
|
||||
"showdown": "^2.1.0",
|
||||
"string-template": "^1.0.0",
|
||||
"task-easy": "^1.0.1",
|
||||
"ts-node": "^10.7.0",
|
||||
@@ -13757,6 +13758,31 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz",
|
||||
"integrity": "sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"commander": "^9.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"showdown": "bin/showdown.js"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://www.paypal.me/tiviesantos"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown/node_modules/commander": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.2.0.tgz",
|
||||
"integrity": "sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
@@ -25843,6 +25869,23 @@
|
||||
"rechoir": "^0.6.2"
|
||||
}
|
||||
},
|
||||
"showdown": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz",
|
||||
"integrity": "sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^9.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.2.0.tgz",
|
||||
"integrity": "sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
|
||||
@@ -146,6 +146,7 @@
|
||||
"regenerate": "^1.4.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"shelljs": "^0.8.5",
|
||||
"showdown": "^2.1.0",
|
||||
"string-template": "^1.0.0",
|
||||
"task-easy": "^1.0.1",
|
||||
"ts-node": "^10.7.0",
|
||||
|
||||
@@ -16,6 +16,7 @@ export type Parameter = {
|
||||
name: string
|
||||
default: SimpleLiteral
|
||||
rest?: boolean
|
||||
doc?: string
|
||||
}
|
||||
export type Method = {
|
||||
doc: string
|
||||
@@ -45,6 +46,26 @@ export class API {
|
||||
})
|
||||
}
|
||||
|
||||
private DocComment(comment: string): Record<string, string> {
|
||||
comment = comment
|
||||
.replace(/^\/\*\*/, '') // remove leader
|
||||
.replace(/\*\/$/, '') // remove trailer
|
||||
const params: Record<string, string> = {}
|
||||
let m
|
||||
params[''] = comment.trim().split('\n').map(line => {
|
||||
if (m = line.match(/^\s*[*]\s+@param\s+([^\s]+)\s+(.*)/)) {
|
||||
params[m[1]] = m[2]
|
||||
return ''
|
||||
}
|
||||
else {
|
||||
return `${line.replace(/^\s*[*]\s*/, '')}\n`
|
||||
}
|
||||
})
|
||||
.join('')
|
||||
.replace(/\n+/g, newlines => newlines.length > 1 ? '\n\n' : ' ')
|
||||
|
||||
return params
|
||||
}
|
||||
private MethodDeclaration(className: string, method: ts.MethodDeclaration): void {
|
||||
const methodName: string = method.name.getText(this.ast)
|
||||
if (!methodName) return
|
||||
@@ -53,12 +74,12 @@ export class API {
|
||||
if (!comment_ranges) return
|
||||
let comment = this.ast.getFullText().slice(comment_ranges[0].pos, comment_ranges[0].end)
|
||||
if (!comment.startsWith('/**')) return
|
||||
comment = comment.replace(/^\/\*\*/, '').replace(/\*\/$/, '').trim().split('\n').map(line => line.replace(/^\s*[*]\s*/, '')).join('\n').replace(/\n+/g, newlines => newlines.length > 1 ? '\n\n' : ' ')
|
||||
const params = this.DocComment(comment)
|
||||
|
||||
if (!this.classes[className]) this.classes[className] = {}
|
||||
|
||||
this.classes[className][methodName] = {
|
||||
doc: comment,
|
||||
doc: params[''],
|
||||
parameters: [],
|
||||
schema: {
|
||||
type: 'object',
|
||||
@@ -67,18 +88,24 @@ export class API {
|
||||
required: [],
|
||||
},
|
||||
}
|
||||
delete params['']
|
||||
|
||||
method.forEachChild(param => {
|
||||
if (ts.isParameter(param)) this.ParameterDeclaration(this.classes[className][methodName], param)
|
||||
if (ts.isParameter(param)) this.ParameterDeclaration(this.classes[className][methodName], param, params)
|
||||
})
|
||||
const orphans = Object.keys(params).join('/')
|
||||
if (orphans) throw new Error(`orphaned param docs for ${orphans}`)
|
||||
}
|
||||
|
||||
private ParameterDeclaration(method: Method, param: ts.ParameterDeclaration) {
|
||||
private ParameterDeclaration(method: Method, param: ts.ParameterDeclaration, doc: Record<string, string>) {
|
||||
const name = param.name.getText(this.ast)
|
||||
const p: Parameter = {
|
||||
name: param.name.getText(this.ast),
|
||||
name,
|
||||
doc: doc[name],
|
||||
default: this.Literal(param.initializer),
|
||||
rest: !!param.dotDotDotToken,
|
||||
}
|
||||
delete doc[name]
|
||||
method.parameters.push(p)
|
||||
|
||||
if (param.type) {
|
||||
|
||||
@@ -7,6 +7,9 @@ import stringify from 'fast-safe-stringify'
|
||||
import _ from 'lodash'
|
||||
import jsesc from 'jsesc'
|
||||
|
||||
import Showdown from 'showdown'
|
||||
const showdown = new Showdown.Converter()
|
||||
|
||||
class FormatterAPI {
|
||||
private formatter: Record<string, Method>
|
||||
public signature: Record<string, any> = {}
|
||||
@@ -30,19 +33,27 @@ class FormatterAPI {
|
||||
})
|
||||
if (!this.signature[key].rest) delete this.signature[key].rest
|
||||
|
||||
let quoted = '`' + name.substr(1) + '`'
|
||||
if (method.parameters.length) {
|
||||
quoted += '('
|
||||
+ method.parameters.map(p => {
|
||||
let doc = '`' + p.name + '`' + (!method.schema.required.includes(p.name) && p.default === 'undefined' ? '?' : '')
|
||||
doc += `: ${this.typedoc(method.schema.properties[p.name])}`
|
||||
if (typeof p.default !== 'undefined') doc += `, default: \`${jsesc(p.default, { quotes: 'single', wrap: true })}\``
|
||||
return doc
|
||||
}).join(', ')
|
||||
+ ')'
|
||||
}
|
||||
const description = method.parameters.find(param => param.doc)
|
||||
let params = method.parameters.map(p => {
|
||||
let doc = '<tr>'
|
||||
doc += '<td><code>' + p.name + '</code>' + (!method.schema.required.includes(p.name) && p.default === 'undefined' ? '?' : '') + '</td>'
|
||||
doc += `<td>${this.typedoc(method.schema.properties[p.name])}</td><td>`
|
||||
if (description) doc += `${showdown.makeHtml(p.doc || '')}</td><td>`
|
||||
if (typeof p.default !== 'undefined') doc += `<code>${jsesc(p.default, { quotes: 'single', wrap: true })}</code> `
|
||||
doc += '</td></tr>'
|
||||
return doc
|
||||
}).join('\n')
|
||||
if (params) params = `
|
||||
<details class="details"><summary class="summary">parameters:</summary>
|
||||
<table>
|
||||
<thead><tr><th>parameter</th><th>type</th>${description ? '<th>description</th>' : ''}<th>default</th></tr></thead>
|
||||
<tbody>
|
||||
${params}
|
||||
</tbody>
|
||||
</table>
|
||||
</details>`
|
||||
|
||||
if (key !== '$text' && key !== '$getfield') this.doc[kind][quoted] = method.doc
|
||||
if (key !== '$text' && key !== '$getfield') this.doc[kind][`<code>${name.substr(1)}</code>`] = showdown.makeHtml(method.doc) + params
|
||||
}
|
||||
|
||||
/* re-enable this after the formatter migration
|
||||
@@ -55,12 +66,12 @@ class FormatterAPI {
|
||||
}
|
||||
|
||||
private typedoc(type): string {
|
||||
if (type.enum) return type.enum.map(t => this.typedoc({ const: t })).join(' | ')
|
||||
if (['boolean', 'string', 'number'].includes(type.type)) return `**${type.type}**`
|
||||
if (type.oneOf) return type.oneOf.map(t => this.typedoc(t)).join(' | ')
|
||||
if (type.anyOf) return type.anyOf.map(t => this.typedoc(t)).join(' | ')
|
||||
if (type.const) return `\`${type.const}\``
|
||||
if (type.instanceof) return `**${type.instanceof}**`
|
||||
if (type.enum) return type.enum.map(t => this.typedoc({ const: t })).join(' / ')
|
||||
if (['boolean', 'string', 'number'].includes(type.type)) return `<i>${type.type}</i>`
|
||||
if (type.oneOf) return type.oneOf.map(t => this.typedoc(t)).join(' / ')
|
||||
if (type.anyOf) return type.anyOf.map(t => this.typedoc(t)).join(' / ')
|
||||
if (type.const) return `<code>${type.const}</code>`
|
||||
if (type.instanceof) return `<i>${type.instanceof}</i>`
|
||||
if (type.type === 'array' && type.prefixItems) return `[${type.prefixItems.map(t => this.typedoc(t)).join(', ')}]`
|
||||
if (type.type === 'array' && typeof type.items !== 'boolean') return `${this.typedoc(type.items)}...`
|
||||
throw new Error(`no rule for ${JSON.stringify(type)}`)
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"`abbr`": "Abbreviates the text. Only the first character and subsequent characters following white space will be included.",
|
||||
"`acronym`(`list`: **string**, default: `'acronyms'`)": "Does an acronym lookup for the text. You can optionally pass the name of the list; the list must live in the Zotero/better-bibtex directory in your profile, and must use commas as the delimiter.",
|
||||
"`alphanum`": "clears out everything but unicode alphanumeric characters (unicode character classes `L` and `N`)",
|
||||
"`ascii`": "removes all non-ascii characters",
|
||||
"`capitalize`": "uppercases the first letter of each word",
|
||||
"`clean`": "transliterates the citation key and removes unsafe characters",
|
||||
"`condense`(`sep`: **string**, default: `''`)": "this replaces spaces in the value passed in. You can specify what to replace it with by adding it as a parameter, e.g `.condense(_)` will replace spaces with underscores. **Parameter should not contain spaces** unless you want the spaces in the value passed in to be replaced with those spaces in the parameter",
|
||||
"`default`(`text`: **string**)": "Returns the given text if no output was generated",
|
||||
"`discard`": "discards the input",
|
||||
"`fold`(`mode`: `chinese` | `german` | `japanese`)": "tries to replace diacritics with ascii look-alikes. Removes non-ascii characters it cannot match",
|
||||
"`formatDate`(`format`: **string**, default: `'%Y-%m-%d'`)": "formats date as by replacing y, m and d in the format",
|
||||
"`jieba`": "word segmentation for Chinese items. Uses substantial memory; must be enabled under Preferences -> Better BibTeX -> Advanced -> Citekeys",
|
||||
"`kuromoji`": "word segmentation for Japanese items. Uses substantial memory; must be enabled under Preferences -> Better BibTeX -> Advanced -> Citekeys",
|
||||
"`len`(`relation`: `!=` | `<` | `<=` | `=` | `>` | `>=`, default: `'>'`, `length`: **number**, default: `0`)": "If the length of the output does not match the given number, skip to the next pattern.",
|
||||
"`localTime`": "transforms date/time to local time. Mainly useful for dateAdded and dateModified as it requires an ISO-formatted input.",
|
||||
"`lower`": "Forces the text inserted by the field marker to be in lowercase. For example, `auth.lower` expands to the last name of the first author in lowercase.",
|
||||
"`nopunct`(`dash`: **string**, default: `'-'`)": "Removes punctuation",
|
||||
"`nopunctordash`": "Removes punctuation and word-connecting dashes. alias for `nopunct(dash='')`",
|
||||
"`numeric`": "returns the value if it's an integer",
|
||||
"`postfix`(`postfix`: **string**)": "postfixes with its parameter, so `postfix(_)` will add an underscore to the end if, and only if, the value it is supposed to postfix isn't empty",
|
||||
"`prefix`(`prefix`: **string**)": "prefixes with its parameter, so `.prefix(_)` will add an underscore to the front if, and only if, the value it is supposed to prefix isn't empty.",
|
||||
"`replace`(`find`: **string** | **RegExp**, `replace`: **string**)": "replaces text, case insensitive when passing a string; `.replace('.etal','&etal')` will replace `.EtAl` with `&etal`",
|
||||
"`select`(`start`: **number**, default: `1`, `n`: **number**)": "selects words from the value passed in. The format is `select(start,number)` (1-based), so `select(1,4)` or `select(n=4)` would select the first four words. If `n` is not given, all words from `start` to the end are selected.",
|
||||
"`skipwords`": "filters out common words like 'of', 'the', ... the list of words can be seen and changed by going into `about:config` under the key `extensions.zotero.translators.better-bibtex.skipWords` as a comma-separated, case-insensitive list of words.\n\nIf you want to strip words like 'Jr.' from names, you could use something like `[Auth:nopunct:skipwords:fold]` after adding `jr` to the skipWords list. Note that this filter is always applied if you use `title` (which is different from `Title`) or `shorttitle`.",
|
||||
"`splitIdeographs`": "Treat ideaographs as individual words",
|
||||
"`substring`(`start`: **number**, default: `1`, `n`: **number**)": "`substring(start,n)` selects `n` (default: all) characters starting at `start` (default: 1)",
|
||||
"`transliterate`(`mode`: `chinese` | `de` | `german` | `ja` | `japanese` | `minimal` | `zh`)": "transliterates the citation key. If you don't specify a mode, the mode is derived from the item language field",
|
||||
"`upper`": "Forces the text inserted by the field marker to be in uppercase. For example, `[auth:upper]` expands the last name of the first author in uppercase."
|
||||
"<code>abbr</code>": "<p>Abbreviates the text. Only the first character and subsequent characters following white space will be included. </p>",
|
||||
"<code>acronym</code>": "<p>Does an acronym lookup for the text. You can optionally pass the name of the list; the list must live in the Zotero/better-bibtex directory in your profile, and must use commas as the delimiter. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>list</code></td><td><i>string</i></td><td><code>'acronyms'</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>alphanum</code>": "<p>clears out everything but unicode alphanumeric characters (unicode character classes <code>L</code> and <code>N</code>) </p>",
|
||||
"<code>ascii</code>": "<p>removes all non-ascii characters </p>",
|
||||
"<code>capitalize</code>": "<p>uppercases the first letter of each word </p>",
|
||||
"<code>clean</code>": "<p>transliterates the citation key and removes unsafe characters </p>",
|
||||
"<code>condense</code>": "<p>this replaces spaces in the value passed in. You can specify what to replace it with by adding it as a parameter, e.g <code>.condense(_)</code> will replace spaces with underscores. <strong>Parameter should not contain spaces</strong> unless you want the spaces in the value passed in to be replaced with those spaces in the parameter </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>sep</code></td><td><i>string</i></td><td><code>''</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>default</code>": "<p>Returns the given text if no output was generated </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>text</code></td><td><i>string</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>discard</code>": "<p>discards the input </p>",
|
||||
"<code>fold</code>": "<p>tries to replace diacritics with ascii look-alikes. Removes non-ascii characters it cannot match </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>mode</code></td><td><code>chinese</code> / <code>german</code> / <code>japanese</code></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>formatDate</code>": "<p>formats date as by replacing y, m and d in the format </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>format</code></td><td><i>string</i></td><td><code>'%Y-%m-%d'</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>jieba</code>": "<p>word segmentation for Chinese items. Uses substantial memory; must be enabled under Preferences -> Better BibTeX -> Advanced -> Citekeys </p>",
|
||||
"<code>kuromoji</code>": "<p>word segmentation for Japanese items. Uses substantial memory; must be enabled under Preferences -> Better BibTeX -> Advanced -> Citekeys </p>",
|
||||
"<code>len</code>": "<p>If the length of the output does not match the given number, skip to the next pattern. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>relation</code></td><td><code>!=</code> / <code><</code> / <code><=</code> / <code>=</code> / <code>></code> / <code>>=</code></td><td><code>'>'</code> </td></tr>\n<tr><td><code>length</code></td><td><i>number</i></td><td><code>0</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>localTime</code>": "<p>transforms date/time to local time. Mainly useful for dateAdded and dateModified as it requires an ISO-formatted input. </p>",
|
||||
"<code>lower</code>": "<p>Forces the text inserted by the field marker to be in lowercase. For example, <code>auth.lower</code> expands to the last name of the first author in lowercase. </p>",
|
||||
"<code>nopunct</code>": "<p>Removes punctuation </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>dash</code></td><td><i>string</i></td><td><code>'-'</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>nopunctordash</code>": "<p>Removes punctuation and word-connecting dashes. alias for <code>nopunct(dash='')</code> </p>",
|
||||
"<code>numeric</code>": "<p>returns the value if it's an integer </p>",
|
||||
"<code>postfix</code>": "<p>postfixes with its parameter, so <code>postfix(_)</code> will add an underscore to the end if, and only if, the value it is supposed to postfix isn't empty </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>postfix</code></td><td><i>string</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>prefix</code>": "<p>prefixes with its parameter, so <code>.prefix(_)</code> will add an underscore to the front if, and only if, the value it is supposed to prefix isn't empty. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>prefix</code></td><td><i>string</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>replace</code>": "<p>replaces text, case insensitive when passing a string; <code>.replace('.etal','&etal')</code> will replace <code>.EtAl</code> with <code>&etal</code> </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>find</code></td><td><i>string</i> / <i>RegExp</i></td><td></td></tr>\n<tr><td><code>replace</code></td><td><i>string</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>select</code>": "<p>selects words from the value passed in. The format is <code>select(start,number)</code> (1-based), so <code>select(1,4)</code> or <code>select(n=4)</code> would select the first four words. If <code>n</code> is not given, all words from <code>start</code> to the end are selected. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>start</code></td><td><i>number</i></td><td><code>1</code> </td></tr>\n<tr><td><code>n</code></td><td><i>number</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>skipwords</code>": "<p>filters out common words like 'of', 'the', … the list of words can be seen and changed by going into <code>about:config</code> under the key <code>extensions.zotero.translators.better-bibtex.skipWords</code> as a comma-separated, case-insensitive list of words.</p>\n<p>If you want to strip words like 'Jr.' from names, you could use something like <code>[Auth:nopunct:skipwords:fold]</code> after adding <code>jr</code> to the skipWords list. Note that this filter is always applied if you use <code>title</code> (which is different from <code>Title</code>) or <code>shorttitle</code>. </p>",
|
||||
"<code>splitIdeographs</code>": "<p>Treat ideaographs as individual words </p>",
|
||||
"<code>substring</code>": "<p><code>substring(start,n)</code> selects <code>n</code> (default: all) characters starting at <code>start</code> (default: 1) </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>start</code></td><td><i>number</i></td><td><code>1</code> </td></tr>\n<tr><td><code>n</code></td><td><i>number</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>transliterate</code>": "<p>transliterates the citation key. If you don't specify a mode, the mode is derived from the item language field </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>mode</code></td><td><code>chinese</code> / <code>de</code> / <code>german</code> / <code>ja</code> / <code>japanese</code> / <code>minimal</code> / <code>zh</code></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>upper</code>": "<p>Forces the text inserted by the field marker to be in uppercase. For example, <code>[auth:upper]</code> expands the last name of the first author in uppercase. </p>"
|
||||
}
|
||||
@@ -1,35 +1,35 @@
|
||||
{
|
||||
"`authAuthEa`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `'.'`, `clean`: **boolean**, default: `true`)": "The last name of the first two authors, and \".ea\" if there are more than two.",
|
||||
"`authEtAl`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `' '`, `clean`: **boolean**, default: `true`)": "The last name of the first author, and the last name of the second author if there are two authors or \"EtAl\" if there are more than two. This is similar to `auth.etal`. The difference is that the authors are not separated by \".\" and in case of more than 2 authors \"EtAl\" instead of \".etal\" is appended.",
|
||||
"`authEtal2`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `'.'`, `clean`: **boolean**, default: `true`)": "The last name of the first author, and the last name of the second author if there are two authors or \".etal\" if there are more than two.",
|
||||
"`authForeIni`(`creator`: `author` | `editor`, default: `'author'`, `clean`: **boolean**, default: `true`)": "The given-name initial of the first author.",
|
||||
"`authIni`(`n`: **number**, default: `0`, `creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `'.'`, `clean`: **boolean**, default: `true`)": "The beginning of each author's last name, using no more than `N` characters.",
|
||||
"`auth`(`n`: **number**, default: `0`, `m`: **number**, default: `1`, `creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `clean`: **boolean**, default: `true`)": "The first `N` (default: all) characters of the `M`th (default: first) author's last name.",
|
||||
"`authorIni`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `'.'`, `clean`: **boolean**, default: `true`)": "The first 5 characters of the first author's last name, and the last name initials of the remaining authors.",
|
||||
"`authorLastForeIni`(`creator`: `author` | `editor`, default: `'author'`, `clean`: **boolean**, default: `true`)": "The given-name initial of the last author.",
|
||||
"`authorLast`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `clean`: **boolean**, default: `true`)": "The last name of the last author",
|
||||
"`authorsAlpha`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `' '`, `clean`: **boolean**, default: `true`)": "Corresponds to the BibTeX style \"alpha\". One author: First three letters of the last name. Two to four authors: First letters of last names concatenated. More than four authors: First letters of last names of first three authors concatenated. \"+\" at the end.",
|
||||
"`authors`(`n`: **number** | [**number**, **number**], default: `0`, `creator`: `author` | `editor`, default: `'author'`, `name`: **string**, default: `'%(f)s'`, `etal`: **string**, default: `''`, `sep`: **string**, default: `' '`, `clean`: **boolean**, default: `true`, `min`: **number**, default: `0`, `max`: **number**, default: `0`)": "Author/editor information. Parameters are: - `n`: select the first `n` authors (when passing a number) or the authors in this range (inclusive, when passing two values); negative numbers mean \"from the end\", default = 0 = all, - `creator`: select type of creator (`author` or `editor`), - `name`: sprintf-js template. Available named parameters are: `f` (family name), `g` (given name), `i` (initials) - `etal`: use this term to replace authors after `n` authors have been named, - `sep`: use this character between authors - `clean`: transliterates the citation key and removes unsafe characters - `min`: skip to the next pattern if there are less than `min` creators - `max`: skip to the next pattern if there are more than `max` creators",
|
||||
"`authshort`(`creator`: `author` | `editor`, default: `'author'`, `initials`: **boolean**, default: `false`, `sep`: **string**, default: `'.'`, `clean`: **boolean**, default: `true`)": "The last name if one author/editor is given; the first character of up to three authors' last names if more than one author is given. A plus character is added, if there are more than three authors.",
|
||||
"`date`(`format`: **string**, default: `'%Y-%m-%d'`)": "The date of the publication",
|
||||
"`extra`(`variable`: **string**)": "A pseudo-field from the extra field. eg if you have `Original date: 1970` in your `extra` field, you can get it as `extra(originalDate)`, or `tex.shortauthor: APA` which you could get with `extra('tex.shortauthor')`. Any `tex.` field will be picked up, the other fields can be selected from [this list](https://retorque.re/zotero-better-bibtex/exporting/extra-fields/) of key names.",
|
||||
"`firstpage`": "The number of the first page of the publication (Caution: this will return the lowest number found in the pages field, since BibTeX allows `7,41,73--97` or `43+`.)",
|
||||
"`inspireHep`": "Fetches the key from inspire-hep based on DOI or arXiv ID",
|
||||
"`journal`(`abbrev`: `abbrev` | `abbrev+auto` | `auto` | `off`, default: `'abbrev+auto'`)": "returns the journal abbreviation, or, if not found, the journal title, If 'automatic journal abbreviation' is enabled in the BBT settings, it will use the same abbreviation filter Zotero uses in the wordprocessor integration. You might want to use the `abbr` filter on this. Abbreviation behavior can be specified as `abbrev+auto` (the default) which uses the explicit journal abbreviation if present, and tries the automatic abbreviator if not (if auto-abbrev is enabled in the preferences), `auto` (skip explicit journal abbreviation even if present), `abbrev` (no auto-abbrev even if it is enabled in the preferences) or `off` (no abbrevation).",
|
||||
"`keyword`(`n`: **number**)": "Tag number `N`",
|
||||
"`language`(`name`: `ame` | `american` | `australian` | `austrian` | `bri` | `british` | `canadian` | `chinese` | `chinese-hans` | `chinese-hans-hk` | `chinese-hans-mo` | `chinese-hans-sg` | `chinese-hant` | `chinese-hant-hk` | `chinese-hant-mo` | `chinese-simplified` | `chinese-simplified-hongkongsarchina` | `chinese-simplified-macausarchina` | `chinese-simplified-singapore` | `chinese-traditional` | `chinese-traditional-hongkongsarchina` | `chinese-traditional-macausarchina` | `de` | `de-1901` | `de-at` | `de-at-1901` | `de-ch` | `de-ch-1901` | `de-ch-1996` | `de-de` | `deutsch` | `en` | `en-au` | `en-ca` | `en-en` | `en-gb` | `en-nz` | `en-us` | `eng` | `english` | `english-au` | `english-australia` | `english-ca` | `english-canada` | `english-gb` | `english-newzealand` | `english-nz` | `english-unitedkingdom` | `english-unitedstates` | `english-us` | `ger` | `german` | `german-at` | `german-austria` | `german-ch` | `german-switzerland` | `gsw` | `ja` | `ja-ja` | `jap` | `japanese` | `new` | `newzealand` | `nsw` | `nswissgerman` | `schwiizertüütsch` | `swi` | `swiss german` | `swissgerman` | `ukenglish` | `usenglish` | `zh` | `zh-hans` | `zh-hans-hk` | `zh-hans-mo` | `zh-hans-sg` | `zh-hant` | `zh-hant-hk` | `zh-hant-mo` | `zh-zh` | `中文` | `日本語`...)": "Tests whether the item has the given language set, and skips to the next pattern if not",
|
||||
"`lastpage`": "The number of the last page of the publication (See the remark on `firstpage`)",
|
||||
"`len`(`relation`: `!=` | `<` | `<=` | `=` | `>` | `>=`, default: `'>'`, `length`: **number**, default: `0`)": "If the length of the output does not match the given number, skip to the next pattern.",
|
||||
"`library`": "returns the name of the shared group library, or nothing if the item is in your personal library",
|
||||
"`month`": "the month of the publication",
|
||||
"`origdate`": "the original date of the publication",
|
||||
"`origyear`": "the original year of the publication",
|
||||
"`postfix`(`format`: **string**, default: `'%(a)s'`, `start`: **number**, default: `0`)": "a pseudo-function that sets the citekey disambiguation postfix using an <a href=\"https://www.npmjs.com/package/sprintf-js\">sprintf-js</a> format spec for when a key is generated that already exists. Does not add any text to the citekey otherwise. You *must* include *exactly* one of the placeholders `%(n)s`> (number), `%(a)s` (alpha, lowercase) or `e>%(A)s` (alpha, uppercase). For the rest of the disambiguator you can use things like padding and extra text as sprintf-js allows. With `+1` the disambiguator is always included, even if there is no need for it when no duplicates exist. The default format is `%(a)s`.",
|
||||
"`shorttitle`(`n`: **number**, default: `3`, `m`: **number**, default: `0`)": "The first `N` (default: 3) words of the title, apply capitalization to first `M` (default: 0) of those",
|
||||
"`shortyear`": "The last 2 digits of the publication year",
|
||||
"`title`": "Capitalize all the significant words of the title, and concatenate them. For example, `An awesome paper on JabRef` will become `AnAwesomePaperJabref`",
|
||||
"`type`(`allowed`: **string**...)": "Tests whether the item is of any of the given types, and skips to the next pattern if not",
|
||||
"`veryshorttitle`(`n`: **number**, default: `1`, `m`: **number**, default: `0`)": "The first `N` (default: 1) words of the title, apply capitalization to first `M` (default: 0) of those",
|
||||
"`year`": "The year of the publication",
|
||||
"`zotero`": "Generates citation keys as the stock Zotero Bib(La)TeX export does. Note that this pattern inherits all the problems of the original Zotero citekey generation -- you should really only use this if you have existing papers that rely on this behavior."
|
||||
"<code>auth</code>": "<p>The first <code>n</code> (default: all) characters of the <code>m</code>th (default: first) author's last name. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>description</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>n</code></td><td><i>number</i></td><td><p>the number of characters to take from the name, 0 = all</p></td><td><code>0</code> </td></tr>\n<tr><td><code>m</code></td><td><i>number</i></td><td><p>select the <code>m</code>th author</p></td><td><code>1</code> </td></tr>\n<tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><p>select from authors or only from editors</p></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><p>add author initials</p></td><td><code>false</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><p>transliterates the citation key and removes unsafe characters</p></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authAuthEa</code>": "<p>The last name of the first two authors, and \".ea\" if there are more than two. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>'.'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authEtAl</code>": "<p>The last name of the first author, and the last name of the second author if there are two authors or \"EtAl\" if there are more than two. This is similar to <code>auth.etal</code>. The difference is that the authors are not separated by \".\" and in case of more than 2 authors \"EtAl\" instead of \".etal\" is appended. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>' '</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authEtal2</code>": "<p>The last name of the first author, and the last name of the second author if there are two authors or \".etal\" if there are more than two. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>'.'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authForeIni</code>": "<p>The given-name initial of the first author. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authIni</code>": "<p>The beginning of each author's last name, using no more than <code>n</code> characters (0 = all). </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>n</code></td><td><i>number</i></td><td><code>0</code> </td></tr>\n<tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>'.'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authorIni</code>": "<p>The first 5 characters of the first author's last name, and the last name initials of the remaining authors. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>'.'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authorLast</code>": "<p>The last name of the last author </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authorLastForeIni</code>": "<p>The given-name initial of the last author. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authors</code>": "<p>Author/editor information. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>description</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>n</code></td><td><i>number</i> / [<i>number</i>, <i>number</i>]</td><td><p>select the first <code>n</code> authors (when passing a number) or the authors in this range (inclusive, when passing two values); negative numbers mean \"from the end\", default = 0 = all</p></td><td><code>0</code> </td></tr>\n<tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><p>select type of creator (<code>author</code> or <code>editor</code>)</p></td><td><code>'author'</code> </td></tr>\n<tr><td><code>name</code></td><td><i>string</i></td><td><p>sprintf-js template. Available named parameters are: <code>f</code> (family name), <code>g</code> (given name), <code>i</code> (initials)</p></td><td><code>'%(f)s'</code> </td></tr>\n<tr><td><code>etal</code></td><td><i>string</i></td><td><p>use this term to replace authors after <code>n</code> authors have been named</p></td><td><code>''</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><p>use this character between authors</p></td><td><code>' '</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><p>transliterates the citation key and removes unsafe characters</p></td><td><code>true</code> </td></tr>\n<tr><td><code>min</code></td><td><i>number</i></td><td><p>skip to the next pattern if there are less than <code>min</code> creators, 0 = ignore</p></td><td><code>0</code> </td></tr>\n<tr><td><code>max</code></td><td><i>number</i></td><td><p>skip to the next pattern if there are more than <code>max</code> creators, 0 = ignore</p></td><td><code>0</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authorsAlpha</code>": "<p>Corresponds to the BibTeX style \"alpha\". One author: First three letters of the last name. Two to four authors: First letters of last names concatenated. More than four authors: First letters of last names of first three authors concatenated. \"+\" at the end. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>' '</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>authshort</code>": "<p>The last name if one author/editor is given; the first character of up to three authors' last names if more than one author is given. A plus character is added, if there are more than three authors. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>creator</code></td><td><code>author</code> / <code>editor</code></td><td><code>'author'</code> </td></tr>\n<tr><td><code>initials</code></td><td><i>boolean</i></td><td><code>false</code> </td></tr>\n<tr><td><code>sep</code></td><td><i>string</i></td><td><code>'.'</code> </td></tr>\n<tr><td><code>clean</code></td><td><i>boolean</i></td><td><code>true</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>date</code>": "<p>The date of the publication </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>format</code></td><td><i>string</i></td><td><code>'%Y-%m-%d'</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>extra</code>": "<p>A pseudo-field from the extra field. eg if you have <code>Original date: 1970</code> in your <code>extra</code> field, you can get it as <code>extra(originalDate)</code>, or <code>tex.shortauthor: APA</code> which you could get with <code>extra('tex.shortauthor')</code>. Any <code>tex.</code> field will be picked up, the other fields can be selected from <a href=\"https://retorque.re/zotero-better-bibtex/exporting/extra-fields/\">this list</a> of key names. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>variable</code></td><td><i>string</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>firstpage</code>": "<p>The number of the first page of the publication (Caution: this will return the lowest number found in the pages field, since BibTeX allows <code>7,41,73--97</code> or <code>43+</code>.) </p>",
|
||||
"<code>inspireHep</code>": "<p>Fetches the key from inspire-hep based on DOI or arXiv ID </p>",
|
||||
"<code>journal</code>": "<p>returns the journal abbreviation, or, if not found, the journal title, If 'automatic journal abbreviation' is enabled in the BBT settings, it will use the same abbreviation filter Zotero uses in the wordprocessor integration. You might want to use the <code>abbr</code> filter on this. Abbreviation behavior can be specified as <code>abbrev+auto</code> (the default) which uses the explicit journal abbreviation if present, and tries the automatic abbreviator if not (if auto-abbrev is enabled in the preferences), <code>auto</code> (skip explicit journal abbreviation even if present), <code>abbrev</code> (no auto-abbrev even if it is enabled in the preferences) or <code>off</code> (no abbrevation). </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>abbrev</code></td><td><code>abbrev</code> / <code>abbrev+auto</code> / <code>auto</code> / <code>off</code></td><td><code>'abbrev+auto'</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>keyword</code>": "<p>Tag number <code>n</code> </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>n</code></td><td><i>number</i></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>language</code>": "<p>Tests whether the item has the given language set, and skips to the next pattern if not </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>description</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>name</code></td><td><code>ame</code> / <code>american</code> / <code>australian</code> / <code>austrian</code> / <code>bri</code> / <code>british</code> / <code>canadian</code> / <code>chinese</code> / <code>chinese-hans</code> / <code>chinese-hans-hk</code> / <code>chinese-hans-mo</code> / <code>chinese-hans-sg</code> / <code>chinese-hant</code> / <code>chinese-hant-hk</code> / <code>chinese-hant-mo</code> / <code>chinese-simplified</code> / <code>chinese-simplified-hongkongsarchina</code> / <code>chinese-simplified-macausarchina</code> / <code>chinese-simplified-singapore</code> / <code>chinese-traditional</code> / <code>chinese-traditional-hongkongsarchina</code> / <code>chinese-traditional-macausarchina</code> / <code>de</code> / <code>de-1901</code> / <code>de-at</code> / <code>de-at-1901</code> / <code>de-ch</code> / <code>de-ch-1901</code> / <code>de-ch-1996</code> / <code>de-de</code> / <code>deutsch</code> / <code>en</code> / <code>en-au</code> / <code>en-ca</code> / <code>en-en</code> / <code>en-gb</code> / <code>en-nz</code> / <code>en-us</code> / <code>eng</code> / <code>english</code> / <code>english-au</code> / <code>english-australia</code> / <code>english-ca</code> / <code>english-canada</code> / <code>english-gb</code> / <code>english-newzealand</code> / <code>english-nz</code> / <code>english-unitedkingdom</code> / <code>english-unitedstates</code> / <code>english-us</code> / <code>ger</code> / <code>german</code> / <code>german-at</code> / <code>german-austria</code> / <code>german-ch</code> / <code>german-switzerland</code> / <code>gsw</code> / <code>ja</code> / <code>ja-ja</code> / <code>jap</code> / <code>japanese</code> / <code>new</code> / <code>newzealand</code> / <code>nsw</code> / <code>nswissgerman</code> / <code>schwiizertüütsch</code> / <code>swi</code> / <code>swiss german</code> / <code>swissgerman</code> / <code>ukenglish</code> / <code>usenglish</code> / <code>zh</code> / <code>zh-hans</code> / <code>zh-hans-hk</code> / <code>zh-hans-mo</code> / <code>zh-hans-sg</code> / <code>zh-hant</code> / <code>zh-hant-hk</code> / <code>zh-hant-mo</code> / <code>zh-zh</code> / <code>中文</code> / <code>日本語</code>...</td><td><p>one or more language codes</p></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>lastpage</code>": "<p>The number of the last page of the publication (See the remark on <code>firstpage</code>) </p>",
|
||||
"<code>len</code>": "<p>If the length of the output does not match the given number, skip to the next pattern. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>relation</code></td><td><code>!=</code> / <code><</code> / <code><=</code> / <code>=</code> / <code>></code> / <code>>=</code></td><td><code>'>'</code> </td></tr>\n<tr><td><code>length</code></td><td><i>number</i></td><td><code>0</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>library</code>": "<p>returns the name of the shared group library, or nothing if the item is in your personal library </p>",
|
||||
"<code>month</code>": "<p>the month of the publication </p>",
|
||||
"<code>origdate</code>": "<p>the original date of the publication </p>",
|
||||
"<code>origyear</code>": "<p>the original year of the publication </p>",
|
||||
"<code>postfix</code>": "<p>a pseudo-function that sets the citekey disambiguation postfix using an <a href=\"https://www.npmjs.com/package/sprintf-js\">sprintf-js</a> format spec for when a key is generated that already exists. Does not add any text to the citekey otherwise. You <em>must</em> include <em>exactly</em> one of the placeholders <code>%(n)s</code>> (number), <code>%(a)s</code> (alpha, lowercase) or <code>e>%(A)s</code> (alpha, uppercase). For the rest of the disambiguator you can use things like padding and extra text as sprintf-js allows. With <code>+1</code> the disambiguator is always included, even if there is no need for it when no duplicates exist. The default format is <code>%(a)s</code>. </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>format</code></td><td><i>string</i></td><td><code>'%(a)s'</code> </td></tr>\n<tr><td><code>start</code></td><td><i>number</i></td><td><code>0</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>shorttitle</code>": "<p>The first <code>n</code> (default: 3) words of the title, apply capitalization to first <code>m</code> (default: 0) of those </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>n</code></td><td><i>number</i></td><td><code>3</code> </td></tr>\n<tr><td><code>m</code></td><td><i>number</i></td><td><code>0</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>shortyear</code>": "<p>The last 2 digits of the publication year </p>",
|
||||
"<code>title</code>": "<p>Capitalize all the significant words of the title, and concatenate them. For example, <code>An awesome paper on JabRef</code> will become <code>AnAwesomePaperJabref</code> </p>",
|
||||
"<code>type</code>": "<p>Tests whether the item is of any of the given types, and skips to the next pattern if not </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>description</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>allowed</code></td><td><i>string</i>...</td><td><p>one or more item type names</p></td><td></td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>veryshorttitle</code>": "<p>The first <code>n</code> (default: 1) words of the title, apply capitalization to first <code>m</code> (default: 0) of those </p>\n <details class=\"details\"><summary class=\"summary\">parameters:</summary>\n <table>\n <thead><tr><th>parameter</th><th>type</th><th>default</th></tr></thead>\n <tbody>\n <tr><td><code>n</code></td><td><i>number</i></td><td><code>1</code> </td></tr>\n<tr><td><code>m</code></td><td><i>number</i></td><td><code>0</code> </td></tr>\n </tbody>\n </table>\n </details>",
|
||||
"<code>year</code>": "<p>The year of the publication </p>",
|
||||
"<code>zotero</code>": "<p>Generates citation keys as the stock Zotero Bib(La)TeX export does. Note that this pattern inherits all the problems of the original Zotero citekey generation -- you should really only use this if you have existing papers that rely on this behavior. </p>"
|
||||
}
|
||||
@@ -10,6 +10,27 @@
|
||||
#body-inner h3 { text-decoration: underline green }
|
||||
</style>
|
||||
{{ end }}
|
||||
<style>
|
||||
details.details > summary.summary::before {
|
||||
content: '▶️';
|
||||
}
|
||||
|
||||
details.details[open] > summary.summary:before {
|
||||
content: '🔽';
|
||||
}
|
||||
|
||||
/*
|
||||
details.details {
|
||||
border: 1px solid gray;
|
||||
border-radius: 0.2rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
details.details[open] > summary.summary {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
*/
|
||||
</style>
|
||||
{{ if in .Permalink "/exporting/extra-fields/" }}
|
||||
<link rel="stylesheet" href="http://cdn.graphalchemist.com/alchemy.min.css"/>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ul>
|
||||
<dl>
|
||||
{{ range $filter, $description := .Site.Data.citekeyformatters.filters }}
|
||||
<li>{{ $filter | markdownify }}: {{ $description | markdownify }}</li>
|
||||
<dt>{{ $filter | safeHTML }}</dt></dd>{{ $description | safeHTML }}</dd>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</dl>
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
<ul>
|
||||
<dl>
|
||||
{{ range $func, $description := .Site.Data.citekeyformatters.functions }}
|
||||
<li>{{ $func | markdownify }}: {{ $description | markdownify }}</li>
|
||||
<dt>{{ $func | safeHTML }}</dt><dd>{{ $description | safeHTML }}</dd>
|
||||
{{ end }}
|
||||
<li><code>postfix=<spec></code>/<code>postfix+1=<spec></code>:
|
||||
a pseudo-function that sets the citekey disambiguation postfix using an <a href="https://www.npmjs.com/package/sprintf-js">sprintf-js</a> format spec
|
||||
for when a key is generated that already exists. Does not add any text to the citekey otherwise.
|
||||
You <i>must</i> include <i>exactly</i> one of the placeholders <code>%(n)s</code> (number), <code>%(a)s</code> (alpha, lowercase) or <code>%(A)s</code> (alpha, uppercase).
|
||||
For the rest of the disambiguator you can use things like padding and extra text as sprintf-js allows. With <code>+1</code> the disambiguator is always included, even if there is no need for it because no duplicates exist. The default format is <code>%(a)s</code>.
|
||||
</li>
|
||||
<li><code>0</code>: an alias for <code>[postfix=-%(n)s]</code>. Emulates the disambiguator of the standard Zotero exports. When you use <code>[zotero]</code> in your pattern, <code>[zotero][0]</code> is implied</li>
|
||||
<li><code>>X</code>: a pseudo-function which aborts the current pattern generation if what came before it is <code>X</code> characters or less (<code>[>0]</code> is a typical use. You would typically use this with something like <code>[auth][>0][year] | [title][year]</code> which means if there's no author you get <code>title-year</code> rather than just <code>year</code>.</li>
|
||||
<li><code>=typeName</code>: a pseudo-function that aborts the current pattern generation if the Zotero item type does not equal <code>typeName</code>. You can test for multiple typenames at once by separating them with slashes (<code>[=journalArticle/report]</code>). Valid typeNames are: {{ range $index, $tn := .Site.Data.citekeyformatters.typeNames }}{{ if (ne $index 0) }}, {{ end }}<code>{{ $tn | safeHTML }}</code>{{ end }}.</li>
|
||||
</ul>
|
||||
</dl>
|
||||
|
||||
(type names marked <sup>JM</sup> are only available in Juris-M).
|
||||
|
||||
Reference in New Issue
Block a user