Module: BibTeX::Options::SortFieldsOptions

Defined in:
lib/rbibtex/transform.rb

Overview

Module to be included in an OptionParser parse. Creates top_fields and bottom_fields switches.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bottom_fieldsObject (readonly)

Returns the value of attribute bottom_fields.



50
51
52
# File 'lib/rbibtex/transform.rb', line 50

def bottom_fields
  @bottom_fields
end

#top_fieldsObject (readonly)

Returns the value of attribute top_fields.



50
51
52
# File 'lib/rbibtex/transform.rb', line 50

def top_fields
  @top_fields
end

Instance Method Details

#initializeObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rbibtex/transform.rb', line 52

def initialize
	super()

	@top_fields    = [:author, :title, :year]
	@bottom_fields = [:note, :pdf, :ps, :www]    

	self.separator ""
	self.separator "Sorting of fields"
	self.on("-t", "--top-fields", "--top_fields Field_1,Field2,...", Array,
		"Specify a list of fields that are written first in the output")   { | v |
		  @top_fields     = v.map { | e | e.downcase.to_sym }
     @bottom_fields -= @top_fields 
	}
	self.on("-b", "--bottom-fields", "--bottom_fields Field_1,Field2,...", Array,
		"Specify a list of fields that are written last in the output")    { | v | 
		  @bottom_fields  = v.map { | e | e.downcase.to_sym }
     @top_fields -= @bottom_fields 
	}
end