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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6176970e81e3db9ebf924a9eed9861a31138b43d6db9a29054856abd87e154f
4
- data.tar.gz: 3a367e385bcdc566400ab235bbf291ad58165f03593a5e0f9ab1800df605b697
3
+ metadata.gz: 7f6b9549d2593b6e98df5835223e53620a8d6dc0e872ea9985fda546acf3abad
4
+ data.tar.gz: 4319b4bf7c421b92bfcaec70afd936990093cca86e9e01cc9827b4b80a560d0c
5
5
  SHA512:
6
- metadata.gz: e37cf4cbe1dfd1d7301bab29990c71363970afc6c339991bd0de327cdbd875f2adef1b2802904d0a77ac96c41c7d297f87b7fe61e393645edab294d2936abe57
7
- data.tar.gz: edad3d8c936317fa48d03dbafb4294e8c9d0115700bbedad69d296f735cbff7122e50e501b032a5f2b069851532a22d709388652276c061c4ea60506519b3e68
6
+ metadata.gz: e6448dd25db8864ad3f927e8be3e52d5e89ee4dcc30252837a14d514290dc21dfd2c50f214f08a8ea612fdb8b7b446ccc157263806a4f9f7536a25ad3dafd3bf
7
+ data.tar.gz: f1dfe097db443ef684d8243d169b096ca3d96a783176e54c2434bdf0d84cfb5fc64b481ac371f2dd7aa1520551f16e75cd2b2d9b4408f8f24937b1092549cc26
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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
- def static(output_path: "docs")
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
- Rackula::Command::Top["generate", "--force",
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
- require 'markly'
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 = Markly::HTMLRenderer.new(ids: true, flags: Markly::UNSAFE, **options)
72
+ renderer = Renderer.new(ids: true, flags: Markly::UNSAFE, **options)
73
73
  Trenni::MarkupString.raw(renderer.render(node))
74
74
  end
75
75
 
@@ -68,7 +68,7 @@ module Utopia
68
68
  @document ||= self.readme_document.tap do |document|
69
69
  child = document.first_child
70
70
 
71
- if child.type == :header
71
+ if child&.type == :header
72
72
  @title = child.first_child.string_content
73
73
 
74
74
  @description = child.next
@@ -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
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.17.4"
25
+ VERSION = "0.19.0"
26
26
  end
27
27
  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>