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
@@ -1,17 +1,18 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
-
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module MarkdownUI
|
4
|
+
module Menu
|
5
|
+
class Vertical < MarkdownUI::Shared::TagKlass
|
6
|
+
def initialize(_content, _klass = nil)
|
7
|
+
@_klass = _klass
|
8
|
+
@content = _content
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
content = MarkdownUI::Content::Parser.new(@content).parse
|
11
|
+
def render
|
12
|
+
@klass = "ui #{@_klass} vertical menu"
|
13
13
|
|
14
|
-
|
14
|
+
MarkdownUI::StandardTag.new(content, klass_text).render
|
15
|
+
end
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
3
|
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module Message
|
5
|
+
class CustomMessage < MarkdownUI::Shared::TagKlass
|
6
|
+
def initialize(_element, _content, _klass = nil)
|
7
|
+
@element = _element
|
8
|
+
@_klass = _klass
|
9
|
+
@content = _content
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
content = MarkdownUI::Content::Parser.new(@content).parse
|
14
|
-
klass = "ui #{element} #{@klass} message"
|
12
|
+
def render
|
13
|
+
@klass = "ui #{element} #{@_klass} message"
|
15
14
|
|
16
|
-
|
15
|
+
MarkdownUI::StandardTag.new(content, klass_text).render
|
16
|
+
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
3
|
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
module Message
|
5
|
+
class ListMessage < MarkdownUI::Shared::TagKlass
|
6
|
+
def initialize(_content, _klass = nil)
|
7
|
+
@_klass = _klass
|
8
|
+
@content = _content
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
content = MarkdownUI::Content::Parser.new(@content).parse
|
11
|
+
def render
|
12
|
+
@klass = "ui #{@_klass} message"
|
13
13
|
|
14
|
-
|
14
|
+
MarkdownUI::StandardTag.new(content, klass_text).render
|
15
|
+
end
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -1,40 +1,43 @@
|
|
1
1
|
module MarkdownUI
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def render
|
10
|
-
element = if @element.is_a? Array
|
11
|
-
@element
|
12
|
-
else
|
13
|
-
@element.split(' ')
|
2
|
+
module Message
|
3
|
+
class Element
|
4
|
+
def initialize(element, content, klass = nil)
|
5
|
+
@element = element
|
6
|
+
@content = content
|
7
|
+
@klass = klass
|
14
8
|
end
|
15
9
|
|
16
|
-
|
17
|
-
|
10
|
+
def render
|
11
|
+
element = if @element.is_a? Array
|
12
|
+
@element
|
13
|
+
else
|
14
|
+
@element.split(' ')
|
15
|
+
end
|
16
|
+
|
17
|
+
content = @content
|
18
|
+
klass = @klass
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
mode = OpenStruct.new(
|
21
|
+
:list? => element.grep(/list/i).any?,
|
22
|
+
:icon? => element.grep(/icon/i).any?,
|
23
|
+
:dismissable? => element.grep(/dismissable/i).any?
|
24
|
+
)
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
if standard_message?(mode) && element.size > 1
|
27
|
+
MarkdownUI::Message::CustomMessage.new(element, content, klass).render
|
28
|
+
elsif mode.list?
|
29
|
+
MarkdownUI::Message::ListMessage.new(content, klass).render
|
30
|
+
else
|
31
|
+
standard_message?(mode)
|
32
|
+
MarkdownUI::Message::StandardMessage.new(content, klass).render
|
33
|
+
end
|
31
34
|
end
|
32
|
-
end
|
33
35
|
|
34
|
-
|
36
|
+
protected
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
+
def standard_message?(mode)
|
39
|
+
!mode.list? && !mode.icon? && !mode.dismissable?
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
3
|
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
module Message
|
5
|
+
class StandardMessage < MarkdownUI::Shared::TagKlass
|
6
|
+
def initialize(_content, _klass = nil)
|
7
|
+
@klass = _klass
|
8
|
+
@content = _content
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
content = MarkdownUI::Content::Parser.new(@content).parse
|
11
|
+
def render
|
12
|
+
@klass = "ui #{@_klass} message"
|
13
13
|
|
14
|
-
|
14
|
+
MarkdownUI::StandardTag.new(content, klass_text).render
|
15
|
+
end
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -5,7 +5,7 @@ require 'message/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'markdown-ui-message'
|
8
|
-
spec.version = MarkdownUI::
|
8
|
+
spec.version = MarkdownUI::Message::VERSION
|
9
9
|
spec.authors = ['Joel Bryan Juliano']
|
10
10
|
spec.email = ['joelbryan.juliano@gmail.com']
|
11
11
|
|
@@ -34,4 +34,4 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'test-unit', '~> 3.0'
|
35
35
|
spec.add_development_dependency 'simplecov', '~> 0.10'
|
36
36
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
|
37
|
-
end
|
37
|
+
end
|
@@ -1,30 +1,32 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
-
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
module MarkdownUI
|
4
|
+
module Button
|
5
|
+
class Animated
|
6
|
+
def initialize(content, klass = nil, _id = nil)
|
7
|
+
@content = content
|
8
|
+
@klass = klass
|
9
|
+
@id = _id
|
10
|
+
@visible_content, @hidden_content = content.is_a?(Array) ? content : content.split(';')
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def render
|
14
|
+
klass = "ui #{@klass} animated button"
|
15
|
+
_id = @id
|
16
|
+
visible_content = MarkdownUI::Content::Parser.new(@visible_content).parse
|
17
|
+
hidden_content = MarkdownUI::Content::Parser.new(@hidden_content).parse
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
content = []
|
20
|
+
if @content.is_a? Array
|
21
|
+
content << visible_content
|
22
|
+
content << hidden_content
|
23
|
+
else
|
24
|
+
content << MarkdownUI::StandardTag.new(visible_content, 'visible content').render
|
25
|
+
content << MarkdownUI::StandardTag.new(hidden_content, 'hidden content').render
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
+
MarkdownUI::StandardTag.new(content.join, klass, _id).render
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
@@ -1,19 +1,21 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
-
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module MarkdownUI
|
4
|
+
module Button
|
5
|
+
class Basic
|
6
|
+
def initialize(content, klass = nil, _id = nil)
|
7
|
+
@klass = klass
|
8
|
+
@content = content
|
9
|
+
@id = _id
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
def render
|
13
|
+
content = MarkdownUI::Content::Parser.new(@content).parse
|
14
|
+
klass = "ui #{@klass} basic button"
|
15
|
+
_id = @id
|
15
16
|
|
16
|
-
|
17
|
+
MarkdownUI::ButtonTag.new(content, klass, _id).render
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,21 +1,23 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
-
module MarkdownUI
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
module MarkdownUI
|
4
|
+
module Button
|
5
|
+
class Custom
|
6
|
+
def initialize(element, content, klass = nil, _id = nil)
|
7
|
+
@element = element
|
8
|
+
@klass = klass
|
9
|
+
@content = content
|
10
|
+
@id = _id
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def render
|
14
|
+
element = @element.join(' ').strip
|
15
|
+
content = MarkdownUI::Content::Parser.new(@content).parse
|
16
|
+
klass = "ui #{element} #{@klass} button"
|
17
|
+
_id = @id
|
17
18
|
|
18
|
-
|
19
|
+
MarkdownUI::ButtonTag.new(content, klass, _id).render
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -1,66 +1,68 @@
|
|
1
|
-
module MarkdownUI
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def render
|
11
|
-
element = if @element.is_a? Array
|
12
|
-
@element
|
13
|
-
else
|
14
|
-
@element.split(' ')
|
1
|
+
module MarkdownUI
|
2
|
+
module Button
|
3
|
+
class Element
|
4
|
+
def initialize(element, content, klass = nil, _id = nil)
|
5
|
+
@element = element
|
6
|
+
@content = content
|
7
|
+
@klass = klass
|
8
|
+
@id = _id
|
15
9
|
end
|
16
10
|
|
17
|
-
|
11
|
+
def render
|
12
|
+
element = if @element.is_a? Array
|
13
|
+
@element
|
14
|
+
else
|
15
|
+
@element.split(' ')
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
content = @content
|
19
|
+
|
20
|
+
klass = if @klass.nil?
|
21
|
+
element.join(' ').strip
|
22
|
+
else
|
23
|
+
@klass
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
+
_id = @id
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
mode = OpenStruct.new(
|
29
|
+
:icon? => element.grep(/icon/i).any?,
|
30
|
+
:flag? => element.grep(/flag/i).any?,
|
31
|
+
:image? => element.grep(/image/i).any?,
|
32
|
+
:focusable? => element.grep(/focusable/i).any?,
|
33
|
+
:animated? => element.grep(/animated/i).any?,
|
34
|
+
:labeled? => element.grep(/labeled/i).any?,
|
35
|
+
:basic? => element.grep(/basic/i).any?
|
36
|
+
)
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
38
|
+
if content
|
39
|
+
if standard_button?(mode) && element.size > 1
|
40
|
+
MarkdownUI::Button::Custom.new(element, content, klass, _id).render
|
41
|
+
elsif mode.icon? && mode.labeled?
|
42
|
+
icon, label = content
|
43
|
+
MarkdownUI::Button::LabeledIcon.new(icon, label, klass, _id).render
|
44
|
+
elsif mode.icon? && !mode.labeled?
|
45
|
+
MarkdownUI::Button::Icon.new(content, klass, _id).render
|
46
|
+
elsif mode.focusable?
|
47
|
+
MarkdownUI::Button::Focusable.new(content, klass, _id).render
|
48
|
+
elsif mode.basic?
|
49
|
+
MarkdownUI::Button::Basic.new(content, klass, _id).render
|
50
|
+
elsif mode.animated?
|
51
|
+
MarkdownUI::Button::Animated.new(content, klass, _id).render
|
52
|
+
elsif standard_button?(mode)
|
53
|
+
MarkdownUI::Button::Standard.new(content, klass, _id).render
|
54
|
+
end
|
55
|
+
else
|
56
|
+
MarkdownUI::Button::Custom.new(element, '', klass, _id).render
|
53
57
|
end
|
54
|
-
else
|
55
|
-
MarkdownUI::Button::Custom.new(element, '', klass, _id).render
|
56
58
|
end
|
57
|
-
end
|
58
59
|
|
59
|
-
|
60
|
+
protected
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
def standard_button?(mode)
|
63
|
+
!mode.focusable? && !mode.animated? && !mode.icon? && !mode.labeled? && !mode.basic?
|
64
|
+
end
|
64
65
|
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|