Module: Repubmark
- Defined in:
- lib/repubmark.rb,
lib/repubmark/config.rb,
lib/repubmark/version.rb,
lib/repubmark/highlight.rb,
lib/repubmark/elems/base.rb,
lib/repubmark/elems/link.rb,
lib/repubmark/elems/list.rb,
lib/repubmark/elems/note.rb,
lib/repubmark/elems/text.rb,
lib/repubmark/titled_ref.rb,
lib/repubmark/elems/joint.rb,
lib/repubmark/elems/power.rb,
lib/repubmark/elems/quote.rb,
lib/repubmark/elems/abbrev.rb,
lib/repubmark/elems/canvas.rb,
lib/repubmark/elems/figure.rb,
lib/repubmark/elems/iframe.rb,
lib/repubmark/elems/article.rb,
lib/repubmark/elems/caption.rb,
lib/repubmark/elems/chapter.rb,
lib/repubmark/elems/figures.rb,
lib/repubmark/elems/section.rb,
lib/repubmark/elems/special.rb,
lib/repubmark/elems/footnote.rb,
lib/repubmark/elems/fraction.rb,
lib/repubmark/elems/list_item.rb,
lib/repubmark/elems/paragraph.rb,
lib/repubmark/elems/separator.rb,
lib/repubmark/elems/annotation.rb,
lib/repubmark/elems/blockquote.rb,
lib/repubmark/elems/code_block.rb,
lib/repubmark/elems/code_inline.rb,
lib/repubmark/elems/footnotes_category.rb
Overview
A Markdown-inspired markup language that can be compiled into HTML and Gemtext.
Defined Under Namespace
Modules: Elems Classes: Config, Highlight, TitledRef
Constant Summary collapse
- FORMATS =
%i[chapters gemtext html summary_plain word_count].freeze
- SLUG_RE =
/\A[[:word:]]+(-[[:word:]]+)*\z/
- UNICODE_SUPS =
{ '0' => '⁰', '1' => '¹', '2' => '²', '3' => '³', '4' => '⁴', '5' => '⁵', '6' => '⁶', '7' => '⁷', '8' => '⁸', '9' => '⁹', '+' => '⁺', '-' => '⁻', '=' => '⁼', '(' => '⁽', ')' => '⁾', }.freeze
- UNICODE_SUBS =
{ '0' => '₀', '1' => '₁', '2' => '₂', '3' => '₃', '4' => '₄', '5' => '₅', '6' => '₆', '7' => '₇', '8' => '₈', '9' => '₉', '+' => '₊', '-' => '₋', '=' => '₌', '(' => '₍', ')' => '₎', }.freeze
- VERSION =
Gem version.
'0.0.0'
Class Method Summary collapse
Class Method Details
.unicode_sub(val) ⇒ Object
122 123 124 |
# File 'lib/repubmark.rb', line 122 def self.unicode_sub(val) String(val).each_char.map { |chr| UNICODE_SUBS.fetch chr }.join.freeze end |
.unicode_sup(val) ⇒ Object
118 119 120 |
# File 'lib/repubmark.rb', line 118 def self.unicode_sup(val) String(val).each_char.map { |chr| UNICODE_SUPS.fetch chr }.join.freeze end |
.validate_slug!(slug) ⇒ Object
111 112 113 114 115 116 |
# File 'lib/repubmark.rb', line 111 def self.validate_slug!(slug) slug = String(slug).freeze raise 'Invalid slug' unless SLUG_RE.match? slug slug end |