class Jekyll::Scholar::Smallcaps

Public Instance Methods

apply(value) click to toggle source
# File lib/jekyll/scholar/plugins/smallcaps.rb, line 4
def apply(value)
  # Use of \g<1> pattern back-reference to allow for capturing nested {} groups.
  # The first (outermost) capture of $1 is used.
  value.to_s.gsub(/\\textsc(\{(?:[^{}]|\g<1>)*\})/) {
    "<font style=\"font-variant: small-caps\">#{$1[1..-2]}</font>"
  }
end