Sha256: e09d03fe3840b8f6a198caa409ea7b1a0bfc16c7db5b2d9f55e2f0ed8695b945

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

# coding: utf-8

module Goethe
  class Regex
    REGEXEN = {}

    HTML_TAGS = %w[a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup command data datagrid datalist dd del details dfn div dl font dt em embed eventsource fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link mark map menu meta meter nav noscript object ol optgroup option output p param pre progress q ruby rp rt s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr center]
    ADDITIONAL_HTML_TAG = %w[  ©]

    REGEXEN[:HTML_TAGS] = /<\/?(#{HTML_TAGS.join('|')}).*?\/?>/im
    REGEXEN[:ADDITIONAL_HTML_TAG] = /(#{ADDITIONAL_HTML_TAG.join('|')};?)/m
    REGEXEN[:MARKDOWN] = { :HEADERS => /(^\s*#+\s*)|(^[-=]+$)/m,
                           :EMPHASIS => /^(\*+|_+)(.*)(\1)$/,
                           :BLOCKQUOTES => /^\s*>\s*/m,
                           :LISTS => /^\s{0,3}(-|\*|\+|\d\.)\s+/,
                           :HRULERS => /^(\*\s{0,3}\*\s{0,3}\*|-\s{0,3}-\s{0,3}-|_\s{0,3}_\s{0,3}_)[\s\*]*$/,
                           :IMAGES => /!\[.*?\]\(.*?\)/m,
                           :LINKS => /\[(.*?)\]\(.*?\)/m,
                           :QUICK_LINKS => /<(.*)>/m,
                           :COPYRIGHT => /&copy;/i
                         }

    def self.[](key)
      REGEXEN[key]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
goethe-0.6.0 lib/goethe/regex.rb