utopia-project 0.15.2 → 0.15.3

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: b291760470f3fac6826c055b7541f19dae489777f8e936dcb5426e236eb458a8
4
- data.tar.gz: '09d320eadae6e0feed0ad04da6f2b6ce0d1be30b7c2571cca96215e27d881a37'
3
+ metadata.gz: 328a7d6f0c1c504487c9d6bd1819b76c00b43710ab7723599efbe192da2147a1
4
+ data.tar.gz: 7ca0ce6e72b8ee1098b5dfd4e030115a2486da727d2c05c37c0e8183c39ffc2b
5
5
  SHA512:
6
- metadata.gz: 447a3b0cd6dd9323a75e8198265c9cb559a52693d5bb18d774d25071b39e23df5f540daa8194b5a730ce8375b948287adea0cd1b79b196a397fd5e88f79b002b
7
- data.tar.gz: abead9c8e587061805d96ed5f2549ce87f0aacbe5b25d0c62b4389f4a5830015155ca298e769942375fe487102d508e4e3a2cb3537b3bf5dd219c163c146c2b2
6
+ metadata.gz: 23412ec5df8a024bcd82bd9ff383304ba1f1c95ee781e5ec7c166ad96186d1d7b776e74ede14a40dd446a2a8e55f21bf5f90cbc68c406b78c70ad666f470a031
7
+ data.tar.gz: 03abc625c0f905a5e3e438454aa2aea1bdccd8fda1e8407d40ada29fc995fc7fc19b3f28ad07aee672234fab87e5f63bd8113383f3e160ce187cb3eb9f1183a9
@@ -133,7 +133,7 @@ module Utopia
133
133
  # Format the given text in the context of the given definition and language.
134
134
  # See {document} for details.
135
135
  # @returns [Trenni::MarkupString]
136
- def format(text, definition = nil, language: definition&.language)
136
+ def format(text, definition = nil, language: definition&.language, **options)
137
137
  case text
138
138
  when Enumerable
139
139
  text = text.to_a.join("\n")
@@ -143,7 +143,7 @@ module Utopia
143
143
 
144
144
  if document = self.document(text, definition, language: language)
145
145
  return Trenni::MarkupString.raw(
146
- document.to_html
146
+ document.to_html(**options)
147
147
  )
148
148
  end
149
149
  end
@@ -68,8 +68,8 @@ module Utopia
68
68
  end
69
69
  end
70
70
 
71
- def to_html(node = self.root)
72
- renderer = Markly::HTMLRenderer.new(ids: true, flags: Markly::UNSAFE)
71
+ def to_html(node = self.root, **options)
72
+ renderer = Markly::HTMLRenderer.new(ids: true, flags: Markly::UNSAFE, **options)
73
73
  Trenni::MarkupString.raw(renderer.render(node))
74
74
  end
75
75
 
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.15.2"
25
+ VERSION = "0.15.3"
26
26
  end
27
27
  end
data/pages/index.xnode CHANGED
@@ -14,7 +14,11 @@
14
14
  when :image
15
15
  self.document.attributes[:title] ||= title.to_plaintext
16
16
 
17
- ?><h1 style="text-align: center"><img src="#{title.url}" /></h1><?r
17
+ if title.url =~ /\.svg/
18
+ ?><h1 style="text-align: center"><object type="image/svg+xml" data="#{title.url}"></object></h1><?r
19
+ else
20
+ ?><h1 style="text-align: center"><img src="#{title.url}" /></h1><?r
21
+ end
18
22
  else
19
23
  ?><content:heading>Project</content:heading><?r
20
24
  end
@@ -0,0 +1,20 @@
1
+ <?r
2
+ base = self[:base]
3
+
4
+ symbol = attributes[:symbol]
5
+ documentation = symbol.documentation
6
+
7
+ pragmas = documentation&.filter(Decode::Comment::Pragma).to_a
8
+
9
+ if pragmas&.any? ?>
10
+ <ul class="pragmas">
11
+ <?r pragmas.each do |pragma| ?>
12
+ <li class="pragma #{pragma.directive}">
13
+ <span class="directive">#{pragma.directive}</span>
14
+ <?r if text = pragma.text ?>
15
+ <span class="details">#{base.format(text.first, symbol, tight: true)}</span>
16
+ <?r end ?>
17
+ </li>
18
+ <?r end ?>
19
+ </ul>
20
+ <?r end ?>
@@ -10,6 +10,7 @@
10
10
  <dl><?r
11
11
  documentation.traverse do |node, descend|
12
12
  node.each do |child|
13
+ next if child.is_a?(Decode::Comment::Pragma)
13
14
  ?><dt>
14
15
  <strong>#{child.directive}</strong><?r
15
16
  case child
@@ -1,5 +1,5 @@
1
1
  <content:page>
2
- <content:heading>Source</content:heading>
2
+ <content:heading>Overview</content:heading>
3
3
 
4
4
  <?r
5
5
  base = controller[:base]
@@ -11,10 +11,12 @@
11
11
 
12
12
  if documentation = symbol.documentation or symbol.container?
13
13
  ?><li>
14
- <a href="#{base.link_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></a>
15
-
16
- <?r if documentation and text = documentation.text ?>
17
- #{base.format(text.first, symbol)}
14
+ <?r if symbol.container? ?>
15
+ <a href="#{base.link_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></a>
16
+
17
+ <?r if documentation and text = documentation.text ?>
18
+ #{base.format(text.first, symbol)}
19
+ <?r end ?>
18
20
  <?r end ?>
19
21
 
20
22
  <?r if symbol.container?
@@ -6,6 +6,8 @@
6
6
  ?>
7
7
  <content:heading><code class="language-#{symbol.language.name}">#{symbol.qualified_name}</code></content:heading>
8
8
 
9
+ #{partial 'content:pragmas', symbol: symbol}
10
+
9
11
  <?r
10
12
  if document = base.document_for(symbol)
11
13
  ?>#{document.to_html}<?r
@@ -42,6 +44,7 @@
42
44
  ?><section id="#{base.id_for(symbol)}"><h3><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></h3><?r
43
45
 
44
46
  if documentation = symbol.documentation
47
+ ?>#{partial 'content:pragmas', symbol: symbol}<?r
45
48
  ?>#{base.format(documentation.text, symbol)}<?r
46
49
  ?>#{partial 'content:signature', symbol: symbol}<?r
47
50
  end
@@ -259,3 +259,49 @@ table thead {
259
259
  table tr:hover {
260
260
  background-color: var(--header-color);
261
261
  }
262
+
263
+ ul.pragmas {
264
+ margin: 0 1rem;
265
+ padding: 0;
266
+
267
+ font-size: 80%;
268
+ }
269
+
270
+ ul.pragmas .directive {
271
+ font-weight: bold;
272
+ }
273
+
274
+ ul.pragmas li {
275
+ list-style: none;
276
+
277
+ border: 1px solid #ccf;
278
+ border-radius: 0.5em;
279
+
280
+ box-shadow: 0 0 2px #eee;
281
+ padding: 0.1rem 0.2rem;
282
+
283
+ display: inline-block;
284
+ }
285
+
286
+ ul.pragmas li + li {
287
+ margin-left: 0.5rem;
288
+ }
289
+
290
+ ul.pragmas li.public {
291
+ border-color: #8CFF00;
292
+ box-shadow: 0 0 0.3rem #8CFF00;
293
+ color: #8CFF00;
294
+ }
295
+
296
+ ul.pragmas li.private,
297
+ ul.pragmas li.deprecated {
298
+ border-color: #FF8C00;
299
+ box-shadow: 0 0 0.3rem #FF8C00;
300
+ color: #FF8C00;
301
+ }
302
+
303
+ ul.pragmas li.asynchronous {
304
+ border-color: #8C00FF;
305
+ box-shadow: 0 0 0.3rem #8C00FF;
306
+ color: #8C00FF;
307
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia-project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-19 00:00:00.000000000 Z
11
+ date: 2021-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decode
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.13'
19
+ version: '0.17'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.13'
26
+ version: '0.17'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: falcon
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.5'
47
+ version: '0.6'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.5'
54
+ version: '0.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rackula
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +193,7 @@ files:
193
193
  - pages/guides/show.xnode
194
194
  - pages/index.xnode
195
195
  - pages/links.yaml
196
+ - pages/source/_pragmas.xnode
196
197
  - pages/source/_signature.xnode
197
198
  - pages/source/controller.rb
198
199
  - pages/source/index.xnode
@@ -298,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
299
  - !ruby/object:Gem::Version
299
300
  version: '0'
300
301
  requirements: []
301
- rubygems_version: 3.1.2
302
+ rubygems_version: 3.2.22
302
303
  signing_key:
303
304
  specification_version: 4
304
305
  summary: A project documentation tool based on Utopia.