bibtex

package module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2016 License: BSD-3-Clause Imports: 6 Imported by: 7

README

bibtex

A Golang BibTeX package and collection of related command line utilities.

bibfilter

Output my.bib file without comment entries

  bibfilter -exclude=comment my.bib

Output only articles from my.bib

    bibfilter -include=article my.bib

Output only articles and conference proceedings from my.bib

    bibfilter -include=article,inproceedings my.bib

bibmerge

Output a new bibtex file based on the contents of two other bibtex files.

Join of two bibtex files

    bibmerge -join mybib1.bib mybib2.bib

Difference (asymmetric, set A - B may not equal set B - A) of two bibtex files

    bibmerge -diff mybib1.bib mybib2.bib

Intersection of two bibtex files

    bibmerge -intersect mybib1.bib mybib2.bib

Excluse difference (symmetric difference, inverse of intersection) of two bibtex files

    bibmerge -exclusive mybib1.bib mybib2.bib

Documentation

Overview

Package bibtex is a quick and dirty BibTeX parser for working with a Bibtex citation

@author R. S. Doiel, <rsdoiel@caltech.edu>

Copyright (c) 2016, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

View Source
const (
	// Version of BibTeX package
	Version = "v0.0.4"

	// DefaultInclude list
	DefaultInclude = "" /* 150-byte string literal not displayed */

	// A template for printing an element
	ElementTmplSrc = `` /* 132-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func Bib

func Bib(token *tok.Token, buf []byte) (*tok.Token, []byte)

Bib is a niave BibTeX Tokenizer function Note: there is an English bias in the AlphaNumeric check

func Contains added in v0.0.6

func Contains(elemList []*Element, target *Element) bool

Contains checks an array of Elements for a specific element

func Equal added in v0.0.6

func Equal(elem1, elem2 *Element) bool

Equal compares two Element structures and sees if the contents agree

func NotEqual added in v0.0.6

func NotEqual(elem1, elem2 *Element) bool

NotEqual compares two element structures and see if the contents disagree

Types

type ByKey added in v0.0.6

type ByKey []string

ByKey struct is for sorting Element Keys

func (ByKey) Len added in v0.0.6

func (a ByKey) Len() int

Len of ByKey array

func (ByKey) Less added in v0.0.6

func (a ByKey) Less(i, j int) bool

Less return the lesser of ByKey array elements

func (ByKey) Swap added in v0.0.6

func (a ByKey) Swap(i, j int)

Swap of ByKey array elements

type Element

type Element struct {
	XMLName xml.Name          `json:"-"`
	Type    string            `xml:"type" json:"type"`
	Keys    []string          `xml:"keys" json:"keys"`
	Tags    map[string]string `xml:"tags" json:"tags"`
}

Generic Element

func Clone added in v0.0.6

func Clone(elem *Element) *Element

Clone creates a new Element based on an existing element

func Diff added in v0.0.6

func Diff(elemList1, elemList2 []*Element) []*Element

Diff creates a new Element Array of all the elements in elemList1 an not in elemList2

func Exclusive added in v0.0.6

func Exclusive(elemList1, elemList2 []*Element) []*Element

Exclusive create a new Element Array with elements that only exist in elemList1 or elemList2

func Intersect added in v0.0.6

func Intersect(elemList1, elemList2 []*Element) []*Element

Intersect create a new Element Array of elements in both elemList1 and elemList2

func Join added in v0.0.6

func Join(elemList1, elemList2 []*Element) []*Element

Join create a new Element array by combining to Element arrays without creating duplicate entries

func Parse

func Parse(buf []byte) ([]*Element, error)

Parse a BibTeX file into appropriate structures

func (*Element) String

func (element *Element) String() string

Render a single BibTeX element

type Elements

type Elements []*Element

type TagTypes

type TagTypes struct {
	Required []string
	Optional []string
}

Directories

Path Synopsis
cmds
bibfilter command
bibfilter reads a bibfile and writes it out.
bibfilter reads a bibfile and writes it out.
bibmerge command
bibset reads in two bibfiles and writes out new one based on operation selected (e.g.
bibset reads in two bibfiles and writes out new one based on operation selected (e.g.
webapp.go a Web Application of bibtex package @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2016, Caltech All rights not granted herein are expressly reserved by Caltech.
webapp.go a Web Application of bibtex package @author R. S. Doiel, <rsdoiel@caltech.edu> Copyright (c) 2016, Caltech All rights not granted herein are expressly reserved by Caltech.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL