Command Line Options
As the command “
sebib -help” nicely says, the usage is
sebib [OPTIONS] file1.sebib file2.sebib ...
and the options are:
- -validate : Validate the files, continues if OK, exits(2) if not
- -bibtex-able : Checks that every entry has either a 'bibtex' field or is able to build an acceptable @misc entry (id, title, how), continues if OK, exits(3) if not
- -stdin : Also use stdin as input
- -bibtex <file> : Output a BibTeX file (- for stdout)
- -sebib <file> : Output a Sebib file (- for stdout)
- -format <string> : Output to stdout using the <string> format for each entry see -help-format
- -format-no-ws : Replace all whitespace by sigle spaces in -format's fields (except 'bibtex', format sanitizations can be composed following command line's order)
- -format-latex : Sanitize -format's fields for latex (except 'bibtex', format sanitizations can be composed following command line's order)
- -format-xml : Sanitize -format's fields for XML formats (except 'bibtex', format sanitizations can be composed following command line's order)
- -ids : This is a convenience shortcut for -format "@{id} "
- -select <s-expr> : Filter the bibliography with a query see -help-select
- -sort <field> : Sort the bibliography following alphabetical order on a given field
- -reverse : Reverse the order of the bibliography (if -sort is given, -reverse is applied after the sorting)
- -help-format : Help about the -format option
- -help-select : Help about the -select option
- -version : Print version
- -help,--help: Display this list of options
This is given by “
sebib -help-format”. The
format is a string with special tokens which are interpreted as commands:
- @{id} : id
- @{authors} : authors (coma separated list)
- @{authors-and} : authors (comas and a 'and' for the last one)
- @{authors-bibtex} : authors (BibTeX friendly format)
- @{authors-acm} : authors (like ACM Ref, with initials)
- @{authors-etal} : authors (Depending on the number of authors: 1: Lastname 2: Lastname1 and Lastname2 more: Lastname1 et al.)
- @{title} : title
- @{title-punct} : the title with a dot '.' if not already ending with '?', '.', or '!'
- @{how} : how
- @{year} : year
- @{note} : note
- @{url} : url
- @{pdfurl} : pdfurl
- @{comment} : comment tagged "main" (or non-tagged)
- @{comment-<tag>} : comment tagged "tag"
- @{bibtex} : The (maybe generated) BibTeX entry (if there's no `bibtex' field, the entry is generated, like for the '-bibtex' option)
- @{abstract} : abstract
- @{doi} : doi
- @{citation} : citation
- @{tags} : tags (coma separated list)
- @{keywords} : keywords (coma separated list)
- @{@} : the '@' character
- @{n} : the new-line character
- @{if <expr>} AAA @{else} BBB @{endif} : Evaluates <expr> for the entry, if true, displays AAA, if not, BBB. (<expr> uses the same syntax as the '-select' option, see 'sebib -help-select')
The -select Syntax
This is given by “
sebib -help-select”. Queries are S-Expressions, but the external parentheses may be omitted.
- (ids <id1> <id2> <id3> ...): the items whose ids are <id1>, <id2>, ...
- (and <expr1> <expr2> ...): logical "and" between expressions
- (or <expr1> <expr2> ...): logical "or" between expressions
- (not <expr>): logical negation of an expression
- (tags <tag1> <tag2> <tag3>): look for the tags (it is an intersection, i.e. an "and")
- (matches <field> <regexp>): look if you find <regexp> in <field> The regexp syntax is Perl-Compatible
- (has <field>): the field is present functionally equivalent to (matches (<field> ""))
Examples
Let's say you have two bibliography files: improbadrive.sebib and smonelsepb.sebib (the file-extensions do not have necessarily to be .sebib).
You want to retrieve a list of IDs, corresponding to references, in both files, which have the tags ‘h2g2’
and ‘not_read_yet’:
sebib -select "tags h2g2 not_read_yet" -ids improbadrive.sebib smonelsepb.sebib
You want an ad-hoc citation, in text mode of the reference whose ID is ‘smith2178’ and which is in
improbadrive.sebib:
sebib improbadrive.sebib -select "(ids smith2178)" \
-format "@{authors-and}, @{year}. @{title-punct} @{how}"
You want to format all the references in
smonelsepb.sebib, in HTML, sorted by year, and with a link to their URL (only if they actually have one):
sebib smonelsepb.sebib -format-xml -sort year \
-format "<i>@{authors-etal}</i>: <b>@{title-punct}</b> @{year}\
(@{if (has url)}<a href=\"@{url}\">URL</a>@{else}No URL@{endif})\
<br/>@{n}"