Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Rewrite and test layout formatter #109

Closed
wants to merge 2 commits into from
Closed

Conversation

stefan-kolb
Copy link
Member

Rationale

  1. The layout formatter feature is a bit hidden and it is unclear how many people really use this feature.
  2. The feature is complex to use
  3. Some of the formatters should be a) integrated as default auto formatters b) removed because they really don't make a lot of sense.
  4. Most license problems are caused by these classes.

List

  • Authors : this formatter provides formatting options for the author and editor fields; for detailed information, see below. It deprecates a range of dedicated formatters provided in versions of JabRef prior to 2.7.
  • CreateBibORDFAuthors : formats authors for according to the requirements of the Bibliographic Ontology (bibo).
  • CreateDocBookAuthors : formats the author field in DocBook style.
  • CreateDocBookEditors : formats the editor field in DocBook style.
  • CurrentDate: outputs the current date. With no argument, this formatter outputs the current date and time in the format "yyyy.MM.dd hh:mm:ss z" (date, time and time zone). By giving a different format string as argument, the date format can be customized. E.g. \format[CurrentDate]{yyyy.MM.dd} will give the date only, e.g. 2005.11.30.
  • Default : takes a single argument, which serves as a default value. If the string to format is non-empty, it is output without changes. If it is empty, the default value is output. For instance, \format[Default(unknown)]{\year} will output the entry's year if set, and "unknown" if no year is set.

DOIStrip: strips any prefixes from the DOI string.

Should be automatically integrated as sensible default!

DOICheck : provides the full url for a DOI link.

DOICheck as name makes no sense. Rename at least to DOILink.

  • FileLink(filetype) : if no argument is given, this formatter outputs the first external file link encoded in the field. To work, the formatter must be supplied with the contents of the "file" field.
    This formatter takes the name of an external file type as an optional argument, specified in parentheses after the formatter name. For instance, \format[FileLink(pdf)]{\file} specifies pdf as an argument. When an argument is given, the formatter selects the first file link of the specified type. In the example, the path to the first PDF link will be output.
  • FirstPage : returns the first page from the "pages" field, if set. For instance, if the pages field is set to "345-360" or "345--360", this formatter will return "345".
  • FormatChars : This formatter converts LaTeX character sequences their equicalent unicode characters and removes other LaTeX commands without handling them.
  • FormatPagesForHTML : replaces "--" with "-".
  • FormatPagesForXML : replaces "--" with an XML en-dash.
  • GetOpenOfficeType : returns the number used by the OpenOffice.org bibliography system (versions 1.x and 2.x) to denote the type of this entry.
  • HTMLChars : replaces TeX-specific special characters (e.g. {^a} or {"{o}}) with their HTML representations, and translates LaTeX commands \emph, \textit, \textbf into HTML equivalents.
  • HTMLParagraphs : interprets two consecutive newlines (e.g. \n \n) as the beginning of a new paragraph and creates paragraph-html-tags accordingly.
  • IfPlural : outputs its first argument if the input field looks like an author list with two or more names, or its second argument otherwise. E.g. \format[IfPlural(Eds.,Ed.)]{\editor} will output "Eds." if there is more than one editor, and "Ed." if there is only one.
  • JournalAbbreviator : The given input text is abbreviated according to the journal abbreviation lists. If no abbreviation for input is found (e.g. not in list or already abbreviated), the input will be returned unmodified. For instance, when using \format[JournalAbbreviator]{\journal}, "Physical Review - Letters" gets "Phys. Rev. Lett."
  • LastPage : returns the last page from the "pages" field, if set. For instance, if the pages field is set to "345-360" or "345--360", this formatter will return "360".
  • NoSpaceBetweenAbbreviations : LayoutFormatter that removes the space between abbreviated First names. Example: J. R. R. Tolkien becomes J.R.R. Tolkien.
  • NotFoundFormatter : Formatter used to signal that a formatter hasn't been found. This can be used for graceful degradation if a layout uses an undefined format.
  • Number : outputs the 1-based sequence number of the current entry in the current export. This formatter can be used to make a numbered list of entries. The sequence number depends on the current entry's place in the current sort order, not on the number of calls to this formatter.

RemoveBrackets : removes all curly brackets "{" or "}".

This just removes all brackets without checking for escape sequences or such, e.g. {.

RemoveBracketsAddComma: removes all curly brackets "{" or "}". The closing curly bracket is replaced by a comma.

I don't see any use case where I want to do this.

  • RemoveLatexCommands : removes LaTeX commands like \em, \textbf, etc. If used together with HTMLChars or XMLChars, this formatter should be called last.

RemoveTilde: replaces the tilde character used in LaTeX as a non-breakable space by a regular space. Useful in combination with the NameFormatter discussed in the next section.

RemoveWhitespace: removes all whitespace characters.

Where would this make any sense?

  • Replace(regexp,replacewith) : does a regular expression replacement. To use this formatter, a two-part argument must be given. The parts are separated by a comma. To indicate the comma character, use an escape sequence: ,   The first part is the regular expression to search for. Remember that any commma character must be preceded by a backslash, and consequently a literal backslash must be written as a pair of backslashes. A description of Java regular expressions can be found at:  http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html   The second part is the text to replace all matches with.

RisAuthors : to be documented.
RisKeywords : to be documented.
RisMonth : to be documented.

Biblioscape formatter?

  • RTFChars : replaces TeX-specific special characters (e.g. {^a} or {"{o}}) with their RTF representations, and translates LaTeX commands \emph, \textit, \textbf into RTF equivalents.
  • ToLowerCase : turns all characters into lower case.
  • ToUpperCase : turns all characters into upper case.
  • WrapContent : This formatter outputs the input value after adding a prefix and a postfix, as long as the input value is non-empty. If the input value is empty, an empty string is output (the prefix and postfix are not output in this case). The formatter requires an argument containing the prefix and postix separated by a comma. To include the comma character in either, use an escape sequence (,).
  • WrapFileLinks : See below.
  • XMLChars : : replaces TeX-specific special
    characters (e.g. {^a} or {"{o}}) with their XML
    representations.

Decisions

@koppor
Copy link
Member

koppor commented Aug 23, 2015

Issue #119 is related to this issue. Besides the preview, the formatter is used for determine the filename of a PDF file: Preferences -> Import -> File name format pattern. Maybe we should ask at the mailing list?

@stefan-kolb
Copy link
Member Author

Should be done in student project or later. Will close for now and chery-pick the changes.

@stefan-kolb stefan-kolb deleted the formatters branch November 19, 2015 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants