utopia-project 0.12.1 → 0.13.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: 39960cd4d35df4f08a2e1ab9a0b05922ac5c1f87bc804ed9afe891990c443ff3
4
- data.tar.gz: 23b4188efee931c098f9738a9b4661cc78116094310c9c066eb8a9a69fbde59a
3
+ metadata.gz: 8525ca6b514187584429c1bf7c4ac86bd54a1d206ebe36e4c465fbef69982152
4
+ data.tar.gz: 308dcc520b52ade7bf5607ea0d9a1228948be22b1e719d3c983583d2fd12ffd0
5
5
  SHA512:
6
- metadata.gz: dc1dae771497973a1252739784458e712cd3018fd9b8b25435fa745dc4463ee5130df98190fd4c8d3a4c2c8a04e0ec6f2cb92f87952f5d4d8969eac6679d5084
7
- data.tar.gz: ef69eba830a027c47a53f167afcbb03926da5e5a9dc5742db87e8d9d6ee2190626a103786778881e675276e1457f899feb9d22cbaf1ab91ec10033d7ff7299f1
6
+ metadata.gz: c79be4678eef55bae1ad2bf062ef71b1b66703c77be86184b1e364dddd0775fac48b3e1b4e6963050a5c6605a97199837ecef86baf8b3dbb32ac83cc8cc79f95
7
+ data.tar.gz: 66030584f58cc4c58559c8e1b3b0bf5454c75746608c859cd12d5981f46566388d79ad9cb0b86aec00889aa6e5590415836cfd2a93befa3d52574bace168130d
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.12.1"
25
+ VERSION = "0.13.0"
26
26
  end
27
27
  end
@@ -0,0 +1,23 @@
1
+ <header><label for="toggle">☰</label> <?r
2
+ page_path = first.node.uri_path.dirname
3
+
4
+ Utopia::Path[page_path].descend do |path|
5
+ unless path.last
6
+ path = path + "index"
7
+ end
8
+
9
+ if link = links(path.dirname, name: path.last, locale: localization.current_locale, indices: true).first
10
+ ?> &rsaquo; #{link.to_href}<?r
11
+ else
12
+ ?> &rsaquo; <span>#{path.last}</span><?r
13
+ end
14
+ end
15
+
16
+ if localization.localized?
17
+ ?> &bull; (<?r
18
+ localization.all_locales.each.with_index do |locale, index|
19
+ ?>#{index.zero? ? '' : ' '}<a href="#{localization.localized_path(page_path, locale)}">#{locale}</a><?r
20
+ end
21
+ ?>)<?r
22
+ end
23
+ ?></header>
@@ -1,23 +1,19 @@
1
- <nav><?r
2
- page_path = first.node.uri_path
1
+ <nav>
2
+ <template id="search-result">
3
+ <li>
4
+ <a href="link">Title</a>
5
+ <div class="preview">Overview</div>
6
+ </li>
7
+ </template>
3
8
 
4
- Utopia::Path[page_path.dirname].descend do |path|
5
- unless path.last
6
- path = path + "index"
7
- end
9
+ <section style="margin: 1rem;">
10
+ <input type="search" id="search-input" tabindex="0" placeholder="Search..." aria-label="Search..." autocomplete="off" style="width: 100%;"/>
8
11
 
9
- if link = links(path.dirname, name: path.last, locale: localization.current_locale, indices: true).first
10
- ?> &rsaquo; #{link.to_href}<?r
11
- else
12
- ?> &rsaquo; <span>#{path.last}</span><?r
13
- end
14
- end
15
-
16
- if localization.localized?
17
- ?> &bull; (<?r
18
- localization.all_locales.each.with_index do |locale, index|
19
- ?>#{index.zero? ? '' : ' '}<a href="#{localization.localized_path(page_path, locale)}">#{locale}</a><?r
20
- end
21
- ?>)<?r
22
- end
23
- ?></nav>
12
+ <ul id="search-results" class="search-results">
13
+ <li>
14
+ <a href="link">Title</a>
15
+ <div class="preview">Overview</div>
16
+ </li>
17
+ </ul>
18
+ </section>
19
+ </nav>
@@ -18,6 +18,10 @@
18
18
  <script src="/_components/jquery/jquery.min.js"></script>
19
19
  <script src="/_components/jquery-syntax/jquery.syntax.min.js"></script>
20
20
 
21
+ <script src="/_components/lunr/lunr.min.js"></script>
22
+ <script src="/_static/links.js?#{rand}"></script>
23
+ <script src="/_static/search.js?#{rand}"></script>
24
+
21
25
  <script type="text/javascript">
22
26
  //<![CDATA[
23
27
  jQuery(function($) {
@@ -27,11 +31,13 @@
27
31
  </script>
28
32
  </head>
29
33
 
30
- <body class="#{attributes[:class]}">
31
- <content:navigation />
32
-
33
- <utopia:content/>
34
+ <body>
35
+ <content:header />
34
36
 
35
- <footer>Documentation generated by <a href="https://github.com/socketry/utopia-project">Utopia::Project</a>.</footer>
37
+ <main>
38
+ <utopia:content/>
39
+
40
+ <footer>Documentation generated by <a href="https://github.com/socketry/utopia-project">Utopia::Project</a>.</footer>
41
+ </main>
36
42
  </body>
37
43
  </html>
@@ -4,14 +4,13 @@
4
4
  ?>
5
5
  <content:heading>Guides</content:heading>
6
6
 
7
- <main>
8
- <ul>
7
+ <ul>
9
8
  <?r
10
9
  base = controller[:base]
11
10
 
12
11
  base.guides do |guide|
13
12
  ?><li><a href="#{guide.name}/">#{guide.title}</a></li><?r
14
13
  end
15
- ?></ul>
16
- </main>
14
+ ?>
15
+ </ul>
17
16
  </content:page>
@@ -5,9 +5,9 @@
5
5
  ?>
6
6
  <content:heading>#{guide.title}</content:heading>
7
7
 
8
- <main><?r
8
+ <?r
9
9
  if document = guide.document
10
- ?>#{MarkupString.raw document.to_html}<?r
10
+ ?>#{document.to_html}<?r
11
11
  end
12
12
 
13
13
  guide.sources.each do |source|
@@ -20,5 +20,5 @@
20
20
  ?><pre><code class="language-#{source.language.name}">#{segment.code}</code></pre><?r
21
21
  end
22
22
  end
23
- ?></main>
23
+ ?>
24
24
  </content:page>
@@ -20,12 +20,12 @@
20
20
  ?><content:heading>Project</content:heading><?r
21
21
  end
22
22
 
23
- ?><main>#{MarkupString.raw document.to_html}</main><?r
23
+ ?>#{MarkupString.raw document.to_html}<?r
24
24
  else
25
25
  ?>
26
26
  <content:heading>Project</content:heading>
27
27
 
28
- <main><p>This project does not have a README.md file.</p></main>
28
+ <p>This project does not have a README.md file.</p>
29
29
  <?r
30
30
  end
31
31
  ?>
@@ -1,36 +1,34 @@
1
1
  <content:page>
2
2
  <content:heading>Source</content:heading>
3
3
 
4
- <main>
5
- <?r
6
- base = controller[:base]
7
- index = base.index
8
-
9
- index.trie.traverse do |path, node, descend|
10
- if symbols = node.values
11
- symbol = base.best(symbols)
12
-
13
- if documentation = symbol.documentation or symbol.container?
14
- ?><li>
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 ?>
20
-
21
- <?r if symbol.container?
22
- ?><ul class="index"><?r
23
- descend.call
24
- ?></ul><?r
25
- end ?>
26
- </li><?r
27
- end
28
- else
29
- ?><ul class="index"><?r
30
- descend.call
31
- ?></ul><?r
4
+ <?r
5
+ base = controller[:base]
6
+ index = base.index
7
+
8
+ index.trie.traverse do |path, node, descend|
9
+ if symbols = node.values
10
+ symbol = base.best(symbols)
11
+
12
+ if documentation = symbol.documentation or symbol.container?
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)}
18
+ <?r end ?>
19
+
20
+ <?r if symbol.container?
21
+ ?><ul class="index"><?r
22
+ descend.call
23
+ ?></ul><?r
24
+ end ?>
25
+ </li><?r
32
26
  end
27
+ else
28
+ ?><ul class="index"><?r
29
+ descend.call
30
+ ?></ul><?r
33
31
  end
34
- ?>
35
- </main>
32
+ end
33
+ ?>
36
34
  </content:page>
@@ -6,51 +6,54 @@
6
6
  ?>
7
7
  <content:heading><code class="language-#{symbol.language.name}">#{symbol.qualified_name}</code></content:heading>
8
8
 
9
- <main>
10
- <?r
11
- if documentation = symbol.documentation
12
- ?>#{base.format(documentation.text.join("\n"), symbol)}<?r
13
- end
14
- ?>
15
-
16
- <?r
17
- nested = node.children.map{|name, child| base.best(child.values)}.select{|symbol| symbol.container?}
18
-
19
- if nested.any?
20
- ?>
21
- <h2>Nested</h2>
22
-
23
- <ul>
24
- <?r nested.each do |symbol| ?>
25
- <li><a href="#{base.link_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.qualified_name}</code></a></li>
26
- <?r end ?>
27
- </ul>
28
- <?r
29
- end
30
- ?>
31
-
32
- <h2>Definitions</h2>
33
-
34
- <?r
35
- node.children.each do |name, child|
36
- child.values.each do |symbol|
37
- if symbol.documentation and !symbol.container?
38
- ?><h3 id="#{base.id_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></h3><?r
39
-
40
- if documentation = symbol.documentation
41
- ?>#{base.format(documentation.text, symbol)}<?r
42
- ?>#{partial 'content:signature', symbol: symbol}<?r
43
- end
44
-
45
- if symbol.multiline?
46
- ?><details>
47
- <summary><h4>Implementation</h4></summary>
48
- <pre><code class="language-#{symbol.language.name}">#{symbol.text}</code></pre>
49
- </details><?r
50
- end
9
+ <?r
10
+ if documentation = symbol.documentation
11
+ ?>#{base.format(documentation.text.join("\n"), symbol)}<?r
12
+ end
13
+ ?>
14
+
15
+ <?r
16
+ nested = node.children.map{|name, child| base.best(child.values)}.select{|symbol| symbol.container?}
17
+
18
+ if nested.any?
19
+ ?>
20
+ <section>
21
+ <h2>Nested</h2>
22
+
23
+ <ul>
24
+ <?r nested.each do |symbol| ?>
25
+ <li><a href="#{base.link_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.qualified_name}</code></a></li>
26
+ <?r end ?>
27
+ </ul>
28
+ </section>
29
+ <?r
30
+ end
31
+ ?>
32
+
33
+ <section>
34
+ <h2>Definitions</h2>
35
+
36
+ <?r
37
+ node.children.each do |name, child|
38
+ child.values.each do |symbol|
39
+ if symbol.documentation and !symbol.container?
40
+ ?><section id="#{base.id_for(symbol)}"><h3><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></h3><?r
41
+
42
+ if documentation = symbol.documentation
43
+ ?>#{base.format(documentation.text, symbol)}<?r
44
+ ?>#{partial 'content:signature', symbol: symbol}<?r
51
45
  end
46
+
47
+ if symbol.multiline?
48
+ ?><details>
49
+ <summary><h4>Implementation</h4></summary>
50
+ <pre><code class="language-#{symbol.language.name}">#{symbol.text}</code></pre>
51
+ </details><?r
52
+ end
53
+ ?></section><?r
52
54
  end
53
55
  end
54
- ?>
55
- </main>
56
+ end
57
+ ?>
58
+ </section>
56
59
  </content:page>
@@ -9,8 +9,8 @@ Syntax.lib.camelCaseType={pattern:/\b_*[A-Z][\w]*\b/g,klass:"type"};Syntax.lib.c
9
9
  Syntax.lib.doubleQuotedString={pattern:/"([^\\"\n]|\\.)*"/g,klass:"string"};Syntax.lib.singleQuotedString={pattern:/'([^\\'\n]|\\.)*'/g,klass:"string"};Syntax.lib.multiLineDoubleQuotedString={pattern:/"([^\\"]|\\.)*"/g,klass:"string"};Syntax.lib.multiLineSingleQuotedString={pattern:/'([^\\']|\\.)*'/g,klass:"string"};Syntax.lib.stringEscape={pattern:/\\./g,klass:"escape",only:["string"]};
10
10
  Syntax.Match=function(b,a,c,d){this.offset=b;this.endOffset=b+a;this.length=a;this.expression=c;this.value=d;this.children=[];this.next=this.parent=null};Syntax.Match.prototype.shift=function(b,a){this.adjust(b,null,a);for(var c=0;c<this.children.length;c++)this.children[c].shift(b,a)};Syntax.Match.prototype.adjust=function(b,a,c){this.offset+=b;this.endOffset+=b;a&&(this.length=a,this.endOffset=this.offset+a);c&&(this.value=c.substr(this.offset,this.length))};
11
11
  Syntax.Match.sort=function(b,a){return b.offset-a.offset||a.length-b.length};Syntax.Match.prototype.contains=function(b){return b.offset>=this.offset&&b.endOffset<=this.endOffset};Syntax.Match.defaultReduceCallback=function(b,a){"string"===typeof b&&(b=document.createTextNode(b));a.appendChild(b)};
12
- Syntax.Match.prototype.reduce=function(b,a){var c=this.offset;var d=this.expression&&this.expression.element?this.expression.element.cloneNode(!1):document.createElement("span");b=b||Syntax.Match.defaultReduceCallback;this.expression&&this.expression.klass&&(0<d.className.length&&(d.className+=" "),d.className+=this.expression.klass);this.className&&(d.className+=" ",d.className+=this.className);for(var e=0;e<this.children.length;e+=1){var f=this.children[e],g=f.offset;f.offset<this.offset&&console.log("Syntax Warning: Offset of child",
13
- f,"is before offset of parent",this);c=this.value.substr(c-this.offset,g-c);b(c,d);b(f.reduce(b,a),d);c=f.endOffset}c===this.offset?b(this.value,d):c<this.endOffset?b(this.value.substr(c-this.offset,this.endOffset-c),d):c>this.endOffset&&console.log("Syntax Warning: Start position "+c+" exceeds end of value "+this.endOffset);a&&(d=a(d,this));return d};
12
+ Syntax.Match.prototype.reduce=function(b,a){var c=this.offset,d=document.createElement("span");b=b||Syntax.Match.defaultReduceCallback;this.expression&&this.expression.klass&&(0<d.className.length&&(d.className+=" "),d.className+=this.expression.klass);this.className&&(d.className+=" ",d.className+=this.className);for(var e=0;e<this.children.length;e+=1){var f=this.children[e],g=f.offset;f.offset<this.offset&&console.log("Syntax Warning: Offset of child",f,"is before offset of parent",this);c=this.value.substr(c-
13
+ this.offset,g-c);b(c,d);b(f.reduce(b,a),d);c=f.endOffset}c===this.offset?b(this.value,d):c<this.endOffset?b(this.value.substr(c-this.offset,this.endOffset-c),d):c>this.endOffset&&console.log("Syntax Warning: Start position "+c+" exceeds end of value "+this.endOffset);a&&(d=a(d,this));return d};
14
14
  Syntax.Match.prototype.canContain=function(b){return b.expression.force?!0:this.complete?!1:b.expression.only?!0:"undefined"===typeof this.expression.allow||jQuery.isArray(this.expression.disallow)&&-1!==jQuery.inArray(b.expression.klass,this.expression.disallow)?!1:"*"===this.expression.allow||jQuery.isArray(this.expression.allow)&&-1!==jQuery.inArray(b.expression.klass,this.expression.allow)?!0:!1};
15
15
  Syntax.Match.prototype.canHaveChild=function(b){if(b=b.expression.only){for(var a=this;null!==a;){if(-1!==jQuery.inArray(a.expression.klass,b))return!0;if((a=a.parent)&&a.complete)break}return!1}return!0};Syntax.Match.prototype._splice=function(b,a){return this.canHaveChild(a)?(this.children.splice(b,0,a),a.parent=this,a.expression.owner||(a.expression.owner=this.expression.owner),this):null};
16
16
  Syntax.Match.prototype.insert=function(b,a){if(!this.contains(b))return null;if(a){a=this;for(var c=0;c<a.children.length;)a.children[c].contains(b)?(a=a.children[c],c=0):c+=1;return a._insertWhole(b)}return this._insert(b)};
@@ -0,0 +1,21 @@
1
+ jQuery(function() {
2
+ $.each($('section[id]'), function(index, element) {
3
+ let anchor = document.createElement('a');
4
+
5
+ anchor.appendChild(
6
+ document.createTextNode("¶")
7
+ );
8
+
9
+ anchor.title = element.innerText;
10
+ anchor.href = "#" + element.id;
11
+ anchor.className = "self";
12
+
13
+ let heading = element.firstChild;
14
+
15
+ heading.appendChild(
16
+ document.createTextNode(' ')
17
+ );
18
+
19
+ heading.appendChild(anchor);
20
+ });
21
+ });
@@ -33,6 +33,10 @@ p code:first-child, p code:last-child {
33
33
  padding: 0;
34
34
  }
35
35
 
36
+ p img {
37
+ max-width: 100%;
38
+ }
39
+
36
40
  pre {
37
41
  /* -moz-tab-size is still required by Firefox */
38
42
  --tab-size: 2;
@@ -80,17 +84,54 @@ html {
80
84
  body {
81
85
  margin: 0;
82
86
  padding: 0;
87
+ }
88
+
89
+ header {
90
+ padding: 0.5rem;
91
+
92
+ background-color: var(--header-color);
93
+ border-bottom: 0.2rem solid var(--accent-color);
94
+ }
95
+
96
+ main {
97
+ scroll-margin-top: 2rem;
83
98
 
84
99
  /* Force the element to contain margins */
85
100
  display: flow-root;
86
- min-height: 100vh;
87
-
88
- max-width: 48rem;
101
+
89
102
  margin: 0 auto;
103
+ max-width: 48rem;
104
+ }
105
+
106
+ :target {
107
+ background-color: var(--header-color);
108
+ }
109
+
110
+ section {
111
+ border-radius: 1rem;
112
+ padding: 0.1rem 0;
113
+ }
114
+
115
+ main > section {
116
+ border-radius: 1rem;
117
+ margin: 4rem 0;
118
+ }
119
+
120
+ section > section {
121
+ margin: 1rem 0;
122
+ }
123
+
124
+ footer {
125
+ text-align: right;
126
+ font-size: 0.8rem;
127
+
128
+ padding: 1rem;
129
+ margin-top: 5rem;
90
130
  }
91
131
 
92
- header, h1, h2, h3, h4, h5, h6, p, pre, ul, dl, ol {
132
+ h1, h2, h3, h4, h5, h6, p, pre, ul, dl, ol {
93
133
  margin: 1rem;
134
+ border-radius: 0.5rem;
94
135
  }
95
136
 
96
137
  h1 span {
@@ -101,12 +142,6 @@ header img {
101
142
  max-height: 50vh;
102
143
  }
103
144
 
104
- nav {
105
- margin: 1rem;
106
- font-size: 0.8rem;
107
- color: #aaa;
108
- }
109
-
110
145
  li, dt, dd {
111
146
  margin: 0.5rem 0;
112
147
  }
@@ -129,18 +164,6 @@ h1 {
129
164
  margin-bottom: 4rem;
130
165
  }
131
166
 
132
- h2 {
133
- margin-top: 6rem;
134
- }
135
-
136
- h3 {
137
- margin-top: 4rem;
138
- }
139
-
140
- h4, h5, h6 {
141
- margin-top: 2rem;
142
- }
143
-
144
167
  img {
145
168
  border: none;
146
169
  }
@@ -150,6 +173,14 @@ a {
150
173
  text-decoration: none;
151
174
  }
152
175
 
176
+ a.self {
177
+ visibility: hidden;
178
+ }
179
+
180
+ *:hover > a.self {
181
+ visibility: visible;
182
+ }
183
+
153
184
  a:hover {
154
185
  color: var(--accent-hover-color);
155
186
  }
@@ -158,14 +189,6 @@ pre {
158
189
  overflow: auto;
159
190
  }
160
191
 
161
- footer {
162
- text-align: right;
163
- font-size: 0.8rem;
164
-
165
- margin: 1rem;
166
- margin-top: 5rem;
167
- }
168
-
169
192
  details {
170
193
  margin: 1rem;
171
194
  border: 1px solid #aaa;
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.12.1
4
+ version: 0.13.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-07-07 00:00:00.000000000 Z
11
+ date: 2020-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: utopia
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.3'
33
+ version: '0.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.3'
40
+ version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decode
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +192,7 @@ files:
192
192
  - lib/utopia/project/guide.rb
193
193
  - lib/utopia/project/linkify.rb
194
194
  - lib/utopia/project/version.rb
195
+ - pages/_header.xnode
195
196
  - pages/_heading.xnode
196
197
  - pages/_navigation.xnode
197
198
  - pages/_page.xnode
@@ -284,6 +285,7 @@ files:
284
285
  - public/_components/jquery/jquery.slim.min.js
285
286
  - public/_components/jquery/jquery.slim.min.map
286
287
  - public/_static/icon.png
288
+ - public/_static/links.js
287
289
  - public/_static/site.css
288
290
  - template/Gemfile
289
291
  - template/config.ru