markdown-ui 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Changelog +14 -0
- data/Gemfile +3 -0
- data/components/collections/markdown-ui-grid/lib/grid/column/column.rb +6 -9
- data/components/collections/markdown-ui-grid/lib/grid/grid.rb +6 -9
- data/components/collections/markdown-ui-grid/lib/grid/row/row.rb +6 -9
- data/components/collections/markdown-ui-grid/markdown-ui-grid.gemspec +1 -1
- data/components/collections/markdown-ui-menu/lib/menu/custom.rb +12 -12
- data/components/collections/markdown-ui-menu/lib/menu/element.rb +54 -52
- data/components/collections/markdown-ui-menu/lib/menu/pagination.rb +11 -10
- data/components/collections/markdown-ui-menu/lib/menu/pointing.rb +11 -10
- data/components/collections/markdown-ui-menu/lib/menu/secondary.rb +11 -10
- data/components/collections/markdown-ui-menu/lib/menu/standard.rb +11 -10
- data/components/collections/markdown-ui-menu/lib/menu/tabular.rb +11 -10
- data/components/collections/markdown-ui-menu/lib/menu/text.rb +11 -10
- data/components/collections/markdown-ui-menu/lib/menu/vertical.rb +11 -10
- data/components/collections/markdown-ui-message/lib/message/custom_message.rb +11 -11
- data/components/collections/markdown-ui-message/lib/message/list_message.rb +10 -9
- data/components/collections/markdown-ui-message/lib/message/message.rb +32 -29
- data/components/collections/markdown-ui-message/lib/message/standard_message.rb +10 -9
- data/components/collections/markdown-ui-message/lib/message/version.rb +1 -1
- data/components/collections/markdown-ui-message/markdown-ui-message.gemspec +2 -2
- data/components/elements/markdown-ui-button/lib/button/animated.rb +24 -22
- data/components/elements/markdown-ui-button/lib/button/basic.rb +14 -12
- data/components/elements/markdown-ui-button/lib/button/custom.rb +16 -14
- data/components/elements/markdown-ui-button/lib/button/element.rb +55 -53
- data/components/elements/markdown-ui-button/lib/button/focusable.rb +14 -12
- data/components/elements/markdown-ui-button/lib/button/group/buttons/custom.rb +14 -12
- data/components/elements/markdown-ui-button/lib/button/group/buttons/element.rb +22 -20
- data/components/elements/markdown-ui-button/lib/button/group/buttons/icon.rb +14 -12
- data/components/elements/markdown-ui-button/lib/button/group/buttons/standard.rb +14 -12
- data/components/elements/markdown-ui-button/lib/button/icon.rb +14 -12
- data/components/elements/markdown-ui-button/lib/button/labeled_icon.rb +19 -17
- data/components/elements/markdown-ui-button/lib/button/standard.rb +14 -12
- data/components/elements/markdown-ui-container/lib/container/alignment/center.rb +1 -1
- data/components/elements/markdown-ui-container/lib/container/alignment/left.rb +1 -1
- data/components/elements/markdown-ui-container/lib/container/alignment/right.rb +1 -1
- data/components/elements/markdown-ui-container/lib/container/custom.rb +1 -1
- data/components/elements/markdown-ui-container/lib/container/element.rb +5 -5
- data/components/elements/markdown-ui-container/lib/container/standard.rb +1 -1
- data/components/elements/markdown-ui-container/lib/container/text.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/basic_block.rb +19 -0
- data/components/elements/markdown-ui-content/lib/content/content_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/custom.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/divider_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/field_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/flag.rb +2 -2
- data/components/elements/markdown-ui-content/lib/content/form_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/header.rb +2 -2
- data/components/elements/markdown-ui-content/lib/content/header_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/icon.rb +2 -2
- data/components/elements/markdown-ui-content/lib/content/input_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/item.rb +4 -4
- data/components/elements/markdown-ui-content/lib/content/item_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/list.rb +6 -6
- data/components/elements/markdown-ui-content/lib/content/parser.rb +17 -17
- data/components/elements/markdown-ui-content/lib/content/span_block.rb +1 -1
- data/components/elements/markdown-ui-content/lib/content/text.rb +6 -6
- data/components/elements/markdown-ui-header/lib/header/header.rb +3 -3
- data/components/elements/markdown-ui-input/lib/input/custom.rb +4 -4
- data/components/elements/markdown-ui-input/lib/input/element.rb +10 -10
- data/components/elements/markdown-ui-label/lib/label/custom.rb +2 -2
- data/components/elements/markdown-ui-label/lib/label/element.rb +9 -16
- data/components/elements/markdown-ui-segment/lib/segment/custom_segment.rb +1 -1
- data/components/elements/markdown-ui-segment/lib/segment/horizontal_segment.rb +1 -1
- data/components/elements/markdown-ui-segment/lib/segment/padded_segment.rb +1 -1
- data/components/elements/markdown-ui-segment/lib/segment/piled_segment.rb +1 -1
- data/components/elements/markdown-ui-segment/lib/segment/segment.rb +6 -6
- data/components/elements/markdown-ui-segment/lib/segment/stacked_segment.rb +1 -1
- data/components/elements/markdown-ui-segment/lib/segment/standard_segment.rb +1 -1
- data/components/elements/markdown-ui-segment/lib/segment/vertical_segment.rb +1 -1
- data/components/shared/markdown-ui-shared/Gemfile +2 -0
- data/components/shared/markdown-ui-shared/lib/markdown-ui-shared.rb +3 -0
- data/components/shared/markdown-ui-shared/lib/shared/tag_klass.rb +77 -0
- data/components/shared/markdown-ui-shared/lib/shared/version.rb +5 -0
- data/components/shared/markdown-ui-shared/markdown-ui-shared.gemspec +37 -0
- data/lib/markdown-ui.rb +10 -132
- data/lib/markdown-ui/renderers/block_quote.rb +47 -0
- data/lib/markdown-ui/renderers/double_emphasis.rb +97 -0
- data/lib/markdown-ui/renderers/emphasis.rb +23 -0
- data/lib/markdown-ui/renderers/header.rb +9 -0
- data/lib/markdown-ui/renderers/horizontal_rule.rb +19 -0
- data/lib/markdown-ui/renderers/link.rb +10 -0
- data/lib/markdown-ui/renderers/list.rb +10 -0
- data/lib/markdown-ui/renderers/paragraph.rb +9 -0
- data/lib/markdown-ui/renderers/quote.rb +9 -0
- data/lib/markdown-ui/shared.rb +7 -0
- data/lib/markdown-ui/tag/article_tag.rb +14 -0
- data/lib/markdown-ui/tag/button_tag.rb +6 -19
- data/lib/markdown-ui/tag/custom_tag.rb +11 -10
- data/lib/markdown-ui/tag/focusable_button_tag.rb +6 -19
- data/lib/markdown-ui/tag/footer_tag.rb +14 -0
- data/lib/markdown-ui/tag/header_tag.rb +14 -0
- data/lib/markdown-ui/tag/input_tag.rb +7 -27
- data/lib/markdown-ui/tag/item_tag.rb +6 -14
- data/lib/markdown-ui/tag/label_tag.rb +6 -19
- data/lib/markdown-ui/tag/list_tag.rb +18 -21
- data/lib/markdown-ui/tag/section_tag.rb +14 -0
- data/lib/markdown-ui/tag/span_tag.rb +7 -7
- data/lib/markdown-ui/tag/standard_tag.rb +6 -19
- data/lib/markdown-ui/tag/tag.rb +18 -20
- data/lib/markdown-ui/tools/html_formatter.rb +11 -0
- data/lib/markdown-ui/utils/klass_util.rb +13 -3
- data/lib/markdown-ui/version.rb +1 -1
- data/website/docs/flag.html +1 -1
- data/website/docs/icon.html +609 -0
- data/website/docs/icon.md +691 -0
- data/website/docs/toc.html +4 -0
- data/website/docs/toc.md +5 -2
- data/website/index.html +2 -2
- metadata +25 -2
@@ -5,11 +5,11 @@ module MarkdownUI
|
|
5
5
|
class Header
|
6
6
|
def initialize(content, klass = nil)
|
7
7
|
@content = content
|
8
|
-
@klass
|
8
|
+
@klass = klass
|
9
9
|
end
|
10
10
|
|
11
11
|
def render
|
12
|
-
klass
|
12
|
+
klass = "ui #{@klass} header"
|
13
13
|
content = @content.strip
|
14
14
|
|
15
15
|
MarkdownUI::StandardTag.new(content, klass).render
|
@@ -5,12 +5,12 @@ module MarkdownUI
|
|
5
5
|
class Icon
|
6
6
|
def initialize(content, klass = nil)
|
7
7
|
@content = content
|
8
|
-
@klass
|
8
|
+
@klass = klass
|
9
9
|
end
|
10
10
|
|
11
11
|
def render
|
12
12
|
content = @content.downcase
|
13
|
-
klass
|
13
|
+
klass = MarkdownUI::KlassUtil.new("#{@content} #{@klass} icon").klass
|
14
14
|
|
15
15
|
output = []
|
16
16
|
output << '<i'
|
@@ -5,14 +5,14 @@ module MarkdownUI
|
|
5
5
|
class Item
|
6
6
|
def initialize(content, klass = nil, link = nil)
|
7
7
|
@content = content
|
8
|
-
@klass
|
9
|
-
@link
|
8
|
+
@klass = klass
|
9
|
+
@link = link
|
10
10
|
end
|
11
11
|
|
12
12
|
def render
|
13
|
-
klass
|
13
|
+
klass = "ui #{@klass} item"
|
14
14
|
content = @content.strip
|
15
|
-
link
|
15
|
+
link = @link
|
16
16
|
|
17
17
|
MarkdownUI::ItemTag.new(content, klass, link).render
|
18
18
|
end
|
@@ -5,16 +5,16 @@ module MarkdownUI
|
|
5
5
|
class List
|
6
6
|
def initialize(content, klass = nil, type = nil, data = nil)
|
7
7
|
@content = content
|
8
|
-
@klass
|
9
|
-
@type
|
10
|
-
@data
|
8
|
+
@klass = klass
|
9
|
+
@type = type
|
10
|
+
@data = data
|
11
11
|
end
|
12
12
|
|
13
13
|
def render
|
14
|
-
klass
|
14
|
+
klass = "ui #{@klass} list"
|
15
15
|
content = @content.strip
|
16
|
-
type
|
17
|
-
data
|
16
|
+
type = @type
|
17
|
+
data = @data
|
18
18
|
|
19
19
|
MarkdownUI::ListTag.new(content, klass, type, data).render
|
20
20
|
end
|
@@ -20,14 +20,14 @@ module MarkdownUI
|
|
20
20
|
final_content.join
|
21
21
|
else
|
22
22
|
content = if !(@content =~ /\:/).nil?
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
@content.split(':')
|
24
|
+
else
|
25
|
+
if @content
|
26
|
+
@content.split('\n')
|
27
|
+
else
|
28
|
+
['']
|
29
|
+
end
|
30
|
+
end
|
31
31
|
|
32
32
|
process(content)
|
33
33
|
end
|
@@ -35,18 +35,18 @@ module MarkdownUI
|
|
35
35
|
|
36
36
|
def process(content)
|
37
37
|
content_type, actual_content = content[0], content[1]
|
38
|
-
klass
|
38
|
+
klass = content[2] if content.size > 2
|
39
39
|
|
40
40
|
if actual_content
|
41
41
|
mode = OpenStruct.new(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
:text? => !(content_type =~ /text/i).nil?,
|
43
|
+
:icon? => !(content_type =~ /icon/i).nil?,
|
44
|
+
:flag? => !(content_type =~ /flag/i).nil?,
|
45
|
+
:image? => !(content_type =~ /image/i).nil?,
|
46
|
+
:header? => !(content_type =~ /header/i).nil?,
|
47
|
+
:list? => !(content_type =~ /list/i).nil?,
|
48
|
+
:unordered? => !(content_type =~ /unordered/i).nil?,
|
49
|
+
:ordered? => !(content_type =~ /ordered/i).nil?
|
50
50
|
)
|
51
51
|
|
52
52
|
if mode.text?
|
@@ -5,17 +5,17 @@ module MarkdownUI
|
|
5
5
|
class Text
|
6
6
|
def initialize(content, klass = nil)
|
7
7
|
@content = content
|
8
|
-
@klass
|
8
|
+
@klass = klass
|
9
9
|
end
|
10
10
|
|
11
11
|
def render
|
12
12
|
content = if @klass
|
13
|
-
|
13
|
+
klass = "#{@klass}"
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
MarkdownUI::StandardTag.new(@content, klass).render
|
16
|
+
else
|
17
|
+
"#{@content.strip}"
|
18
|
+
end
|
19
19
|
|
20
20
|
content
|
21
21
|
end
|
@@ -2,13 +2,13 @@ module MarkdownUI
|
|
2
2
|
class Header
|
3
3
|
def initialize(text, level)
|
4
4
|
@text, @klass, @_id = text.split(':')
|
5
|
-
@level
|
5
|
+
@level = level
|
6
6
|
end
|
7
7
|
|
8
8
|
def render
|
9
|
-
text
|
9
|
+
text = @text.strip
|
10
10
|
klass = MarkdownUI::KlassUtil.new("ui #{@klass} header").klass
|
11
|
-
_id
|
11
|
+
_id = " id=\'#{@_id}\'" if @_id
|
12
12
|
level = @level
|
13
13
|
|
14
14
|
output = []
|
@@ -4,16 +4,16 @@ module MarkdownUI::Input
|
|
4
4
|
class Custom
|
5
5
|
def initialize(element, content, klass = nil, _id = nil)
|
6
6
|
@element = element
|
7
|
-
@klass
|
7
|
+
@klass = klass
|
8
8
|
@content = content
|
9
|
-
@id
|
9
|
+
@id = _id
|
10
10
|
end
|
11
11
|
|
12
12
|
def render
|
13
13
|
element = @element.join(' ').strip
|
14
14
|
# content = MarkdownUI::Content::Parser.new(@content).parse
|
15
|
-
klass
|
16
|
-
_id
|
15
|
+
klass = "ui #{element} #{@klass} input"
|
16
|
+
_id = @id
|
17
17
|
|
18
18
|
MarkdownUI::InputTag.new(@content, klass, _id).render
|
19
19
|
end
|
@@ -3,24 +3,24 @@ module MarkdownUI::Input
|
|
3
3
|
def initialize(element, content, klass = nil, _id = nil)
|
4
4
|
@element = element
|
5
5
|
@content = content
|
6
|
-
@klass
|
7
|
-
@id
|
6
|
+
@klass = klass
|
7
|
+
@id = _id
|
8
8
|
end
|
9
9
|
|
10
10
|
def render
|
11
11
|
element = if @element.is_a? Array
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
@element
|
13
|
+
else
|
14
|
+
@element.split(' ')
|
15
|
+
end
|
16
16
|
|
17
17
|
content = @content
|
18
18
|
|
19
19
|
klass = if @klass.nil?
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
element.join(' ').strip
|
21
|
+
else
|
22
|
+
@klass
|
23
|
+
end
|
24
24
|
|
25
25
|
_id = @id
|
26
26
|
|
@@ -4,14 +4,14 @@ module MarkdownUI::Label
|
|
4
4
|
class Custom
|
5
5
|
def initialize(element, content, klass = nil)
|
6
6
|
@element = element
|
7
|
-
@klass
|
7
|
+
@klass = klass
|
8
8
|
@content = content
|
9
9
|
end
|
10
10
|
|
11
11
|
def render
|
12
12
|
element = @element.join(' ').strip
|
13
13
|
content = MarkdownUI::Content::Parser.new(@content).parse
|
14
|
-
klass
|
14
|
+
klass = "ui #{element} #{@klass} label"
|
15
15
|
|
16
16
|
MarkdownUI::StandardTag.new(content, klass).render
|
17
17
|
end
|
@@ -3,32 +3,25 @@ module MarkdownUI::Label
|
|
3
3
|
def initialize(element, content, klass = nil)
|
4
4
|
@element = element
|
5
5
|
@content = content
|
6
|
-
@klass
|
6
|
+
@klass = klass
|
7
7
|
end
|
8
8
|
|
9
9
|
def render
|
10
10
|
element = if @element.is_a? Array
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
@element
|
12
|
+
else
|
13
|
+
@element.split(' ')
|
14
|
+
end
|
15
15
|
|
16
16
|
content = @content
|
17
17
|
|
18
18
|
klass = if @klass.nil?
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
element.join(' ').strip
|
20
|
+
else
|
21
|
+
@klass
|
22
|
+
end
|
23
23
|
|
24
24
|
MarkdownUI::Label::Custom.new(element, content, klass).render
|
25
25
|
end
|
26
|
-
|
27
|
-
protected
|
28
|
-
|
29
|
-
def standard_label?(mode)
|
30
|
-
!mode.image? && !mode.secondary? && !mode.pagination? && !mode.pointing? && !mode.tabular? && !mode.text? && !mode.vertical?
|
31
|
-
end
|
32
|
-
|
33
26
|
end
|
34
27
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module MarkdownUI
|
2
2
|
class Segment
|
3
3
|
def initialize(element, content)
|
4
|
-
@mode
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
@mode = OpenStruct.new(
|
5
|
+
:horizontal? => !(element =~ /horizontal/i).nil?,
|
6
|
+
:vertical? => !(element =~ /vertical/i).nil?,
|
7
|
+
:stacked? => !(element =~ /stacked/i).nil?,
|
8
|
+
:piled? => !(element =~ /piled/i).nil?,
|
9
|
+
:padded? => !(element =~ /padded/i).nil?
|
10
10
|
)
|
11
11
|
@element = element
|
12
12
|
@content = content
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module MarkdownUI
|
2
|
+
module Shared
|
3
|
+
class TagKlass
|
4
|
+
def content
|
5
|
+
if @content
|
6
|
+
_content = MarkdownUI::Content::Parser.new(@content).parse
|
7
|
+
_content.strip
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def element
|
12
|
+
if @element
|
13
|
+
(@element.is_a? Array) ? @element.join(' ').strip : @element.strip
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def html
|
18
|
+
if block_given?
|
19
|
+
HTMLFormatter.new(yield).to_html
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def klass
|
24
|
+
MarkdownUI::KlassUtil.new(@klass).klass unless @klass.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
def klass_text
|
28
|
+
MarkdownUI::KlassUtil.new(@klass).text unless @klass.nil?
|
29
|
+
end
|
30
|
+
|
31
|
+
def _id
|
32
|
+
if @id
|
33
|
+
" id=\'#{@id.split.join('-')}\'"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def data
|
38
|
+
if @data
|
39
|
+
if @data =~ /\:/
|
40
|
+
_data, attribute, value = @data.split(':')
|
41
|
+
" data-#{attribute}=\'#{value}\'"
|
42
|
+
else
|
43
|
+
@data
|
44
|
+
end
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def _input_id
|
51
|
+
if @id
|
52
|
+
" placeholder=\'#{@id.capitalize}\'"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def input_content
|
57
|
+
if @content
|
58
|
+
" type=\'#{@content.strip.downcase}\'"
|
59
|
+
else
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def regexp
|
65
|
+
Regexp.new (@params.collect { |u| u.downcase }).join('|'), "i"
|
66
|
+
end
|
67
|
+
|
68
|
+
def key
|
69
|
+
keys.grep(regexp).first
|
70
|
+
end
|
71
|
+
|
72
|
+
def keys
|
73
|
+
@elements.keys
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|