Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoc-bib/extensions.rb

Overview

Two methods are added to extend the String class.

Instance Method Summary collapse

Instance Method Details

#html_to_asciidocObject

Converts html output produced by citeproc to asciidoc markup.



36
37
38
39
40
41
42
# File 'lib/asciidoc-bib/extensions.rb', line 36

def html_to_asciidoc
  r = self.gsub(/<\/?i>/, '_')
  r = r.gsub(/<\/?b>/, '*')
  r = r.gsub(/<\/?span.*?>/, '')
  r = r.gsub(/\{|\}/, '')
  r
end

#is_i?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/asciidoc-bib/extensions.rb', line 47

def is_i?
  !!(self =~ /^[-+]?[0-9]+$/)
end