utopia-project 0.17.2 → 0.18.1

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: 13dcaedbe87eadb28fcf370e994c7ffd437f3e8fca3e2d15f7e897308287bc73
4
- data.tar.gz: 6862aa1a83b3992ef595862fc4eabbecb85059fcb0adb951fddf690048a039a7
3
+ metadata.gz: 4d59b43aec217ee84beb050d7d6e151d46aa441cbee39b73b9e664fdf773432f
4
+ data.tar.gz: 4e76c51906d87652a1f0e8242ef4ae8bc28994ff2e6330e5269f8c1a4387dcd5
5
5
  SHA512:
6
- metadata.gz: a8644039ddaca927d7861e32174b007c02361ba58fabadd293ae0c6239301b5e9102a0c2917cef4cc3f868541a1f04f93342272a09e543375a33ea74c7bb88c5
7
- data.tar.gz: c9a6a4fa69158fa61cc8e01fbd855fb98a752e129deb838e5ade864ec3012c7d15219e276a4dd3bf297d063fba5478c980e67fd9278d9ec71a367b1fc93d57fd
6
+ metadata.gz: e849c822aed4c2591a1116bc4ed36d45c3ede9836b51b1cf2e42fbba2fddf4a79227991dfceb73b9d3810b1ca347402bc7966f4134634a2fdd7840c9c7d9f49c
7
+ data.tar.gz: 06fb199a979a521f6ea11ddc419aeaf616e82d478019122b3fe41fcc6a8de68a6991d688499381b0fda0c30861faf07860c764f9075f19cf4b67760f51b5637a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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
 
@@ -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.2"
25
+ VERSION = "0.18.1"
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>
@@ -9,9 +9,9 @@ pragmas = documentation&.filter(Decode::Comment::Pragma).to_a
9
9
  if pragmas&.any? ?>
10
10
  <ul class="pragmas #{attributes[:class]}">
11
11
  <?r pragmas.each do |pragma| ?>
12
- <li class="pragma #{pragma.directive}" title="#{pragma.text.first}">
12
+ <li class="pragma #{pragma.directive}" title="#{pragma.text&.first}">
13
13
  #{pragma.directive}
14
14
  </li>
15
15
  <?r end ?>
16
16
  </ul>
17
- <?r end ?>
17
+ <?r end ?>
@@ -9,8 +9,8 @@
9
9
  <?r
10
10
  if document = base.document_for(symbol)
11
11
  ?>#{document.to_html}<?r
12
- elsif documentation = symbol.documentation
13
- ?>#{base.format(documentation.text.join("\n"), symbol)}<?r
12
+ elsif text = symbol.documentation&.text
13
+ ?>#{base.format(text.join("\n"), symbol)}<?r
14
14
  end
15
15
  ?>
16
16
 
@@ -63,4 +63,4 @@
63
63
  </section>
64
64
 
65
65
  <content:discuss/>
66
- </content:page>
66
+ </content:page>
data/public/.DS_Store ADDED
Binary file
Binary file