glyph 0.5.2 → 0.5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS.textile +1 -0
- data/CHANGELOG.textile +104 -59
- data/Gemfile.lock +46 -0
- data/LICENSE.textile +1 -1
- data/README.textile +106 -120
- data/book/lib/layouts/bookindex.glyph +6 -106
- data/book/lib/layouts/bookpage.glyph +8 -108
- data/book/lib/layouts/project.glyph +0 -1
- data/book/text/acknowledgements.glyph +1 -0
- data/book/text/changelog.glyph +7 -1
- data/glyph.gemspec +10 -10
- data/lib/glyph.rb +1 -1
- data/spec/files/test.scss +1 -1
- data/spec/lib/analyzer_spec.rb +60 -61
- data/spec/lib/bookmark_spec.rb +21 -21
- data/spec/lib/commands_spec.rb +53 -54
- data/spec/lib/config_spec.rb +16 -16
- data/spec/lib/document_spec.rb +35 -35
- data/spec/lib/glyph_spec.rb +32 -32
- data/spec/lib/interpreter_spec.rb +8 -8
- data/spec/lib/macro_spec.rb +51 -49
- data/spec/lib/macro_validators_spec.rb +14 -14
- data/spec/lib/node_spec.rb +25 -25
- data/spec/lib/parser_spec.rb +26 -26
- data/spec/lib/reporter_spec.rb +32 -32
- data/spec/lib/syntax_node_spec.rb +33 -33
- data/spec/macros/core_spec.rb +95 -95
- data/spec/macros/filters_spec.rb +9 -8
- data/spec/macros/html5_spec.rb +17 -17
- data/spec/macros/macros_spec.rb +33 -33
- data/spec/macros/textile_spec.rb +15 -15
- data/spec/macros/web5_spec.rb +3 -3
- data/spec/macros/web_spec.rb +19 -19
- data/spec/macros/xml_spec.rb +15 -15
- data/spec/tasks/generate_spec.rb +34 -34
- data/spec/tasks/load_spec.rb +15 -15
- data/spec/tasks/project_spec.rb +15 -15
- data/styles/coderay.css +2 -0
- data/styles/coderay.css.map +7 -0
- data/styles/default.css +9 -7
- data/styles/default.css.map +7 -0
- data/styles/pagination.css +18 -23
- data/styles/pagination.css.map +7 -0
- data/tasks/generate.rake +12 -5
- metadata +47 -68
- data/glyph-0.5.1.gem +0 -0
@@ -1,106 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<meta name="author" content="Fabio Cevasco" />
|
8
|
-
<meta name="copyright" content="Fabio Cevasco" />
|
9
|
-
<meta name="robots" content="all, follow" />
|
10
|
-
<meta name="Revisit-After" content="2 Days" />
|
11
|
-
<meta name="language" content="en" />
|
12
|
-
<meta name="target_country" content="en-us" />
|
13
|
-
<meta name="country" content="United States" />
|
14
|
-
<meta name="readability-verification" content="XmaVzRjmcFL5Bb2Fu9TZVdDKzhA3apQdxexTB2rK"/>
|
15
|
-
<meta name="description" content="H3RALD - Fabio Cevasco's Web Site" />
|
16
|
-
|
17
|
-
<meta name="keywords" content="h3rald, fabio cevasco, glyph" />
|
18
|
-
<link rel="shortcut icon" href="/favicon.png" type="image/png" />
|
19
|
-
<meta content="44.388041;9.073248" name="ICBM" />
|
20
|
-
|
21
|
-
<link rel="stylesheet" type="text/css" href="/styles/html5reset.css" />
|
22
|
-
<link rel="stylesheet" type="text/css" href="/styles/style.css" />
|
23
|
-
|
24
|
-
<script src="http://www.google.com/jsapi?key=ABQIAAAAr6RY1Z6dchG_sX9WDLSy3xRlq2n1sm52B5HDRR5tm6o8XM18FhR56xHNNH6CsX86uN5VoTrglpyOyQ" type="text/javascript"></script>
|
25
|
-
<script src="/js/sevenup.js" type="text/javascript"></script>
|
26
|
-
<script src="/js/sevenup_black.js" type="text/javascript"></script>
|
27
|
-
<script type="text/javascript">google.load("jquery", "1");</script>
|
28
|
-
<script src="/js/jquery-timeago.js" type="text/javascript"></script>
|
29
|
-
<script src="/js/jquery-easing.js" type="text/javascript"></script>
|
30
|
-
<script src="/js/jquery-fancybox.js" type="text/javascript"></script>
|
31
|
-
<script src="/js/date.js" type="text/javascript"></script>
|
32
|
-
<script src="/js/feeds.js" type="text/javascript"></script>
|
33
|
-
<script src="/js/hyphenator.js" type="text/javascript"></script>
|
34
|
-
<script src="/js/init.js" type="text/javascript"></script>
|
35
|
-
<script src="/js/search.js" type="text/javascript"></script>
|
36
|
-
</head>
|
37
|
-
<body>
|
38
|
-
<section id="container">
|
39
|
-
|
40
|
-
<header class="page">
|
41
|
-
<nav class="home-link">
|
42
|
-
<a href="/">
|
43
|
-
<span class="logo">
|
44
|
-
<span class="hrald"><span class="h">H</span> <span class="rald">RALD</span></span>
|
45
|
-
<span class="three">3</span>
|
46
|
-
</span>
|
47
|
-
</a>
|
48
|
-
</nav>
|
49
|
-
|
50
|
-
<nav class="section">
|
51
|
-
/<a href="/glyph/" rel="glyph">GLYPH</a>
|
52
|
-
</nav>
|
53
|
-
|
54
|
-
</header>
|
55
|
-
<article class="page">
|
56
|
-
<header>
|
57
|
-
<hgroup>
|
58
|
-
<h1>Glyph - Document Authoring Framework</h1>
|
59
|
-
<h2>Documentation</h2>
|
60
|
-
|
61
|
-
</hgroup>
|
62
|
-
|
63
|
-
</header>
|
64
|
-
<section id="body-text" class="hyphenate glyph-index">
|
65
|
-
toc[]
|
66
|
-
<nav id="sharing-buttons">
|
67
|
-
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="h3rald">Tweet</a>
|
68
|
-
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
|
69
|
-
</nav>
|
70
|
-
</section>
|
71
|
-
</article>
|
72
|
-
|
73
|
-
|
74
|
-
<footer>
|
75
|
-
<section>
|
76
|
-
<nav>
|
77
|
-
<a href="/about/">ABOUT</a>\|<a href="/contact/">CONTACT</a>
|
78
|
-
</nav>
|
79
|
-
<p>H3RALD Web Site v8.1.2 © 2004 — 2011 <em>Fabio Cevasco</em></p>
|
80
|
-
</section>
|
81
|
-
</footer>
|
82
|
-
</section><!-- #container end -->
|
83
|
-
|
84
|
-
<!-- Start Google Analytics -->
|
85
|
-
<script type="text/javascript">
|
86
|
-
var _gaq = _gaq \|\| \[\];
|
87
|
-
_gaq.push(\['_setAccount', 'UA-18587377-1'\]);
|
88
|
-
_gaq.push(\['_trackPageview'\]);
|
89
|
-
|
90
|
-
(function() {
|
91
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
92
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
93
|
-
var s = document.getElementsByTagName('script')\[0\]; s.parentNode.insertBefore(ga, s);
|
94
|
-
})();
|
95
|
-
</script>
|
96
|
-
<!-- End Google Analytics -->
|
97
|
-
<!-- Start of StatCounter Code -->
|
98
|
-
<script type="text/javascript">
|
99
|
-
var sc_project=6193656;
|
100
|
-
var sc_invisible=1;
|
101
|
-
var sc_security="57f7ee2a";
|
102
|
-
</script>
|
103
|
-
<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
|
104
|
-
<!-- End of StatCounter Code -->
|
105
|
-
</body>
|
106
|
-
</html>
|
1
|
+
-----
|
2
|
+
permalink: index
|
3
|
+
title: Glyph Documentation
|
4
|
+
type: page
|
5
|
+
-----
|
6
|
+
toc[]
|
@@ -1,108 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<meta name="robots" content="all, follow" />
|
10
|
-
<meta name="Revisit-After" content="2 Days" />
|
11
|
-
<meta name="language" content="en" />
|
12
|
-
<meta name="target_country" content="en-us" />
|
13
|
-
<meta name="country" content="United States" />
|
14
|
-
<meta name="readability-verification" content="XmaVzRjmcFL5Bb2Fu9TZVdDKzhA3apQdxexTB2rK"/>
|
15
|
-
<meta name="description" content="H3RALD - Fabio Cevasco's Web Site" />
|
16
|
-
|
17
|
-
<meta name="keywords" content="h3rald, fabio cevasco, glyph" />
|
18
|
-
<link rel="shortcut icon" href="/favicon.png" type="image/png" />
|
19
|
-
<meta content="44.388041;9.073248" name="ICBM" />
|
20
|
-
|
21
|
-
<link rel="stylesheet" type="text/css" href="/styles/html5reset.css" />
|
22
|
-
<link rel="stylesheet" type="text/css" href="/styles/style.css" />
|
23
|
-
|
24
|
-
<script src="http://www.google.com/jsapi?key=ABQIAAAAr6RY1Z6dchG_sX9WDLSy3xRlq2n1sm52B5HDRR5tm6o8XM18FhR56xHNNH6CsX86uN5VoTrglpyOyQ" type="text/javascript"></script>
|
25
|
-
<script src="/js/sevenup.js" type="text/javascript"></script>
|
26
|
-
<script src="/js/sevenup_black.js" type="text/javascript"></script>
|
27
|
-
<script type="text/javascript">google.load("jquery", "1");</script>
|
28
|
-
<script src="/js/jquery-timeago.js" type="text/javascript"></script>
|
29
|
-
<script src="/js/jquery-easing.js" type="text/javascript"></script>
|
30
|
-
<script src="/js/jquery-fancybox.js" type="text/javascript"></script>
|
31
|
-
<script src="/js/date.js" type="text/javascript"></script>
|
32
|
-
<script src="/js/feeds.js" type="text/javascript"></script>
|
33
|
-
<script src="/js/hyphenator.js" type="text/javascript"></script>
|
34
|
-
<script src="/js/init.js" type="text/javascript"></script>
|
35
|
-
<script src="/js/search.js" type="text/javascript"></script>
|
36
|
-
</head>
|
37
|
-
<body>
|
38
|
-
<section id="container">
|
39
|
-
|
40
|
-
<header class="page">
|
41
|
-
<nav class="home-link">
|
42
|
-
<a href="/">
|
43
|
-
<span class="logo">
|
44
|
-
<span class="hrald"><span class="h">H</span> <span class="rald">RALD</span></span>
|
45
|
-
<span class="three">3</span>
|
46
|
-
</span>
|
47
|
-
</a>
|
48
|
-
</nav>
|
49
|
-
|
50
|
-
<nav class="section">
|
51
|
-
/<a href="/glyph/" rel="glyph">GLYPH</a>
|
52
|
-
</nav>
|
53
|
-
|
54
|
-
</header>
|
55
|
-
<article class="page glyph-book">
|
56
|
-
<header>
|
57
|
-
<hgroup>
|
58
|
-
<h1>{{title}}</h1>
|
59
|
-
<h2>Glyph</h2>
|
60
|
-
</hgroup>
|
61
|
-
</header>
|
62
|
-
<section id="body-text" class="hyphenate glyph-book">
|
63
|
-
|
64
|
-
navigation[{{id}}]
|
65
|
-
{{contents}}
|
66
|
-
navigation[{{id}}]
|
67
|
-
<nav id="sharing-buttons">
|
68
|
-
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="h3rald">Tweet</a>
|
69
|
-
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
|
70
|
-
</nav>
|
71
|
-
</section>
|
72
|
-
</article>
|
73
|
-
|
74
|
-
|
75
|
-
<footer>
|
76
|
-
<section>
|
77
|
-
<nav>
|
78
|
-
<a href="/about/">ABOUT</a>\|<a href="/contact/">CONTACT</a>
|
79
|
-
</nav>
|
80
|
-
<p>H3RALD Web Site v8.1.2 © 2004 — 2012 <em>Fabio Cevasco</em></p>
|
81
|
-
</section>
|
82
|
-
</footer>
|
83
|
-
</section><!-- #container end -->
|
84
|
-
|
85
|
-
|
86
|
-
<!-- Start Google Analytics -->
|
87
|
-
<script type="text/javascript">
|
88
|
-
var _gaq = _gaq \|\| \[\];
|
89
|
-
_gaq.push(\['_setAccount', 'UA-18587377-1'\]);
|
90
|
-
_gaq.push(\['_trackPageview'\]);
|
91
|
-
|
92
|
-
(function() {
|
93
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
94
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
95
|
-
var s = document.getElementsByTagName('script')\[0\]; s.parentNode.insertBefore(ga, s);
|
96
|
-
})();
|
97
|
-
</script>
|
98
|
-
<!-- End Google Analytics -->
|
99
|
-
<!-- Start of StatCounter Code -->
|
100
|
-
<script type="text/javascript">
|
101
|
-
var sc_project=6193656;
|
102
|
-
var sc_invisible=1;
|
103
|
-
var sc_security="57f7ee2a";
|
104
|
-
</script>
|
105
|
-
<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
|
106
|
-
<!-- End of StatCounter Code -->
|
107
|
-
</body>
|
108
|
-
</html>
|
1
|
+
-----
|
2
|
+
permalink: {{id}}
|
3
|
+
title: Glyph – {{title}}
|
4
|
+
type: page
|
5
|
+
-----
|
6
|
+
navigation[{{id}}]
|
7
|
+
{{contents}}
|
8
|
+
navigation[{{id}}]
|
@@ -8,5 +8,6 @@ Special thanks to the following individuals who contributed to Glyph by reportin
|
|
8
8
|
* =>[http://www.stuartellis.eu|Stuart Ellis] (stuartellis)
|
9
9
|
* Eric Givens (darthzippy)
|
10
10
|
* =>[http://www.taylored-software.com/|Tammy Cravit] (tammycravit)
|
11
|
+
* =>[https://github.com/grv87|Basil Peace] (grv87)
|
11
12
|
]
|
12
13
|
|
data/book/text/changelog.glyph
CHANGED
@@ -32,11 +32,17 @@ def:[issue|
|
|
32
32
|
td[txt[{{1}}]]
|
33
33
|
]
|
34
34
|
]
|
35
|
-
?[eq[%[ARGV\[0\]]|
|
35
|
+
?[eq[%[ARGV\[0\]]|CHANGELOG]|
|
36
36
|
%:[%>|"#{value} macro"]
|
37
37
|
%:[#>|"#{value} command"]
|
38
38
|
%:[$>|"#{value} setting"]
|
39
39
|
]
|
40
|
+
|
41
|
+
release[0.5.3|October 4 2014|
|
42
|
+
bugs[
|
43
|
+
issue[216|Fix error with SCSS generation]
|
44
|
+
]
|
45
|
+
]
|
40
46
|
release[0.5.2|November 11th 2012|
|
41
47
|
features[
|
42
48
|
issue[208|HTML output now indented automatically.]
|
data/glyph.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "glyph"
|
5
|
-
s.version = "0.5.
|
5
|
+
s.version = "0.5.3.1"
|
6
6
|
s.summary = "Glyph -- A Ruby-powered Document Authoring Framework"
|
7
7
|
s.description = "Glyph is a framework for structured document authoring."
|
8
8
|
s.homepage = "http://www.h3rald.com/glyph/"
|
9
9
|
s.authors = ["Fabio Cevasco"]
|
10
10
|
s.email = "h3rald@h3rald.com"
|
11
|
-
s.date = "
|
11
|
+
s.date = "2014-10-04"
|
12
12
|
s.license = "MIT"
|
13
13
|
|
14
14
|
s.files = ["Rakefile"]
|
@@ -32,15 +32,15 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.default_executable = "glyph"
|
33
33
|
s.extra_rdoc_files = Dir.glob "*.textile"
|
34
34
|
|
35
|
-
s.add_runtime_dependency("gli", [">= 2.
|
36
|
-
s.add_runtime_dependency("extlib", [">= 0.9.
|
37
|
-
s.add_runtime_dependency("rake", [">=
|
35
|
+
s.add_runtime_dependency("gli", [">= 2.12.2"])
|
36
|
+
s.add_runtime_dependency("extlib", [">= 0.9.16"])
|
37
|
+
s.add_runtime_dependency("rake", [">= 10.3.2"])
|
38
38
|
|
39
|
-
s.add_development_dependency("rspec", [">=
|
40
|
-
s.add_development_dependency("yard", [">= 0.8.
|
41
|
-
s.add_development_dependency("directory_watcher", [">= 1.
|
42
|
-
s.add_development_dependency("sass", [">= 3.
|
39
|
+
s.add_development_dependency("rspec", [">= 3.1.0"])
|
40
|
+
s.add_development_dependency("yard", [">= 0.8.7.4"])
|
41
|
+
s.add_development_dependency("directory_watcher", [">= 1.5.1"])
|
42
|
+
s.add_development_dependency("sass", [">= 3.4.5"])
|
43
43
|
s.add_development_dependency("RedCloth", [">= 4.2.9"])
|
44
44
|
s.add_development_dependency("bluecloth", [">= 2.2.0"])
|
45
|
-
s.add_development_dependency("coderay", [">= 1.0
|
45
|
+
s.add_development_dependency("coderay", [">= 1.1.0"])
|
46
46
|
end
|
data/lib/glyph.rb
CHANGED
data/spec/files/test.scss
CHANGED
data/spec/lib/analyzer_spec.rb
CHANGED
@@ -20,118 +20,117 @@ describe Glyph::Analyzer do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should be initialized with a document" do
|
23
|
-
|
24
|
-
|
23
|
+
expect { Glyph::Analyzer.new(Glyph.document) }.not_to raise_error
|
24
|
+
expect { Glyph::Analyzer.new }.not_to raise_error
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should expose a macro node iterator" do
|
28
|
-
|
28
|
+
expect { @a.with_macros }.to raise_error(ArgumentError, "No block given")
|
29
29
|
count = 0
|
30
|
-
|
31
|
-
count.
|
30
|
+
expect { @a.with_macros {|n| count+=1} }.not_to raise_error
|
31
|
+
expect(count).to eq(20)
|
32
32
|
count = 0
|
33
|
-
|
34
|
-
count.
|
33
|
+
expect { @a.with_macros(:snippet) {|n| count+=1} }.not_to raise_error
|
34
|
+
expect(count).to eq(2)
|
35
35
|
count = 0
|
36
|
-
|
37
|
-
count.
|
36
|
+
expect { @a.with_macros(:&) {|n| count+=1} }.not_to raise_error
|
37
|
+
expect(count).to eq(2)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should access macro instance arrays by definition" do
|
41
|
-
@a.macro_array_for(:snippet).
|
41
|
+
expect(@a.macro_array_for(:snippet)).to eq([])
|
42
42
|
@a.with_macros {}
|
43
|
-
@a.macro_array_for(:snippet).length.
|
44
|
-
@a.macro_array_for(:&).length.
|
45
|
-
@a.macro_array_for(:section).length.
|
43
|
+
expect(@a.macro_array_for(:snippet).length).to eq(2)
|
44
|
+
expect(@a.macro_array_for(:&).length).to eq(2)
|
45
|
+
expect(@a.macro_array_for(:section).length).to eq(4)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should raise an error if a stat is not available" do
|
49
|
-
|
49
|
+
expect { @a.stats_for :unknown }.to raise_error(RuntimeError, "Unable to calculate unknown stats")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should calculate stats for all macros" do
|
53
|
-
|
54
|
-
@a.stats[:macros].blank
|
53
|
+
expect {@a.stats_for :macros}.not_to raise_error
|
54
|
+
expect(@a.stats[:macros].blank?).to eq(false)
|
55
55
|
c = @a.stats[:macros]
|
56
|
-
c[:definitions].
|
57
|
-
c[:aliases].
|
58
|
-
c[:instances].length.
|
59
|
-
c[:used_definitions].
|
56
|
+
expect(c[:definitions]).to eq((Glyph::MACROS.keys - Glyph::ALIASES[:by_alias].keys).uniq.sort)
|
57
|
+
expect(c[:aliases]).to eq(Glyph::ALIASES[:by_alias].keys.sort)
|
58
|
+
expect(c[:instances].length).to eq(20)
|
59
|
+
expect(c[:used_definitions]).to eq([:anchor, :include, :link, :markdown, :section, :snippet, :"snippet:", :textile, :toc])
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should calculate stats for a single macro" do
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
lambda {@a.stats_for :macro, :section }.should_not raise_error
|
63
|
+
expect {@a.stats_for :macro, :dsfash }.to raise_error(ArgumentError, "Unknown macro 'dsfash'")
|
64
|
+
expect {@a.stats_for :macro, :frontmatter }.to raise_error(ArgumentError, "Macro 'frontmatter' is not used in this document, did you mean 'section'?")
|
65
|
+
expect {@a.stats_for :macro, :section }.not_to raise_error
|
67
66
|
c = @a.stats[:macro]
|
68
|
-
c[:instances].length.
|
69
|
-
c[:files].
|
70
|
-
["text/a/b/c/markdown.markdown", 1], ["text/container.textile", 1]]
|
67
|
+
expect(c[:instances].length).to eq(4)
|
68
|
+
expect(c[:files]).to eq([["document.glyph", 1], ["text/a/b/c/included.textile", 1],
|
69
|
+
["text/a/b/c/markdown.markdown", 1], ["text/container.textile", 1]])
|
71
70
|
@a.stats_for :macro, :"&"
|
72
71
|
c = @a.stats[:macro]
|
73
|
-
c[:alias_for].
|
74
|
-
c[:instances].length.
|
72
|
+
expect(c[:alias_for]).to eq(:snippet)
|
73
|
+
expect(c[:instances].length).to eq(2)
|
75
74
|
end
|
76
75
|
|
77
76
|
it "should calculate stats for all bookmarks" do
|
78
|
-
|
77
|
+
expect {@a.stats_for :bookmarks}.not_to raise_error
|
79
78
|
c = @a.stats[:bookmarks]
|
80
|
-
c[:codes].
|
81
|
-
c[:unreferenced].
|
82
|
-
c[:referenced].
|
79
|
+
expect(c[:codes]).to eq([:h_1, :h_2, :md, :refs, :toc, :unused])
|
80
|
+
expect(c[:unreferenced]).to eq([:h_2, :md, :toc, :unused])
|
81
|
+
expect(c[:referenced]).to eq([[:h_1, 1], [:refs, 1]])
|
83
82
|
end
|
84
83
|
|
85
84
|
it "should calculate stats for a single bookmark" do
|
86
|
-
|
87
|
-
|
85
|
+
expect {@a.stats_for :bookmark, '#h_7'}.to raise_error(ArgumentError, "Bookmark 'h_7' does not exist")
|
86
|
+
expect {@a.stats_for :bookmark, '#h_1'}.not_to raise_error
|
88
87
|
c = @a.stats[:bookmark]
|
89
|
-
c[:file].
|
90
|
-
c[:references].
|
91
|
-
c[:type].
|
88
|
+
expect(c[:file]).to eq("text/container.textile")
|
89
|
+
expect(c[:references]).to eq([["text/references.glyph", 1]])
|
90
|
+
expect(c[:type]).to eq(:header)
|
92
91
|
end
|
93
92
|
|
94
93
|
it "should calculate stats for all links do" do
|
95
|
-
|
94
|
+
expect {@a.stats_for :links}.not_to raise_error
|
96
95
|
c = @a.stats[:links]
|
97
|
-
c[:internal].
|
98
|
-
["#refs", {:total=>1, :files=>[["text/references.glyph", 1]]}]]
|
99
|
-
c[:external].
|
96
|
+
expect(c[:internal]).to eq([["#h_1", {:total=>1, :files=>[["text/references.glyph", 1]]}],
|
97
|
+
["#refs", {:total=>1, :files=>[["text/references.glyph", 1]]}]])
|
98
|
+
expect(c[:external]).to eq([["http://www.h3rald.com", {:total=>1, :files=>[["text/references.glyph", 1]]}]])
|
100
99
|
end
|
101
100
|
|
102
101
|
it "should calculate stats for a single link" do
|
103
|
-
|
104
|
-
|
102
|
+
expect {@a.stats_for :link, 'q'}.to raise_error(ArgumentError, "No link matching /q/ was found")
|
103
|
+
expect {@a.stats_for :link, 'h'}.not_to raise_error
|
105
104
|
c = @a.stats[:link][:stats]
|
106
|
-
c.
|
107
|
-
["http://www.h3rald.com",{:total=>1, :files=>[["text/references.glyph", 1]]}]]
|
105
|
+
expect(c).to eq([["#h_1", {:total=>1, :files=>[["text/references.glyph", 1]]}],
|
106
|
+
["http://www.h3rald.com",{:total=>1, :files=>[["text/references.glyph", 1]]}]])
|
108
107
|
end
|
109
108
|
|
110
109
|
it "should calculate stats for all snippets" do
|
111
|
-
|
110
|
+
expect {@a.stats_for :snippets}.not_to raise_error
|
112
111
|
c = @a.stats[:snippets]
|
113
|
-
c[:used].
|
114
|
-
c[:total].
|
115
|
-
c[:unused].
|
116
|
-
c[:definitions].
|
112
|
+
expect(c[:used]).to eq([:test])
|
113
|
+
expect(c[:total]).to eq(2)
|
114
|
+
expect(c[:unused]).to eq([:unused])
|
115
|
+
expect(c[:definitions]).to eq([:test, :unused])
|
117
116
|
end
|
118
117
|
|
119
118
|
it "should calculate stats for a single snippet" do
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
expect {@a.stats_for :snippet, 'test1'}.to raise_error(ArgumentError, "Snippet 'test1' does not exist")
|
120
|
+
expect {@a.stats_for :snippet, 'unused'}.to raise_error(ArgumentError, "Snippet 'unused' is not used in this document")
|
121
|
+
expect {@a.stats_for :snippet, 'test'}.not_to raise_error
|
123
122
|
c = @a.stats[:snippet][:stats]
|
124
|
-
c.
|
123
|
+
expect(c).to eq({:total=>2, :files=>[["document.glyph", 1], ["text/references.glyph", 1]]})
|
125
124
|
end
|
126
125
|
|
127
126
|
it "should calculate global stats" do
|
128
|
-
|
127
|
+
expect {@a.stats_for :global}.not_to raise_error
|
129
128
|
c = @a.stats
|
130
|
-
c[:bookmarks].blank
|
131
|
-
c[:links].blank
|
132
|
-
c[:snippets].blank
|
133
|
-
c[:macros].blank
|
134
|
-
c[:files].
|
129
|
+
expect(c[:bookmarks].blank?).to eq(false)
|
130
|
+
expect(c[:links].blank?).to eq(false)
|
131
|
+
expect(c[:snippets].blank?).to eq(false)
|
132
|
+
expect(c[:macros].blank?).to eq(false)
|
133
|
+
expect(c[:files]).to eq({:layouts=>0, :images=>1, :styles=>1, :text=>4, :lib=>0})
|
135
134
|
end
|
136
135
|
|
137
136
|
end
|