bibtool icon indicating copy to clipboard operation
bibtool copied to clipboard

some formatting instructions not working in custom fields?

Open herrsimon opened this issue 5 years ago • 2 comments

Hello,

I'm trying to add some custom fields to my data but for some reason the logical formatting instructions don't work. For example, if I have the resource file

new.field.type {test}
add.field {test="{%n(author) # %n(editor)}"}

and the input file contains (indentation is messed up due to copy and paste)

@InCollection{	  key,
  series	= {Testseries},
  title		= {Testtitle},
  author	= {Muster, Max},
  editor	= {Doe, John},
  year		= {1985},
  pages		= {1--10},
}

then running bibtool -r test.rsc -i input.bib -o output.bib and no default resource file in the file tree produces

@InCollection{	  key,
  series	= {Testseries},
  title		= {Testtitle},
  author	= {Muster, Max},
  editor	= {Doe, John},
  year		= {1985},
  pages		= {1--10},
  test		= {{Muster # Doe}}
}

A similar problem occurs when the alternative clause is replaced by an if-then-else statement, for example

new.field.type {test}
add.field {test="(author) {%n(author)} {%n(editor)}"}

Am I missing something?

herrsimon avatar Sep 28 '19 21:09 herrsimon

I had to read the documentation carefully myself. It says that during adding new fields the pseudo-fields are expanded only. This does not include all formatting instructions.

I can imagine to support formatting instructions as well since this might be a desirable extension. I will have to think about it.

ge-ne avatar Oct 02 '19 14:10 ge-ne

ok, I think this would be a very useful extension.

herrsimon avatar Oct 05 '19 12:10 herrsimon