mkbib.c
来自「HTML-XML-utils由一套小型C程序(过滤器)组成」· C语言 代码 · 共 62 行
C
62 行
/* * mkbib - extract database entries from a db and format them * * mkbib reads a refer-style database of bibliographic entries, a list * of keys and a pattern file and outputs a list of citations * formatted according to the pattern and optionally sorted. * * The keys must correspond to %L fields in the refer database. * * The pattern file has the following structure: * * pattern: PREAMBLE entry POSTAMBLE; * entry: "{L:" [ TEXT | FIELD | conditional ]* "}"; * conditional: "{" !"? F ":" [ TEXT | FIELD | conditional ]* "}"; * * In the output, the entry will be repeated as often as there are * unique keys. A FIELD is of the form "%x" and wil be replaced by * field x of the entry. * * A part of the form "{x:ZZZ}" will be replaced by ZZZ if field x * exists and by nothing otherwise. A part of the form "{!x:ZZZ}" will * be replaced by ZZZ if field x does not exist. * * Occurrences of %x in the preamble (where x is a field name) will * not be output, but serve to build up the sort order. The default * sort order is to keep entries in the order they occur in the * auxfile, but if, e.g., "%A%D%T" occurs in the preamble, entries * will be sorted on author, date and title. * * To insert a literal "{", "}" or "%" in the preamble or in an entry, * prefix them with "%": "%{", "%}" and "%%". * * Usage: mkbib [-a auxfile] bibfile [inputfile] * * bibfile is a refer-style database. * * inputfile is the file that serves as template. If absent, stdin * is read. * * -a auxfile gives the name of the list of keys. If absent, the name * will be the same as inputfile with the extension (if any) * changed to ".aux". If no inputfile is given the default auxfile * is "aux.aux". Duplicate keys will only be used once. * * Note: When the "{x:" and "}" are inside an HTML file, they may be * in places where data is not allowed. To make the input file * itself valid HTML, it may be necessary to put them inside comments: * <!--{x:--> and <!--}-->. If one of them is put inside a comment, * the other must be as well. * * Here is an example of an input file: * * <html> * <title>Bibliography</title> * <!-- sort order is Author, Date, Title %A%D%T--> * <dl> * <!--{L:--><dt id="%L">%L * <dd>{A:%A.} <em>{T:%T.}</em> {D:%D. } * <!--}--></dl> * </html> * * Copyright
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?