utopia-project 0.13.1 → 0.14.2

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: 77139b780df1db585888cdc74792e30c1321cc30f7bd5c2326c483cc615a775e
4
- data.tar.gz: 9cce22250274ac1fd13c8083925c9ef5d4d19d39d037c9cba0697071f59f0eec
3
+ metadata.gz: '091faad399631568cd9bee652a58957cb4188c13c45052bf6ac5d1c17fb7b88e'
4
+ data.tar.gz: 36ef0df6a0644d7c31ef74d41f4805bd7afc3fa364ca71f8812fe9d8b4d53009
5
5
  SHA512:
6
- metadata.gz: 323bce955baba604915a47db006ea29916a019a0e3ebcf94d026e7a05574cce37fbd989ca3f4679d9a1ff9d14020d71188174b91bc07bc350fa1b11a01dbcb66
7
- data.tar.gz: bb09d35ba6ae4cea234b34db4f3ee3401bd77275037cf4bc2cd35cca95da753d2af588e7e139520425c54f5644225b4b98e6c191934aab7c762bb62d256a48c0
6
+ metadata.gz: 59a0a301570e4828e83c3d76aafa836c2c34a91ed8bb06276e5772221823267b1763c20c779cbe5310d761806a192963433bb98d3dda346628875bf25cdb7855
7
+ data.tar.gz: dc24d777cccf856faae7eaccef615cd042e08faad2b0cfcb55de340d4088efb40b2ed276040b20394ebfca06a83251eefc1e5ccb633e69c96c90f7116a67488d
@@ -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
 
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.13.1"
25
+ VERSION = "0.14.2"
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">
@@ -5,15 +5,17 @@
5
5
 
6
6
  base.guides do |guide|
7
7
  ?>
8
- <h3><a href="#{guide.href}">#{guide.title}</a></h3>
9
-
10
- <?r if documentation = guide.documentation ?>
11
- #{base.format(documentation.text, language: guide.documentation.language)}
12
- <?r elsif description = guide.description ?>
13
- #{MarkupString.raw description.to_html}
14
- <?r else ?>
15
- <p>No description.</p>
16
- <?r end ?>
8
+ <section>
9
+ <h3><a href="#{guide.href}">#{guide.title}</a></h3>
10
+
11
+ <?r if documentation = guide.documentation ?>
12
+ #{base.format(documentation.text, language: guide.documentation.language)}
13
+ <?r elsif description = guide.description ?>
14
+ #{MarkupString.raw description.to_html}
15
+ <?r else ?>
16
+ <p>No description.</p>
17
+ <?r end ?>
18
+ </section>
17
19
  <?r
18
20
  end
19
21
  ?>
@@ -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 {
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.1
4
+ version: 0.14.2
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-05 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