Class: Beardown::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/beardown/compat/document.rb,
lib/beardown/compat/list_todo.rb,
lib/beardown/compat/list_unordered.rb,
lib/beardown/compat/bold_italic_underline_strike.rb

Constant Summary collapse

REGEXP_LIST_TODO =
/^(\t*) *\- \[([ x])\]\s+(.+)\n?/
REGEXP_LIST_UNORDERED =
/^(\t*) *[\-\*]\s+(.+)(\n)?/
START_CHAR_BOLD =
"*"
START_CHAR_UNDERLINE =

START_CHAR_ITALIC = “*”

"~"
REGEXP_BOLD =

START_CHAR_STRIKE = “~”

/\*\*([^\s].*?[^\s])\*\*/
REGEXP_ITALIC =
/\*([^\s].*?[^\s])\*/
REGEXP_STRIKE =
/\~\~([^\s].*?[^\s])\~\~/
REGEXP_UNDERLINE =
/\~([^\s].*?[^\s])\~/

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Document

Returns a new instance of Document.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/beardown/compat/document.rb', line 3

def initialize(text)
  @text = text

  @blocks = [:head, :line_separator, :list_todo,
             :list_unordered, :list_ordered, :quote, :codeblock,
             :asset, :blankline, :p]
  @spans  = [:codespan, :hashtag_full, :hashtag_full_nospace, :hashtag, :linkpost, :linkurl,
             :bold, :italic, :strike, :underline, :mark_nospace, :mark]

  @extensions = Array.new
  @title = String.new
  @tags = Array.new

  html
end

Instance Method Details

#scan_list_todo(s) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/beardown/compat/list_todo.rb', line 5

def scan_list_todo(s)
  t_count = s[1].length
  check_status = case s[2]
                 when " " then "uncheck"
                 when "x" then "checked"
                 end
  content = s[3]

  #fail "fuck"+REGEXP_LIST_TODO.to_s

  ex_svg = :add_extension_todo_svg
  @extensions << ex_svg unless @extensions.include? ex_svg

  convert_list_todo(t_count, check_status, content)
end