Bibtex Parser View Source
A parser for Bibtex files, implemented using NimbleParsec. Currently work in progress. Missing features are shown below:
Missing features
Can not parse full Bibtex files.- No support for
@STRING
,@PREAMBLE
, or@COMMENT
. String concatenation (e.g.,author = "Jose" # "Valim"
) not supported yet.DocumentationUnquoted tag values (e.g., a year)
Example
defmodule BibtexParser do
import BibtexParser.Parser
def example do
input = """
@techreport{agha1985actors,
title={Actors: A model of concurrent computation in distributed systems.},
author={Agha, Gul A},
year={1985},
institution={MASSACHUSETTS INST OF TECH CAMBRIDGE ARTIFICIAL INTELLIGENCE LAB}
}
"""
result = parse_entry(input)
# => {:ok,
# %{
# label: 'agha1985actors',
# tags: [
# title: 'Actors: A model of concurrent computation in distributed systems.',
# author: 'Agha, Gul A',
# year: '1985',
# institution: 'MASSACHUSETTS INST OF TECH CAMBRIDGE ARTIFICIAL INTELLIGENCE LAB'
# ],
# type: 'techreport'
# }}
end
end
Installation
The package can be installed by adding :bibtex_parser
to your list of
dependencies in mix.exs
:
def deps do
[
{:bibtex_parser, "~> 0.1.0"}
]
end
Copyright and License
Copyright (c) 2018 Christophe De Troyer
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.