Module: Typeset::HangingPunctuation

Defined in:
lib/typeset/hanging_punctuation.rb

Overview

Contains constants and methods specific to our hanging punctuation implementation

Constant Summary collapse

DoubleWidth =

Characters that need a double-width pull

['"', '"', "", "", "", "“", "“", "“", "“", "”", "”", '”', '”', '„', '„', '„']
SingleWidth =

Characters that need a single-width pull

["'", '′', ''', '‘', '’', '', '']

Class Method Summary collapse

Class Method Details

.pull(classname, content = '') ⇒ Object

Wrap a piece of content in a pull class



10
11
12
# File 'lib/typeset/hanging_punctuation.rb', line 10

def self.pull(classname, content='')
  HangingPunctuation.wrap("pull", classname, content)
end

.push(classname, content = '') ⇒ Object

Wrap a piece of content in a push class



15
16
17
# File 'lib/typeset/hanging_punctuation.rb', line 15

def self.push(classname, content='')
  HangingPunctuation.wrap("push", classname, content)
end

.wrap(type, classname, content = '') ⇒ Object

Wrap a piece of content in an arbitrary class. Convenience method for implementing #push and #pull



21
22
23
# File 'lib/typeset/hanging_punctuation.rb', line 21

def self.wrap(type, classname, content='')
  "<span class=\"#{type}-#{classname}\">#{content}</span>"
end