utopia-project 0.13.0 → 0.14.1

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: 8525ca6b514187584429c1bf7c4ac86bd54a1d206ebe36e4c465fbef69982152
4
- data.tar.gz: 308dcc520b52ade7bf5607ea0d9a1228948be22b1e719d3c983583d2fd12ffd0
3
+ metadata.gz: fbdcc336360ff1d15a59373bf8b092e65903e7b08db3f160d8f98552a44b1ad5
4
+ data.tar.gz: e1d4ec64476493cec60ba46c08016f76d0c599d378ceb8de6c4e607605f8bad1
5
5
  SHA512:
6
- metadata.gz: c79be4678eef55bae1ad2bf062ef71b1b66703c77be86184b1e364dddd0775fac48b3e1b4e6963050a5c6605a97199837ecef86baf8b3dbb32ac83cc8cc79f95
7
- data.tar.gz: 66030584f58cc4c58559c8e1b3b0bf5454c75746608c859cd12d5981f46566388d79ad9cb0b86aec00889aa6e5590415836cfd2a93befa3d52574bace168130d
6
+ metadata.gz: 7d1bdeee7c8d2723f794020b4ccde19585d5d391203df95afb5853a778fdf70f4e3cfb6e49500aef612b39535a6f0782184a261647f23df829319f1d1ccc0c85
7
+ data.tar.gz: '087944905a965cbc0acfde35694d27795ee130440d85932e0e89c8e3a763c2829336db85cfc3ac748904045d2d40926b621afdcc894fef31c0ca7111b8cde420'
@@ -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.0"
25
+ VERSION = "0.14.1"
26
26
  end
27
27
  end
@@ -18,9 +18,7 @@
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>
21
+ <script src="/_static/links.js"></script>
24
22
 
25
23
  <script type="text/javascript">
26
24
  //<![CDATA[
@@ -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)};
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.0
4
+ version: 0.14.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-07-31 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