utopia-project 0.17.4 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/utopia/project.rb +15 -2
- data/lib/utopia/project/document.rb +2 -2
- data/lib/utopia/project/guide.rb +1 -1
- data/lib/utopia/project/renderer.rb +46 -0
- data/lib/utopia/project/version.rb +1 -1
- data/pages/_page.xnode +8 -1
- data/public/_components/mermaid/mermaid.min.js +3 -0
- data/public/_components/mermaid/mermaid.min.js.LICENSE.txt +32 -0
- data/public/_static/site.css +5 -0
- data.tar.gz.sig +0 -0
- metadata +13 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f6b9549d2593b6e98df5835223e53620a8d6dc0e872ea9985fda546acf3abad
|
4
|
+
data.tar.gz: 4319b4bf7c421b92bfcaec70afd936990093cca86e9e01cc9827b4b80a560d0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6448dd25db8864ad3f927e8be3e52d5e89ee4dcc30252837a14d514290dc21dfd2c50f214f08a8ea612fdb8b7b446ccc157263806a4f9f7536a25ad3dafd3bf
|
7
|
+
data.tar.gz: f1dfe097db443ef684d8243d169b096ca3d96a783176e54c2434bdf0d84cfb5fc64b481ac371f2dd7aa1520551f16e75cd2b2d9b4408f8f24937b1092549cc26
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/utopia/project.rb
CHANGED
@@ -32,13 +32,26 @@ end
|
|
32
32
|
|
33
33
|
# Generate a static copy of the site.
|
34
34
|
# @parameter output_path [String] The output path for the static site.
|
35
|
-
|
35
|
+
# @parameter force [Boolean] Remove the output directory before generating the static content.
|
36
|
+
def static(output_path: "docs", force: true)
|
36
37
|
require 'rackula/command'
|
37
38
|
|
38
39
|
config_path = File.expand_path("../../template/config.ru", __dir__)
|
39
40
|
public_path = File.expand_path("../../public", __dir__)
|
40
41
|
|
41
|
-
|
42
|
+
arguments = []
|
43
|
+
|
44
|
+
if force
|
45
|
+
arguments << "--force"
|
46
|
+
end
|
47
|
+
|
48
|
+
pp ["generate", *arguments,
|
49
|
+
"--config", config_path,
|
50
|
+
"--public", public_path,
|
51
|
+
"--output-path", output_path
|
52
|
+
]
|
53
|
+
|
54
|
+
Rackula::Command::Top["generate", *arguments,
|
42
55
|
"--config", config_path,
|
43
56
|
"--public", public_path,
|
44
57
|
"--output-path", output_path
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
|
-
|
23
|
+
require_relative 'renderer'
|
24
24
|
|
25
25
|
module Utopia
|
26
26
|
module Project
|
@@ -69,7 +69,7 @@ module Utopia
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def to_html(node = self.root, **options)
|
72
|
-
renderer =
|
72
|
+
renderer = Renderer.new(ids: true, flags: Markly::UNSAFE, **options)
|
73
73
|
Trenni::MarkupString.raw(renderer.render(node))
|
74
74
|
end
|
75
75
|
|
data/lib/utopia/project/guide.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'markly'
|
24
|
+
require 'markly/renderer/html'
|
25
|
+
|
26
|
+
module Utopia
|
27
|
+
module Project
|
28
|
+
class Renderer < Markly::Renderer::HTML
|
29
|
+
def code_block(node)
|
30
|
+
language, _ = node.fence_info.split(/\s+/, 2)
|
31
|
+
|
32
|
+
if language == "mermaid"
|
33
|
+
block do
|
34
|
+
out(
|
35
|
+
"<div#{source_position(node)} class=\"mermaid\">",
|
36
|
+
escape_html(node.string_content),
|
37
|
+
"</div>"
|
38
|
+
)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/pages/_page.xnode
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
<script src="/_components/jquery/jquery.min.js"></script>
|
19
19
|
<script src="/_components/jquery-syntax/jquery.syntax.min.js"></script>
|
20
|
+
<script src="/_components/mermaid/mermaid.min.js"></script>
|
20
21
|
|
21
22
|
<script src="/_static/links.js"></script>
|
22
23
|
|
@@ -25,6 +26,12 @@
|
|
25
26
|
jQuery(function($) {
|
26
27
|
$.syntax();
|
27
28
|
});
|
29
|
+
|
30
|
+
let isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
|
31
|
+
let config = {theme: 'light'};
|
32
|
+
if (isDarkMode) config.theme = 'dark';
|
33
|
+
else config.theme = 'forest';
|
34
|
+
mermaid.initialize(config);
|
28
35
|
//]]>
|
29
36
|
</script>
|
30
37
|
</head>
|
@@ -38,4 +45,4 @@
|
|
38
45
|
<footer>Documentation generated by <a href="https://github.com/socketry/utopia-project">Utopia::Project</a>.</footer>
|
39
46
|
</main>
|
40
47
|
</body>
|
41
|
-
</html>
|
48
|
+
</html>
|