Module: Dblpbib
- Defined in:
- lib/dblpbib.rb,
lib/dblpbib/version.rb
Overview
Bits of logic
Constant Summary collapse
- VERSION =
'0.2.0'.freeze
- DESCRIPTION =
'Automatically create bibliographies for ' \ 'BibTeX DBLP references.'.freeze
Class Method Summary collapse
Class Method Details
.scan_keys(document) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dblpbib.rb', line 5 def self.scan_keys(document) # TODO: Extract the allowed command names, possible make them configurable document .gsub(/(?<!\\)%.*$/, '') .scan(%r{ # Command \\(text|auto)?cite(|(al)?[pt]\*?|year(par|\*)?|par\*?|author\*?|text|) # Optionally options (\[[^\]]+\])? # Parameters \{([^\}]+)\} }x) .map(&:pop) .flat_map { |keyset| keyset.split(',') } .map(&:strip) .keep_if { |key| key.start_with?('DBLP:') } .map { |key| key.sub('DBLP:', '') } .uniq end |