utopia-project 0.13.2 → 0.15.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: 9b83c86ddbb179ac1beb687c520072f224acccbd6b7468bf6af824d399e64e3b
4
- data.tar.gz: 4a31742a497d000523c991ddaaabdd8abe28ceb990f72a7721c3fc8aa833f9c2
3
+ metadata.gz: c0e365f1d79016583ca1eca558712eb3e314953bc74bd6404a399628972b3168
4
+ data.tar.gz: a06103edc45d87120f2c531252f5399884eee051efb7f7b0b7fd6edac4de4d90
5
5
  SHA512:
6
- metadata.gz: bd88c7262337a9895c038cb32b156b8350321c7e75956dc7c95d3fa1bb884792480e76873d3a55c7c2c937a6b416545c5c34f39ab4a42a5f82660b276e68901b
7
- data.tar.gz: 526fd60db6623cb5b44268f0ae4595b5d7ae3030134709bdf7b2ef6412a4f41e2183615a5879f046a79ed155d36cafb386e8c486fce510f0ade571bbb021fc32
6
+ metadata.gz: bb1887c856a24b2360c1101b1c377eff4c15d7bb3322f8318057815a3ff056c712427a2c70164337987905b58b0bdcaad134cdad4c44ef3baedca4be0fcba85e
7
+ data.tar.gz: 00a55cfb9f18fd62e3e178c3fb183375d5640eedcac3f204957f6582b84a07875b458c8022ebe3bfde8ead2d9791a2905eae8fa6f2554e8d938378ad501e7f20
@@ -0,0 +1,7 @@
1
+ # Utopia::Project::Base
2
+
3
+ Provides structured access to a project directory which contains source code and guides.
4
+
5
+ ## Usage
6
+
7
+ To get an instance for the current project, use {Base#instance}.
@@ -106,6 +106,20 @@ module Utopia
106
106
  end
107
107
  end
108
108
 
109
+ def document_for(definition)
110
+ document_path = File.join("lib", definition.lexical_path.map{|_| _.to_s.downcase}) + ".md"
111
+
112
+ if File.exist?(document_path)
113
+ document = self.document(File.read(document_path), definition)
114
+
115
+ if document.first_child.type == :header
116
+ document.first_child.delete
117
+ end
118
+
119
+ return document
120
+ end
121
+ end
122
+
109
123
  def linkify(text, definition, language: definition&.language)
110
124
  rewriter = Linkify.new(self, language, text)
111
125
 
@@ -37,7 +37,7 @@ module Utopia
37
37
  end
38
38
 
39
39
  def root
40
- @root ||= resolve(Markly.parse(@text))
40
+ @root ||= resolve(Markly.parse(@text, extensions: [:table]))
41
41
  end
42
42
 
43
43
  def first_child
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.13.2"
25
+ VERSION = "0.15.0"
26
26
  end
27
27
  end
@@ -18,7 +18,6 @@
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
21
  <script src="/_static/links.js"></script>
23
22
 
24
23
  <script type="text/javascript">
@@ -12,7 +12,9 @@
12
12
  when :text
13
13
  ?><content:heading>#{title.string_content}</content:heading><?r
14
14
  when :image
15
- ?><header><img src="#{title.url}" /></header><?r
15
+ self.document.attributes[:title] ||= title.to_plaintext
16
+
17
+ ?><h1><img src="#{title.url}" /></h1><?r
16
18
  else
17
19
  ?><content:heading>Project</content:heading><?r
18
20
  end
@@ -7,7 +7,9 @@
7
7
  <content:heading><code class="language-#{symbol.language.name}">#{symbol.qualified_name}</code></content:heading>
8
8
 
9
9
  <?r
10
- if documentation = symbol.documentation
10
+ if document = base.document_for(symbol)
11
+ ?>#{document.to_html}<?r
12
+ elsif documentation = symbol.documentation
11
13
  ?>#{base.format(documentation.text.join("\n"), symbol)}<?r
12
14
  end
13
15
  ?>
@@ -16,3 +16,20 @@
16
16
  color: #666;
17
17
  background-color: #ddd;
18
18
  border-radius: 0.5em; }
19
+
20
+ @media (prefers-color-scheme: dark) {
21
+ .syntax-theme-base .xml .cdata-content {
22
+ color: #a46; }
23
+ .syntax-theme-base .xml .xml-tag, .syntax-theme-base .xml .cdata {
24
+ color: #c59de7; }
25
+ .syntax-theme-base .xml .tag-name, .syntax-theme-base .xml .cdata-tag {
26
+ color: #9ae; }
27
+ .syntax-theme-base .xml .namespace {
28
+ color: #c59de7; }
29
+ .syntax-theme-base .xml .attribute {
30
+ color: #c59de7; }
31
+ .syntax-theme-base .xml .instruction {
32
+ color: #c59de7; }
33
+ .syntax-theme-base .xml .entity, .syntax-theme-base .xml .percent-escape {
34
+ color: #999;
35
+ background-color: #333; } }
@@ -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,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};
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};
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)};
@@ -48,7 +48,7 @@ html {
48
48
  --main-color: #111;
49
49
  --main-background-color: #fff;
50
50
 
51
- --header-color: #bed1f0;
51
+ --header-color: #dfebff;
52
52
  --underlay-color: #ddd;
53
53
 
54
54
  --accent-color: #1a73e8;
@@ -131,7 +131,10 @@ footer {
131
131
 
132
132
  h1, h2, h3, h4, h5, h6, p, pre, ul, dl, ol {
133
133
  margin: 1rem;
134
- border-radius: 0.5rem;
134
+ }
135
+
136
+ pre {
137
+ margin: 2rem 1rem;
135
138
  }
136
139
 
137
140
  h1 span {
@@ -237,3 +240,20 @@ figure.youtube-wrapper iframe {
237
240
  height: 100%;
238
241
  border: 0;
239
242
  }
243
+
244
+ table {
245
+ width: 100%;
246
+ margin: 1rem;
247
+
248
+ border-collapse: collapse;
249
+ width: calc(100% - 2rem);
250
+ }
251
+
252
+ table thead {
253
+ background-color: var(--header-color);
254
+ border-bottom: 0.2rem solid var(--accent-color);
255
+ }
256
+
257
+ table tr:hover {
258
+ background-color: var(--header-color);
259
+ }
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.13.2
4
+ version: 0.15.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-19 00:00:00.000000000 Z
11
+ date: 2020-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: utopia
@@ -187,6 +187,7 @@ extra_rdoc_files: []
187
187
  files:
188
188
  - bake/utopia/project.rb
189
189
  - lib/utopia/project.rb
190
+ - lib/utopia/project/base.md
190
191
  - lib/utopia/project/base.rb
191
192
  - lib/utopia/project/document.rb
192
193
  - lib/utopia/project/guide.rb