utopia-project 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b291760470f3fac6826c055b7541f19dae489777f8e936dcb5426e236eb458a8
4
- data.tar.gz: '09d320eadae6e0feed0ad04da6f2b6ce0d1be30b7c2571cca96215e27d881a37'
3
+ metadata.gz: c71cf5c142e09f4a14c86c346f006a9208a104a1271627fc63b739c3b409ff32
4
+ data.tar.gz: ed70f4c752e6f955c2a9e4da329b632f0bd86fc9071016f9881dbd68425baefb
5
5
  SHA512:
6
- metadata.gz: 447a3b0cd6dd9323a75e8198265c9cb559a52693d5bb18d774d25071b39e23df5f540daa8194b5a730ce8375b948287adea0cd1b79b196a397fd5e88f79b002b
7
- data.tar.gz: abead9c8e587061805d96ed5f2549ce87f0aacbe5b25d0c62b4389f4a5830015155ca298e769942375fe487102d508e4e3a2cb3537b3bf5dd219c163c146c2b2
6
+ metadata.gz: 2b82b1707d5c3f75d0358443b3ae67e2758d17c73a872c71cb74427a8871992b78ea32154fac1593f7fb5c6c5cdb8a169e165ca0439b68613128dbb311779d13
7
+ data.tar.gz: 0d1dda598ecb0bd12eef2501eddade8b02c06d3880c39eb0c53b6975563c3011470dcf485541a2dda689a35ceb44b903bf5f92c6e756d0a11d6182518714cd6f
@@ -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.16.0"
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,24 @@
1
+ <?r
2
+ repo = ENV['UTOPIA_PROJECT_GISCUS_REPO']
3
+ repo_id = ENV['UTOPIA_PROJECT_GISCUS_REPO_ID']
4
+ category = ENV['UTOPIA_PROJECT_GISCUS_CATEGORY']
5
+ category_id = ENV['UTOPIA_PROJECT_GISCUS_CATEGORY_ID']
6
+
7
+ if repo
8
+ ?>
9
+ <section>
10
+ <h2>Discussion</h2>
11
+ <script src="https://giscus.app/client.js"
12
+ data-repo="#{repo}"
13
+ data-repo-id="#{repo_id}"
14
+ data-category="#{category}"
15
+ data-category-id="#{category_id}"
16
+ data-mapping="title"
17
+ data-reactions-enabled="0"
18
+ data-emit-metadata="0"
19
+ data-theme="preferred_color_scheme"
20
+ crossorigin="anonymous"
21
+ async>
22
+ </script>
23
+ </section>
24
+ <?r end ?>
@@ -0,0 +1,17 @@
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 #{attributes[:class]}">
11
+ <?r pragmas.each do |pragma| ?>
12
+ <li class="pragma #{pragma.directive}" title="#{pragma.text.first}">
13
+ #{pragma.directive}
14
+ </li>
15
+ <?r end ?>
16
+ </ul>
17
+ <?r end ?>
@@ -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,14 @@
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
+ #{partial 'content:pragmas', symbol: symbol, class: 'inline'}
18
+
19
+ <?r if documentation and text = documentation.text ?>
20
+ #{base.format(text.first, symbol)}
21
+ <?r end ?>
18
22
  <?r end ?>
19
23
 
20
24
  <?r if symbol.container?
@@ -14,6 +14,8 @@
14
14
  end
15
15
  ?>
16
16
 
17
+ #{partial 'content:signature', symbol: symbol}
18
+
17
19
  <?r
18
20
  nested = node.children.map{|name, child| base.best(child.values)}.select{|symbol| symbol.container?}
19
21
 
@@ -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
@@ -58,4 +61,6 @@
58
61
  end
59
62
  ?>
60
63
  </section>
64
+
65
+ <content:discuss/>
61
66
  </content:page>
@@ -1,4 +1,6 @@
1
1
 
2
+ * {box-sizing: border-box;}
3
+
2
4
  html {
3
5
  font-family: "PT Sans", Verdana, Helvetica, Arial, sans-serif;
4
6
  font-size: 16px;
@@ -135,6 +137,11 @@ h1, h2, h3, h4, h5, h6, p, pre, ul, dl, ol {
135
137
  margin: 1rem;
136
138
  }
137
139
 
140
+ div.giscus {
141
+ margin: 1rem 0;
142
+ padding: 0 1rem;
143
+ }
144
+
138
145
  pre {
139
146
  margin: 2rem 1rem;
140
147
  }
@@ -259,3 +266,49 @@ table thead {
259
266
  table tr:hover {
260
267
  background-color: var(--header-color);
261
268
  }
269
+
270
+ ul.pragmas {
271
+ margin: 0 1rem;
272
+ padding: 0;
273
+
274
+ font-size: 80%;
275
+ }
276
+
277
+ ul.pragmas.inline {
278
+ display: inline;
279
+ }
280
+
281
+ ul.pragmas li {
282
+ list-style: none;
283
+
284
+ border: 1px solid #ccf;
285
+ border-radius: 0.5em;
286
+
287
+ box-shadow: 0 0 2px #eee;
288
+ padding: 0.1rem 0.2rem;
289
+
290
+ display: inline-block;
291
+ }
292
+
293
+ ul.pragmas li + li {
294
+ margin-left: 0.5rem;
295
+ }
296
+
297
+ ul.pragmas li.public {
298
+ border-color: #8CFF00;
299
+ box-shadow: 0 0 0.3rem #8CFF00;
300
+ color: #8CFF00;
301
+ }
302
+
303
+ ul.pragmas li.private,
304
+ ul.pragmas li.deprecated {
305
+ border-color: #FF8C00;
306
+ box-shadow: 0 0 0.3rem #FF8C00;
307
+ color: #FF8C00;
308
+ }
309
+
310
+ ul.pragmas li.asynchronous {
311
+ border-color: #8C00FF;
312
+ box-shadow: 0 0 0.3rem #8C00FF;
313
+ color: #8C00FF;
314
+ }
data/template/config.ru CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  require 'utopia/setup'
3
- UTOPIA ||= Utopia.setup
3
+ UTOPIA ||= Utopia.setup(Dir.pwd)
4
4
 
5
5
  require 'utopia/project'
6
6
  Utopia::Project.call(self)
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.16.0
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-21 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,8 @@ files:
193
193
  - pages/guides/show.xnode
194
194
  - pages/index.xnode
195
195
  - pages/links.yaml
196
+ - pages/source/_discuss.xnode
197
+ - pages/source/_pragmas.xnode
196
198
  - pages/source/_signature.xnode
197
199
  - pages/source/controller.rb
198
200
  - pages/source/index.xnode
@@ -298,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
300
  - !ruby/object:Gem::Version
299
301
  version: '0'
300
302
  requirements: []
301
- rubygems_version: 3.1.2
303
+ rubygems_version: 3.2.22
302
304
  signing_key:
303
305
  specification_version: 4
304
306
  summary: A project documentation tool based on Utopia.