k_builder 0.0.62 → 0.0.70
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Sample-original.xml +103 -0
- data/Sample.drawio +103 -0
- data/Sample.xml +103 -0
- data/assets/a.html +235 -0
- data/assets/b.html +109 -0
- data/assets/highlight.min.js +1120 -0
- data/assets/highlight_css +1 -0
- data/assets/ruby.min.js +7 -0
- data/hooks/pre-commit +4 -2
- data/k_builder.gemspec +0 -1
- data/lib/k_builder/base_builder.rb +292 -22
- data/lib/k_builder/commands/code_syntax_highlighter_command.rb +71 -0
- data/lib/k_builder/commands/rubo_cop_command.rb +1 -1
- data/lib/k_builder/configuration.rb +22 -12
- data/lib/k_builder/version.rb +1 -1
- data/lib/k_builder.rb +4 -0
- metadata +12 -4
- data/~/last_cop.txt +0 -19
data/assets/b.html
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>
|
5
|
+
How to take screenshot of
|
6
|
+
a div using JavaScript?
|
7
|
+
</title>
|
8
|
+
<script src="highlight.min.js"></script>
|
9
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/styles/default.min.css">
|
10
|
+
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.0.0-rc.5/dist/html2canvas.min.js"></script>
|
11
|
+
|
12
|
+
<!-- Include from the CDN -->
|
13
|
+
<script src=
|
14
|
+
"https://cdn.jsdelivr.net/npm/html2canvas@1.0.0-rc.5/dist/html2canvas.min.js">
|
15
|
+
</script>
|
16
|
+
|
17
|
+
<!-- Include locally otherwise -->
|
18
|
+
<!-- <script src='html2canvas.js'></script> -->
|
19
|
+
|
20
|
+
<style>
|
21
|
+
#photo {
|
22
|
+
border: 4px solid green;
|
23
|
+
padding: 4px;
|
24
|
+
}
|
25
|
+
</style>
|
26
|
+
</head>
|
27
|
+
|
28
|
+
<body>
|
29
|
+
<div id="photo">
|
30
|
+
<h1>GeeksforGeeks</h1>
|
31
|
+
Hello everyone! This is a
|
32
|
+
trial page for taking a
|
33
|
+
screenshot.
|
34
|
+
<br><br>
|
35
|
+
This is a dummy button!
|
36
|
+
<button> Dummy</button>
|
37
|
+
<br><br>
|
38
|
+
Click the button below to
|
39
|
+
take a screenshot of the div.
|
40
|
+
<br><br>
|
41
|
+
|
42
|
+
<!-- Define the button
|
43
|
+
that will be used to
|
44
|
+
take the screenshot -->
|
45
|
+
<button onclick="takeshot()">
|
46
|
+
Take Screenshot
|
47
|
+
</button>
|
48
|
+
</div>
|
49
|
+
<h1>Screenshot:</h1>
|
50
|
+
<div id="myBlock">
|
51
|
+
<pre><code class="ruby">
|
52
|
+
# frozen_string_literal: true
|
53
|
+
|
54
|
+
module KBuilder
|
55
|
+
module Commands
|
56
|
+
# Base command for single responsibility actions that can be fired
|
57
|
+
# from methods in the builder.
|
58
|
+
#
|
59
|
+
# Uses the command pattern
|
60
|
+
class BaseCommand
|
61
|
+
include KLog::Logging
|
62
|
+
|
63
|
+
attr_accessor :builder
|
64
|
+
attr_accessor :valid
|
65
|
+
|
66
|
+
def initialize(**opts)
|
67
|
+
@builder = opts[:builder]
|
68
|
+
@valid = true
|
69
|
+
end
|
70
|
+
|
71
|
+
def guard(message)
|
72
|
+
# THIS SHOULD ONLY LOG IF DEBUGGING IS TURNED ON
|
73
|
+
log.error(message)
|
74
|
+
@valid = false
|
75
|
+
end
|
76
|
+
|
77
|
+
def valid?
|
78
|
+
@valid
|
79
|
+
end
|
80
|
+
|
81
|
+
def debug(title: nil)
|
82
|
+
log.section_heading(title) if title
|
83
|
+
debug_values if respond_to?(:debug_values)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
</code></pre>
|
89
|
+
|
90
|
+
<div id="output"></div>
|
91
|
+
|
92
|
+
<script type="text/javascript">
|
93
|
+
|
94
|
+
// Define the function
|
95
|
+
// to screenshot the div
|
96
|
+
function takeshot() {
|
97
|
+
let div = document.getElementById('myBlock');
|
98
|
+
html2canvas(div).then(
|
99
|
+
function (canvas) {
|
100
|
+
document
|
101
|
+
.getElementById('output')
|
102
|
+
.appendChild(canvas);
|
103
|
+
})
|
104
|
+
}
|
105
|
+
</script>
|
106
|
+
</body>
|
107
|
+
<script>hljs.highlightAll();</script>
|
108
|
+
|
109
|
+
</html>
|