html2pdf 0.0.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/.gitignore +21 -0
- data/.rubocop.yml +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Guardfile +15 -0
- data/LICENSE.txt +22 -0
- data/README.md +112 -0
- data/Rakefile +30 -0
- data/TODOs.md +13 -0
- data/bin/html2pdf +4 -0
- data/html2pdf.gemspec +37 -0
- data/lib/html2pdf.rb +6 -0
- data/lib/html2pdf/cli.rb +53 -0
- data/lib/html2pdf/utils.rb +63 -0
- data/lib/html2pdf/version.rb +3 -0
- data/rubocop-todo.yml +84 -0
- data/test/fixtures/samples/demo1_xxx.rb +18 -0
- data/test/fixtures/samples/demo1_xxx.rb.xhtml +117 -0
- data/test/fixtures/samples/demo1_xxx.rb.xhtml.pdf +0 -0
- data/test/fixtures/samples/demo2_xxx.rb +25 -0
- data/test/fixtures/samples/demo2_xxx.rb.xhtml +123 -0
- data/test/fixtures/samples/demo2_xxx.rb.xhtml.pdf +0 -0
- data/test/fixtures/samples/sub_dir/demo3_xxx.rb +24 -0
- data/test/fixtures/samples/sub_dir/demo3_xxx.rb.xhtml +124 -0
- data/test/fixtures/samples/sub_dir/demo3_xxx.rb.xhtml.pdf +0 -0
- data/test/fixtures/samples/sub_dir/demo4_xxx.rb +6 -0
- data/test/fixtures/samples/sub_dir/demo4_xxx.rb.xhtml +101 -0
- data/test/fixtures/samples/sub_dir/demo4_xxx.rb.xhtml.pdf +0 -0
- data/test/lib/html2pdf/test_utils.rb +14 -0
- data/test/test_helper.rb +7 -0
- metadata +300 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
# file: spec/fixtures/demo1.rb
|
2
|
+
# from: https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/food.rb
|
3
|
+
require 'active_support/inflector'
|
4
|
+
module Foodie
|
5
|
+
class Food
|
6
|
+
def self.portray(food)
|
7
|
+
if food.downcase == "broccoli"
|
8
|
+
"Gross!"
|
9
|
+
else
|
10
|
+
"Delicious!"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.pluralize(word)
|
15
|
+
word.pluralize
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<title>~/Dropbox/spikes/code_exporter_original/spec/fixtures/demo1.xxx.rb.xhtml</title>
|
6
|
+
<meta name="Generator" content="Vim/7.4" />
|
7
|
+
<meta name="plugin-version" content="vim7.4_v1" />
|
8
|
+
<meta name="syntax" content="ruby" />
|
9
|
+
<meta name="settings" content="no_progress,number_lines,dynamic_folds,no_pre,use_xhtml,use_css,expand_tabs,line_ids,prevent_copy=" />
|
10
|
+
<meta name="colorscheme" content="Tomorrow-Night" />
|
11
|
+
<style type="text/css">
|
12
|
+
|
13
|
+
body { color: #bcbcbc; background-color: #262626; font-family: monospace; }
|
14
|
+
* { font-size: 1em; }
|
15
|
+
.Operator { color: #87afaf; }
|
16
|
+
.rubyConstant { color: #ffd787; }
|
17
|
+
.rubyInclude { color: #87afaf; }
|
18
|
+
.rubyStringDelimiter { color: #afaf5f; }
|
19
|
+
.Function { color: #87afaf; }
|
20
|
+
.Define { color: #af87af; }
|
21
|
+
.FoldColumn { color: #00ffff; background-color: #262626; padding-bottom: 1px; }
|
22
|
+
.rubyConditional { color: #af87af; }
|
23
|
+
.LineNr { color: #4e4e4e; }
|
24
|
+
.Comment { color: #8a8a8a; }
|
25
|
+
.String { color: #afaf5f; }
|
26
|
+
.Constant { color: #d7875f; }
|
27
|
+
.FoldColumn { text-decoration: none; white-space: pre; }
|
28
|
+
.open-fold .Folded { display: none; }
|
29
|
+
.open-fold .fulltext { display: inline; }
|
30
|
+
.open-fold .toggle-open { display: none; }
|
31
|
+
.closed-fold .toggle-closed { display: inline; }
|
32
|
+
|
33
|
+
.closed-fold .fulltext { display: none; }
|
34
|
+
.closed-fold .Folded { display: inline; }
|
35
|
+
.closed-fold .toggle-open { display: inline; }
|
36
|
+
.closed-fold .toggle-closed { display: none; }
|
37
|
+
|
38
|
+
</style>
|
39
|
+
|
40
|
+
<script type='text/javascript'>
|
41
|
+
//<![CDATA[
|
42
|
+
|
43
|
+
function toggleFold(objID)
|
44
|
+
{
|
45
|
+
var fold;
|
46
|
+
fold = document.getElementById(objID);
|
47
|
+
if(fold.className == 'closed-fold')
|
48
|
+
{
|
49
|
+
fold.className = 'open-fold';
|
50
|
+
}
|
51
|
+
else if (fold.className == 'open-fold')
|
52
|
+
{
|
53
|
+
fold.className = 'closed-fold';
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
/* function to open any folds containing a jumped-to line before jumping to it */
|
58
|
+
function JumpToLine()
|
59
|
+
{
|
60
|
+
var lineNum;
|
61
|
+
lineNum = window.location.hash;
|
62
|
+
lineNum = lineNum.substr(1); /* strip off '#' */
|
63
|
+
|
64
|
+
if (lineNum.indexOf('L') == -1) {
|
65
|
+
lineNum = 'L'+lineNum;
|
66
|
+
}
|
67
|
+
lineElem = document.getElementById(lineNum);
|
68
|
+
|
69
|
+
/* navigate upwards in the DOM tree to open all folds containing the line */
|
70
|
+
var node = lineElem;
|
71
|
+
while (node && node.id != 'vimCodeElement')
|
72
|
+
{
|
73
|
+
if (node.className == 'closed-fold')
|
74
|
+
{
|
75
|
+
node.className = 'open-fold';
|
76
|
+
}
|
77
|
+
node = node.parentNode;
|
78
|
+
}
|
79
|
+
/* Always jump to new location even if the line was hidden inside a fold, or
|
80
|
+
* we corrected the raw number to a line ID.
|
81
|
+
*/
|
82
|
+
if (lineElem) {
|
83
|
+
lineElem.scrollIntoView(true);
|
84
|
+
}
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
if ('onhashchange' in window) {
|
88
|
+
window.onhashchange = JumpToLine;
|
89
|
+
}
|
90
|
+
|
91
|
+
//]]>
|
92
|
+
</script>
|
93
|
+
</head>
|
94
|
+
<body onload='JumpToLine();'>
|
95
|
+
<div id='vimCodeElement'>
|
96
|
+
<span id="L1" class="LineNr"> 1 </span><span class="Comment"># file: spec/fixtures/demo1.rb</span><br />
|
97
|
+
<span id="L2" class="LineNr"> 2 </span><span class="Comment"># from: <a href="https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/food.rb">https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/food.rb</a></span><br />
|
98
|
+
<span id="L3" class="LineNr"> 3 </span><span class="rubyInclude">require</span> <span class="rubyStringDelimiter">'</span><span class="String">active_support/inflector</span><span class="rubyStringDelimiter">'</span><br />
|
99
|
+
<span id="L4" class="LineNr"> 4 </span><span class="Define">module</span> <span class="rubyConstant">Foodie</span><br />
|
100
|
+
<span id="L5" class="LineNr"> 5 </span>  <span class="Define">class</span> <span class="rubyConstant">Food</span><br />
|
101
|
+
<span id="L6" class="LineNr"> 6 </span>    <span class="Define">def</span> <span class="Constant">self</span>.<span class="Function">portray</span>(food)<br />
|
102
|
+
<span id="L7" class="LineNr"> 7 </span>      <span class="rubyConditional">if</span> food.downcase <span class="Operator">==</span> <span class="rubyStringDelimiter">"</span><span class="String">broccoli</span><span class="rubyStringDelimiter">"</span><br />
|
103
|
+
<span id="L8" class="LineNr"> 8 </span>        <span class="rubyStringDelimiter">"</span><span class="String">Gross!</span><span class="rubyStringDelimiter">"</span><br />
|
104
|
+
<span id="L9" class="LineNr"> 9 </span>      <span class="rubyConditional">else</span><br />
|
105
|
+
<span id="L10" class="LineNr">10 </span>        <span class="rubyStringDelimiter">"</span><span class="String">Delicious!</span><span class="rubyStringDelimiter">"</span><br />
|
106
|
+
<span id="L11" class="LineNr">11 </span>      <span class="rubyConditional">end</span><br />
|
107
|
+
<span id="L12" class="LineNr">12 </span>    <span class="Define">end</span><br />
|
108
|
+
<span id="L13" class="LineNr">13 </span><br />
|
109
|
+
<span id="L14" class="LineNr">14 </span>    <span class="Define">def</span> <span class="Constant">self</span>.<span class="Function">pluralize</span>(word)<br />
|
110
|
+
<span id="L15" class="LineNr">15 </span>      word.pluralize<br />
|
111
|
+
<span id="L16" class="LineNr">16 </span>    <span class="Define">end</span><br />
|
112
|
+
<span id="L17" class="LineNr">17 </span>  <span class="Define">end</span><br />
|
113
|
+
<span id="L18" class="LineNr">18 </span><span class="Define">end</span><br />
|
114
|
+
</div>
|
115
|
+
</body>
|
116
|
+
</html>
|
117
|
+
<!-- vim: set foldmethod=manual : -->
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# file: spec/fixtures/demo2.rb
|
2
|
+
# from: https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/cli.rb
|
3
|
+
require 'thor'
|
4
|
+
require 'foodie'
|
5
|
+
require 'foodie/generators/recipe'
|
6
|
+
|
7
|
+
module Foodie
|
8
|
+
class CLI < Thor
|
9
|
+
desc "portray ITEM", "Determines if a piece of food is gross or delicious"
|
10
|
+
def portray(name)
|
11
|
+
puts Foodie::Food.portray(name)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "pluralize", "Pluralizes a word"
|
15
|
+
method_option :word, :aliases => :word
|
16
|
+
def pluralize
|
17
|
+
puts Foodie::Food.pluralize(options[:word])
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "recipe", "Generates a recipe scaffold"
|
21
|
+
def recipe(group, name)
|
22
|
+
Foodie::Generators::Recipe.start([group, name])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<title>~/Dropbox/spikes/code_exporter_original/spec/fixtures/demo2.xxx.rb.xhtml</title>
|
6
|
+
<meta name="Generator" content="Vim/7.4" />
|
7
|
+
<meta name="plugin-version" content="vim7.4_v1" />
|
8
|
+
<meta name="syntax" content="ruby" />
|
9
|
+
<meta name="settings" content="no_progress,number_lines,dynamic_folds,no_pre,use_xhtml,use_css,expand_tabs,line_ids,prevent_copy=" />
|
10
|
+
<meta name="colorscheme" content="Tomorrow-Night" />
|
11
|
+
<style type="text/css">
|
12
|
+
|
13
|
+
body { color: #bcbcbc; background-color: #262626; font-family: monospace; }
|
14
|
+
* { font-size: 1em; }
|
15
|
+
.Operator { color: #87afaf; }
|
16
|
+
.rubySymbol { color: #afaf5f; }
|
17
|
+
.rubyConstant { color: #ffd787; }
|
18
|
+
.rubyInclude { color: #87afaf; }
|
19
|
+
.rubyStringDelimiter { color: #afaf5f; }
|
20
|
+
.Function { color: #87afaf; }
|
21
|
+
.Define { color: #af87af; }
|
22
|
+
.FoldColumn { color: #00ffff; background-color: #262626; padding-bottom: 1px; }
|
23
|
+
.LineNr { color: #4e4e4e; }
|
24
|
+
.Comment { color: #8a8a8a; }
|
25
|
+
.String { color: #afaf5f; }
|
26
|
+
.FoldColumn { text-decoration: none; white-space: pre; }
|
27
|
+
.open-fold .Folded { display: none; }
|
28
|
+
.open-fold .fulltext { display: inline; }
|
29
|
+
.open-fold .toggle-open { display: none; }
|
30
|
+
.closed-fold .toggle-closed { display: inline; }
|
31
|
+
|
32
|
+
.closed-fold .fulltext { display: none; }
|
33
|
+
.closed-fold .Folded { display: inline; }
|
34
|
+
.closed-fold .toggle-open { display: inline; }
|
35
|
+
.closed-fold .toggle-closed { display: none; }
|
36
|
+
|
37
|
+
</style>
|
38
|
+
|
39
|
+
<script type='text/javascript'>
|
40
|
+
//<![CDATA[
|
41
|
+
|
42
|
+
function toggleFold(objID)
|
43
|
+
{
|
44
|
+
var fold;
|
45
|
+
fold = document.getElementById(objID);
|
46
|
+
if(fold.className == 'closed-fold')
|
47
|
+
{
|
48
|
+
fold.className = 'open-fold';
|
49
|
+
}
|
50
|
+
else if (fold.className == 'open-fold')
|
51
|
+
{
|
52
|
+
fold.className = 'closed-fold';
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
/* function to open any folds containing a jumped-to line before jumping to it */
|
57
|
+
function JumpToLine()
|
58
|
+
{
|
59
|
+
var lineNum;
|
60
|
+
lineNum = window.location.hash;
|
61
|
+
lineNum = lineNum.substr(1); /* strip off '#' */
|
62
|
+
|
63
|
+
if (lineNum.indexOf('L') == -1) {
|
64
|
+
lineNum = 'L'+lineNum;
|
65
|
+
}
|
66
|
+
lineElem = document.getElementById(lineNum);
|
67
|
+
|
68
|
+
/* navigate upwards in the DOM tree to open all folds containing the line */
|
69
|
+
var node = lineElem;
|
70
|
+
while (node && node.id != 'vimCodeElement')
|
71
|
+
{
|
72
|
+
if (node.className == 'closed-fold')
|
73
|
+
{
|
74
|
+
node.className = 'open-fold';
|
75
|
+
}
|
76
|
+
node = node.parentNode;
|
77
|
+
}
|
78
|
+
/* Always jump to new location even if the line was hidden inside a fold, or
|
79
|
+
* we corrected the raw number to a line ID.
|
80
|
+
*/
|
81
|
+
if (lineElem) {
|
82
|
+
lineElem.scrollIntoView(true);
|
83
|
+
}
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
if ('onhashchange' in window) {
|
87
|
+
window.onhashchange = JumpToLine;
|
88
|
+
}
|
89
|
+
|
90
|
+
//]]>
|
91
|
+
</script>
|
92
|
+
</head>
|
93
|
+
<body onload='JumpToLine();'>
|
94
|
+
<div id='vimCodeElement'>
|
95
|
+
<span id="L1" class="LineNr"> 1 </span><span class="Comment"># file: spec/fixtures/demo2.rb</span><br />
|
96
|
+
<span id="L2" class="LineNr"> 2 </span><span class="Comment"># from: <a href="https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/cli.rb">https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/cli.rb</a></span><br />
|
97
|
+
<span id="L3" class="LineNr"> 3 </span><span class="rubyInclude">require</span> <span class="rubyStringDelimiter">'</span><span class="String">thor</span><span class="rubyStringDelimiter">'</span><br />
|
98
|
+
<span id="L4" class="LineNr"> 4 </span><span class="rubyInclude">require</span> <span class="rubyStringDelimiter">'</span><span class="String">foodie</span><span class="rubyStringDelimiter">'</span><br />
|
99
|
+
<span id="L5" class="LineNr"> 5 </span><span class="rubyInclude">require</span> <span class="rubyStringDelimiter">'</span><span class="String">foodie/generators/recipe</span><span class="rubyStringDelimiter">'</span><br />
|
100
|
+
<span id="L6" class="LineNr"> 6 </span><br />
|
101
|
+
<span id="L7" class="LineNr"> 7 </span><span class="Define">module</span> <span class="rubyConstant">Foodie</span><br />
|
102
|
+
<span id="L8" class="LineNr"> 8 </span>  <span class="Define">class</span> <span class="rubyConstant">CLI</span> < <span class="rubyConstant">Thor</span><br />
|
103
|
+
<span id="L9" class="LineNr"> 9 </span>    desc <span class="rubyStringDelimiter">"</span><span class="String">portray ITEM</span><span class="rubyStringDelimiter">"</span>, <span class="rubyStringDelimiter">"</span><span class="String">Determines if a piece of food is gross or delicious</span><span class="rubyStringDelimiter">"</span><br />
|
104
|
+
<span id="L10" class="LineNr">10 </span>    <span class="Define">def</span> <span class="Function">portray</span>(name)<br />
|
105
|
+
<span id="L11" class="LineNr">11 </span>      puts <span class="rubyConstant">Foodie</span><span class="Operator">::</span><span class="rubyConstant">Food</span>.portray(name)<br />
|
106
|
+
<span id="L12" class="LineNr">12 </span>    <span class="Define">end</span><br />
|
107
|
+
<span id="L13" class="LineNr">13 </span><br />
|
108
|
+
<span id="L14" class="LineNr">14 </span>    desc <span class="rubyStringDelimiter">"</span><span class="String">pluralize</span><span class="rubyStringDelimiter">"</span>, <span class="rubyStringDelimiter">"</span><span class="String">Pluralizes a word</span><span class="rubyStringDelimiter">"</span><br />
|
109
|
+
<span id="L15" class="LineNr">15 </span>    method_option <span class="rubySymbol">:word</span>, <span class="rubySymbol">:aliases</span> => <span class="rubySymbol">:word</span><br />
|
110
|
+
<span id="L16" class="LineNr">16 </span>    <span class="Define">def</span> <span class="Function">pluralize</span><br />
|
111
|
+
<span id="L17" class="LineNr">17 </span>      puts <span class="rubyConstant">Foodie</span><span class="Operator">::</span><span class="rubyConstant">Food</span>.pluralize(options<span class="Operator">[</span><span class="rubySymbol">:word</span><span class="Operator">]</span>)<br />
|
112
|
+
<span id="L18" class="LineNr">18 </span>    <span class="Define">end</span><br />
|
113
|
+
<span id="L19" class="LineNr">19 </span><br />
|
114
|
+
<span id="L20" class="LineNr">20 </span>    desc <span class="rubyStringDelimiter">"</span><span class="String">recipe</span><span class="rubyStringDelimiter">"</span>, <span class="rubyStringDelimiter">"</span><span class="String">Generates a recipe scaffold</span><span class="rubyStringDelimiter">"</span><br />
|
115
|
+
<span id="L21" class="LineNr">21 </span>    <span class="Define">def</span> <span class="Function">recipe</span>(group, name)<br />
|
116
|
+
<span id="L22" class="LineNr">22 </span>      <span class="rubyConstant">Foodie</span><span class="Operator">::</span><span class="rubyConstant">Generators</span><span class="Operator">::</span><span class="rubyConstant">Recipe</span>.start([group, name])<br />
|
117
|
+
<span id="L23" class="LineNr">23 </span>    <span class="Define">end</span><br />
|
118
|
+
<span id="L24" class="LineNr">24 </span>  <span class="Define">end</span><br />
|
119
|
+
<span id="L25" class="LineNr">25 </span><span class="Define">end</span><br />
|
120
|
+
</div>
|
121
|
+
</body>
|
122
|
+
</html>
|
123
|
+
<!-- vim: set foldmethod=manual : -->
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# file: spec/fixtures/sub-dir/demo3.xxx.rb
|
2
|
+
# from: https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/generators/recipe.rb
|
3
|
+
require 'thor/group'
|
4
|
+
module Foodie
|
5
|
+
module Generators
|
6
|
+
class Recipe < Thor::Group
|
7
|
+
argument :group, :type => :string
|
8
|
+
argument :name, :type => :string
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
def self.source_root
|
12
|
+
File.dirname(__FILE__) + "/recipe"
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_group
|
16
|
+
empty_directory(group)
|
17
|
+
end
|
18
|
+
|
19
|
+
def copy_recipe
|
20
|
+
template("recipe.txt", "#{group}/#{name}.txt")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
en
|
@@ -0,0 +1,124 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<title>~/Dropbox/spikes/code_exporter_original/spec/fixtures/sub_dir/demo3.xxx.rb.xhtml</title>
|
6
|
+
<meta name="Generator" content="Vim/7.4" />
|
7
|
+
<meta name="plugin-version" content="vim7.4_v1" />
|
8
|
+
<meta name="syntax" content="ruby" />
|
9
|
+
<meta name="settings" content="no_progress,number_lines,dynamic_folds,no_pre,use_xhtml,use_css,expand_tabs,line_ids,prevent_copy=" />
|
10
|
+
<meta name="colorscheme" content="Tomorrow-Night" />
|
11
|
+
<style type="text/css">
|
12
|
+
|
13
|
+
body { color: #bcbcbc; background-color: #262626; font-family: monospace; }
|
14
|
+
* { font-size: 1em; }
|
15
|
+
.Operator { color: #87afaf; }
|
16
|
+
.rubySymbol { color: #afaf5f; }
|
17
|
+
.rubyConstant { color: #ffd787; }
|
18
|
+
.rubyInclude { color: #87afaf; }
|
19
|
+
.rubyStringDelimiter { color: #afaf5f; }
|
20
|
+
.Function { color: #87afaf; }
|
21
|
+
.Define { color: #af87af; }
|
22
|
+
.FoldColumn { color: #00ffff; background-color: #262626; padding-bottom: 1px; }
|
23
|
+
.rubyInterpolationDelimiter { color: #d7875f; }
|
24
|
+
.Comment { color: #8a8a8a; }
|
25
|
+
.LineNr { color: #4e4e4e; }
|
26
|
+
.String { color: #afaf5f; }
|
27
|
+
.Constant { color: #d7875f; }
|
28
|
+
.FoldColumn { text-decoration: none; white-space: pre; }
|
29
|
+
.open-fold .Folded { display: none; }
|
30
|
+
.open-fold .fulltext { display: inline; }
|
31
|
+
.open-fold .toggle-open { display: none; }
|
32
|
+
.closed-fold .toggle-closed { display: inline; }
|
33
|
+
|
34
|
+
.closed-fold .fulltext { display: none; }
|
35
|
+
.closed-fold .Folded { display: inline; }
|
36
|
+
.closed-fold .toggle-open { display: inline; }
|
37
|
+
.closed-fold .toggle-closed { display: none; }
|
38
|
+
|
39
|
+
</style>
|
40
|
+
|
41
|
+
<script type='text/javascript'>
|
42
|
+
//<![CDATA[
|
43
|
+
|
44
|
+
function toggleFold(objID)
|
45
|
+
{
|
46
|
+
var fold;
|
47
|
+
fold = document.getElementById(objID);
|
48
|
+
if(fold.className == 'closed-fold')
|
49
|
+
{
|
50
|
+
fold.className = 'open-fold';
|
51
|
+
}
|
52
|
+
else if (fold.className == 'open-fold')
|
53
|
+
{
|
54
|
+
fold.className = 'closed-fold';
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
/* function to open any folds containing a jumped-to line before jumping to it */
|
59
|
+
function JumpToLine()
|
60
|
+
{
|
61
|
+
var lineNum;
|
62
|
+
lineNum = window.location.hash;
|
63
|
+
lineNum = lineNum.substr(1); /* strip off '#' */
|
64
|
+
|
65
|
+
if (lineNum.indexOf('L') == -1) {
|
66
|
+
lineNum = 'L'+lineNum;
|
67
|
+
}
|
68
|
+
lineElem = document.getElementById(lineNum);
|
69
|
+
|
70
|
+
/* navigate upwards in the DOM tree to open all folds containing the line */
|
71
|
+
var node = lineElem;
|
72
|
+
while (node && node.id != 'vimCodeElement')
|
73
|
+
{
|
74
|
+
if (node.className == 'closed-fold')
|
75
|
+
{
|
76
|
+
node.className = 'open-fold';
|
77
|
+
}
|
78
|
+
node = node.parentNode;
|
79
|
+
}
|
80
|
+
/* Always jump to new location even if the line was hidden inside a fold, or
|
81
|
+
* we corrected the raw number to a line ID.
|
82
|
+
*/
|
83
|
+
if (lineElem) {
|
84
|
+
lineElem.scrollIntoView(true);
|
85
|
+
}
|
86
|
+
return true;
|
87
|
+
}
|
88
|
+
if ('onhashchange' in window) {
|
89
|
+
window.onhashchange = JumpToLine;
|
90
|
+
}
|
91
|
+
|
92
|
+
//]]>
|
93
|
+
</script>
|
94
|
+
</head>
|
95
|
+
<body onload='JumpToLine();'>
|
96
|
+
<div id='vimCodeElement'>
|
97
|
+
<span id="L1" class="LineNr"> 1 </span><span class="Comment"># file: spec/fixtures/sub-dir/demo3.xxx.rb</span><br />
|
98
|
+
<span id="L2" class="LineNr"> 2 </span><span class="Comment"># from: <a href="https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/generators/recipe.rb">https://github.com/radar/guides/blob/master/gem-development/foodie/lib/foodie/generators/recipe.rb</a></span><br />
|
99
|
+
<span id="L3" class="LineNr"> 3 </span><span class="rubyInclude">require</span> <span class="rubyStringDelimiter">'</span><span class="String">thor/group</span><span class="rubyStringDelimiter">'</span><br />
|
100
|
+
<span id="L4" class="LineNr"> 4 </span><span class="Define">module</span> <span class="rubyConstant">Foodie</span><br />
|
101
|
+
<span id="L5" class="LineNr"> 5 </span>  <span class="Define">module</span> <span class="rubyConstant">Generators</span><br />
|
102
|
+
<span id="L6" class="LineNr"> 6 </span>    <span class="Define">class</span> <span class="rubyConstant">Recipe</span> < <span class="rubyConstant">Thor</span><span class="Operator">::</span><span class="rubyConstant">Group</span><br />
|
103
|
+
<span id="L7" class="LineNr"> 7 </span>      argument <span class="rubySymbol">:group</span>, <span class="rubySymbol">:type</span> => <span class="rubySymbol">:string</span><br />
|
104
|
+
<span id="L8" class="LineNr"> 8 </span>      argument <span class="rubySymbol">:name</span>, <span class="rubySymbol">:type</span> => <span class="rubySymbol">:string</span><br />
|
105
|
+
<span id="L9" class="LineNr"> 9 </span>      <span class="rubyInclude">include</span> <span class="rubyConstant">Thor</span><span class="Operator">::</span><span class="rubyConstant">Actions</span><br />
|
106
|
+
<span id="L10" class="LineNr">10 </span><br />
|
107
|
+
<span id="L11" class="LineNr">11 </span>      <span class="Define">def</span> <span class="Constant">self</span>.<span class="Function">source_root</span><br />
|
108
|
+
<span id="L12" class="LineNr">12 </span>        <span class="rubyConstant">File</span>.dirname(<span class="Constant">__FILE__</span>) <span class="Operator">+</span> <span class="rubyStringDelimiter">"</span><span class="String">/recipe</span><span class="rubyStringDelimiter">"</span><br />
|
109
|
+
<span id="L13" class="LineNr">13 </span>      <span class="Define">end</span><br />
|
110
|
+
<span id="L14" class="LineNr">14 </span><br />
|
111
|
+
<span id="L15" class="LineNr">15 </span>      <span class="Define">def</span> <span class="Function">create_group</span><br />
|
112
|
+
<span id="L16" class="LineNr">16 </span>        empty_directory(group)<br />
|
113
|
+
<span id="L17" class="LineNr">17 </span>      <span class="Define">end</span><br />
|
114
|
+
<span id="L18" class="LineNr">18 </span><br />
|
115
|
+
<span id="L19" class="LineNr">19 </span>      <span class="Define">def</span> <span class="Function">copy_recipe</span><br />
|
116
|
+
<span id="L20" class="LineNr">20 </span>        template(<span class="rubyStringDelimiter">"</span><span class="String">recipe.txt</span><span class="rubyStringDelimiter">"</span>, <span class="rubyStringDelimiter">"</span><span class="rubyInterpolationDelimiter">#{</span>group<span class="rubyInterpolationDelimiter">}</span><span class="String">/</span><span class="rubyInterpolationDelimiter">#{</span>name<span class="rubyInterpolationDelimiter">}</span><span class="String">.txt</span><span class="rubyStringDelimiter">"</span>)<br />
|
117
|
+
<span id="L21" class="LineNr">21 </span>      <span class="Define">end</span><br />
|
118
|
+
<span id="L22" class="LineNr">22 </span>    <span class="Define">end</span><br />
|
119
|
+
<span id="L23" class="LineNr">23 </span>  <span class="Define">end</span><br />
|
120
|
+
<span id="L24" class="LineNr">24 </span>en<br />
|
121
|
+
</div>
|
122
|
+
</body>
|
123
|
+
</html>
|
124
|
+
<!-- vim: set foldmethod=manual : -->
|
Binary file
|