firm 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/LICENSE +21 -0
- data/README.md +209 -0
- data/lib/firm/serializable.rb +733 -0
- data/lib/firm/serialize/core.rb +43 -0
- data/lib/firm/serialize/id.rb +104 -0
- data/lib/firm/serializer/json.rb +394 -0
- data/lib/firm/serializer/xml.rb +544 -0
- data/lib/firm/serializer/yaml.rb +118 -0
- data/lib/firm/version.rb +9 -0
- data/lib/firm.rb +5 -0
- data/rakelib/yard/templates/default/fulldoc/html/css/firm.css +97 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +25 -0
- data/rakelib/yard/templates/default/layout/html/setup.rb +5 -0
- data/rakelib/yard/yard/relative_markdown_links/version.rb +8 -0
- data/rakelib/yard/yard/relative_markdown_links.rb +39 -0
- data/rakelib/yard/yard-custom-templates.rb +2 -0
- data/rakelib/yard/yard-relative_markdown_links.rb +4 -0
- data/tests/serializer_tests.rb +945 -0
- data/tests/test_serialize.rb +8 -0
- data/tests/test_serialize_xml.rb +22 -0
- data/tests/test_serialize_yaml.rb +18 -0
- metadata +110 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
|
2
|
+
div.wxrb-note {
|
3
|
+
background: #f7f7f9;
|
4
|
+
border-left: .6em solid #f3ba6f;
|
5
|
+
border-radius: 3px;
|
6
|
+
margin: 14px;
|
7
|
+
padding-left: 14px;
|
8
|
+
padding-top: 10px;
|
9
|
+
padding-bottom: 10px;
|
10
|
+
}
|
11
|
+
|
12
|
+
div.wxrb-remark {
|
13
|
+
background: #f7f7f9;
|
14
|
+
border-left: .6em solid #f6f4ab;
|
15
|
+
border-radius: 3px;
|
16
|
+
margin: 14px;
|
17
|
+
padding-left: 14px;
|
18
|
+
padding-top: 10px;
|
19
|
+
padding-bottom: 10px;
|
20
|
+
}
|
21
|
+
|
22
|
+
div.wxrb-note p,
|
23
|
+
div.wxrb-remark p {
|
24
|
+
margin: 0;
|
25
|
+
}
|
26
|
+
|
27
|
+
div.wxrb-logo {
|
28
|
+
float: right;
|
29
|
+
padding-top: 12px;
|
30
|
+
}
|
31
|
+
|
32
|
+
div.wxrb-logo img {
|
33
|
+
vertical-align: middle;
|
34
|
+
}
|
35
|
+
|
36
|
+
div.wxrb-logo span.wxrb-name {
|
37
|
+
font-size: large;
|
38
|
+
font-weight: bold;
|
39
|
+
margin-left: 10px;
|
40
|
+
}
|
41
|
+
|
42
|
+
div.wxrb-logo span.wxrb-name a {
|
43
|
+
color: black;
|
44
|
+
}
|
45
|
+
|
46
|
+
div.wxrb-logo span.wxrb-version {
|
47
|
+
font-size: medium;
|
48
|
+
font-weight: normal;
|
49
|
+
margin-right: 15px;
|
50
|
+
}
|
51
|
+
|
52
|
+
div.wxrb-logo span.wxrb-wxver {
|
53
|
+
font-size: 0.9em;
|
54
|
+
font-weight: normal;
|
55
|
+
margin-right: 15px;
|
56
|
+
}
|
57
|
+
|
58
|
+
div.wxrb-logo table {
|
59
|
+
display: inline;
|
60
|
+
}
|
61
|
+
|
62
|
+
div.wxrb-logo table td {
|
63
|
+
margin: 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
.discussion div.note {
|
67
|
+
background: #f7f7f9;
|
68
|
+
border-left: .6em solid #f3ba6f;
|
69
|
+
margin: 14px;
|
70
|
+
}
|
71
|
+
|
72
|
+
.tags span.wxrb-require {
|
73
|
+
border-radius: 5px;
|
74
|
+
border: 1px solid #E1E1E8;
|
75
|
+
padding: 0px 3px 0px 3px;
|
76
|
+
background: #f3ba6f;
|
77
|
+
font-weight: bold;
|
78
|
+
font-size: 0.9em;
|
79
|
+
}
|
80
|
+
|
81
|
+
#filecontents {
|
82
|
+
margin-right: 340px;
|
83
|
+
}
|
84
|
+
|
85
|
+
#filecontents blockquote {
|
86
|
+
border-left: .5em solid #e0e0e0;
|
87
|
+
margin: 10px;
|
88
|
+
padding-left: 10px;
|
89
|
+
}
|
90
|
+
|
91
|
+
#toc {
|
92
|
+
position: fixed;
|
93
|
+
overflow-y: scroll;
|
94
|
+
overflow-x: hidden;
|
95
|
+
top: 1em;
|
96
|
+
bottom: 0;
|
97
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def init
|
4
|
+
# It seems YARD messes things up so that a lot of classes, modules and constants are not properly
|
5
|
+
# registered in their enclosing namespaces.
|
6
|
+
# This hack makes sure that if that is the case we fix that here.
|
7
|
+
all_objects = Registry.all(:class, :constant, :module, :method)
|
8
|
+
all_objects.each do |c|
|
9
|
+
if (ns = c.namespace)
|
10
|
+
unless ns.children.any? { |nsc| nsc.path == c.path }
|
11
|
+
ns.children << c # class/module/constant/method missing from child list of enclosing namespace -> add here
|
12
|
+
end
|
13
|
+
end
|
14
|
+
if (ns = Registry[c.namespace.path])
|
15
|
+
unless ns.children.any? { |nsc| nsc.path == c.path }
|
16
|
+
ns.children << c # class/module/constant/method missing from child list of enclosing namespace -> add here
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def stylesheets_full_list
|
24
|
+
super + %w(css/firm.css)
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "nokogiri"
|
4
|
+
require "uri"
|
5
|
+
require "yard"
|
6
|
+
require_relative 'relative_markdown_links/version'
|
7
|
+
|
8
|
+
module YARD # rubocop:disable Style/Documentation
|
9
|
+
# GitHub and YARD render Markdown files differently. In particular, relative
|
10
|
+
# links between Markdown files that work in GitHub don't work in YARD.
|
11
|
+
# For example, if you have `[hello](FOO.md)` in your README, YARD renders it
|
12
|
+
# as `<a href="FOO.md">hello</a>`, creating a broken link in your docs.
|
13
|
+
#
|
14
|
+
# With this plugin enabled, you'll get `<a href="file.FOO.html">hello</a>`
|
15
|
+
# instead, which correctly links through to the rendered HTML file.
|
16
|
+
module RelativeMarkdownLinks
|
17
|
+
# Resolves relative links from Markdown files.
|
18
|
+
# @param [String] text the HTML fragment in which to resolve links.
|
19
|
+
# @return [String] HTML with relative links to extra files converted to `{file:}` links.
|
20
|
+
def resolve_links(text)
|
21
|
+
html = Nokogiri::HTML.fragment(text)
|
22
|
+
html.css("a[href]").each do |link|
|
23
|
+
href = URI(link["href"])
|
24
|
+
|
25
|
+
if href.relative? && options.files
|
26
|
+
fnames = options.files.map(&:filename)
|
27
|
+
if fnames.include?(href.path)
|
28
|
+
link.replace "{file:#{href} #{link.inner_html}}"
|
29
|
+
elsif href.path.end_with?('_md.html') && (fname = fnames.find {|fnm| fnm.end_with?(href.path.sub(/_md.html\Z/, '.md')) })
|
30
|
+
link.replace "{file:#{fname} #{link.inner_html}}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
super(html.to_s)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Templates::Template.extra_includes << RelativeMarkdownLinks
|
39
|
+
end
|