-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
This is a feature request. Would it make sense to allow BibTeX::Filter
know more metadata in addition to the value?
For example, instead of making filter interface as:
class Filter
def apply(value)
end
end
Allow the interface access more meta data:
class Filter
def apply(value, info)
end
end
The info
would be a Hash storing variaous meta data, such as:
{
:entry => # the entry of the whole bibtex record
:field => # the field of the current value, such as :first_name, :last_name, :title, etc.
:index => # the index of the value if there are multiple same field, e.g. the index of the author.
:annotation => # support bibtex annotation
}
The reason of using Hash is that it allows us to extend the feature in the future if necessary.
This will allow the filter to access more information regarding the current value. And it will enable us to support many features. For example:
- Allow us to highlight authors using bibtex annotation (Unable to parse bibtex if
+
is in the key #128)
class HighlightAuthor < BibTeX::Filter
def apply(value, info)
if info[:field] == :author && info[:annotation] == "highlight"
"<b>#{value}</b>"
else
value
end
end
end
- Append conference abbreviation in the booktitle.
class ConfAbbr < BibTeX::Filter
def apply(value, info)
if info[:field] == :booktitle
"#{value} (<b>#{info[:entry].series}</b>)"
else
value
end
end
end
Metadata
Metadata
Assignees
Labels
No labels