utopia-project 0.13.3 → 0.15.1

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: 34e228db61065cbfd8205fcec8a3202ad2a4b64bac59e8f062fbc4ebe76d2246
4
- data.tar.gz: a7d2ec47cbdbf9894624c2b8e0d93c2be8e78e3c11d19b7006f4a7e32d51e325
3
+ metadata.gz: 8dc8bef217c1f6cb9b1bddfdee21f9aee1aead739680777a2fd2b6e390da7d35
4
+ data.tar.gz: 735f18991a26b1bf1e6e5ff026c32d5ea2214cf70f67aa277a3f620744edcd23
5
5
  SHA512:
6
- metadata.gz: 9e98670c836c23f840c94a629179a7b6a32a78a3f219f0e1b8d698793b31580c8f01df0e703dcc6f9ff54e5629a5b0531cf4d3628d1f975655b1006a5e6d83a5
7
- data.tar.gz: 75582e4a7298a61092fb960ea9deea912a3bb8be9eeb842ebc7677bce3b1dd62914e82c71c52a534e5180bc20e8417817ad0d1b79acf5143013730451fedb730
6
+ metadata.gz: 065a2ec9f388751d3e1d00f9dfe6cde9c9f12e356fb3722f955a6c150041e91f6bb45db5330065227dfede52c74952b2c680f7910703d1ae75e0d134c25810ea
7
+ data.tar.gz: 0021ffc445f801622d453ec85d7a4ce039163767a88f2fc13568e63aca11373459a14d211d6e6f06360c02a0d3bf2ca84eb549b344918dd942db5e552a37fa77
@@ -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.3"
25
+ VERSION = "0.15.1"
26
26
  end
27
27
  end
@@ -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)};
@@ -6,11 +6,11 @@ jQuery(function() {
6
6
  document.createTextNode("¶")
7
7
  );
8
8
 
9
- anchor.title = element.innerText;
10
9
  anchor.href = "#" + element.id;
11
10
  anchor.className = "self";
12
11
 
13
12
  let heading = element.firstChild;
13
+ anchor.title = heading.innerText;
14
14
 
15
15
  heading.appendChild(
16
16
  document.createTextNode(' ')
@@ -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.3
4
+ version: 0.15.1
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