utopia-project 0.6.2 → 0.7.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: e2f3f6b2768ba6df0776d91d43bfac90d9c19f28a0d45292e4733174ab032c8d
4
- data.tar.gz: ac2f58975b03909a892c537e09cf6f4cea594d57111dbd3eabeb79440c4082fe
3
+ metadata.gz: 2a926206a323a14c9bdce2078971b6fbfb594efa217edd10c4667bea84b0d8a1
4
+ data.tar.gz: 2d19b86b00a9535d4db4b46e0960cdad33f2c7b181d8556dc844d42a8457b551
5
5
  SHA512:
6
- metadata.gz: 20c2c5633566b13eeaaa751dddf625ac90b1db577657d18a4600c34eeee9d00ba387f2037d0c325352486933abcb29bdbdcfe92e54522ef89947a56693ddd6c4
7
- data.tar.gz: e4f6fef8e60be8fddd21484fe86b0c729af66fd1541929615ae90872c91975b36ad126b9a1bf6389797bbea99f647a3de83c49ba66475f8a9a872dd34027687c
6
+ metadata.gz: 19d52ab955df5cd9dc015094828b75f7ec023693c1f207893edefaf962d4bf914a45edc5374f49b352aa1920b2ed3ee4af20c0153b69ef0d15faf808a30e19f6
7
+ data.tar.gz: 493aa1b337ca8b4406913c4edb4d27b9ea69d33bca1149f2a9e3bc850e40ff3256754ccbd2802af66ecc8fe15a122c34beeaa38035e09d6c163d4a4dd2a5c5c9
@@ -107,29 +107,37 @@ module Utopia
107
107
  return nil
108
108
  end
109
109
 
110
- if language
111
- text = text&.gsub(/{(.*?)}/) do |match|
112
- linkify($1, symbol, language: language)
113
- end
110
+ if document = self.document(text, symbol, language: language)
111
+ return Trenni::MarkupString.raw(
112
+ document.to_html
113
+ )
114
+ end
115
+ end
116
+
117
+ def document(text, symbol = nil, language: symbol&.language)
118
+ text = text&.gsub(/{(.*?)}/) do |match|
119
+ linkify($1, symbol, language: language)
114
120
  end
115
121
 
116
- return Trenni::MarkupString.raw(
117
- Kramdown::Document.new(text, syntax_highlighter: nil).to_html
118
- )
122
+ return Kramdown::Document.new(text, syntax_highlighter: nil)
119
123
  end
120
124
 
121
125
  def linkify(text, symbol = nil, language: symbol&.language)
122
- reference = language.reference(text)
126
+ reference = @index.languages.parse_reference(text, default_language: language)
123
127
 
124
128
  Trenni::Builder.fragment do |builder|
125
- if definition = @index.lookup(reference, relative_to: symbol)&.first
129
+ if reference and definition = @index.lookup(reference, relative_to: symbol)&.first
126
130
  builder.inline('a', href: link_for(definition)) do
127
131
  builder.inline('code', class: "language-#{definition.language.name}") do
128
132
  builder.text definition.short_form
129
133
  end
130
134
  end
135
+ elsif reference
136
+ builder.inline('code', class: "language-#{reference.language.name}") do
137
+ builder.text text
138
+ end
131
139
  else
132
- builder.inline('code', class: "language-#{symbol.language.name}") do
140
+ builder.inline('code') do
133
141
  builder.text text
134
142
  end
135
143
  end
@@ -59,9 +59,15 @@ module Utopia
59
59
  File.exist?(readme_path)
60
60
  end
61
61
 
62
+ def readme_document
63
+ content = File.read(self.readme_path)
64
+
65
+ return @base.document(content)
66
+ end
67
+
62
68
  def document
63
69
  if self.readme?
64
- @document ||= Kramdown::Document.new(File.read(self.readme_path), syntax_highlighter: nil).tap do |document|
70
+ @document ||= self.readme_document.tap do |document|
65
71
  root = document.root
66
72
  if element = root.children.first
67
73
  if element.type == :header
@@ -112,7 +118,7 @@ module Utopia
112
118
  return to_enum(:sources) unless block_given?
113
119
 
114
120
  files.each do |path|
115
- if source = Decode::Source.for?(path)
121
+ if source = @base.index.languages.source_for(path)
116
122
  yield source
117
123
  end
118
124
  end
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.6.2"
25
+ VERSION = "0.7.0"
26
26
  end
27
27
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  # spec.add_dependency "utopia-gallery"
21
21
 
22
22
  spec.add_dependency "kramdown"
23
- spec.add_dependency "decode", "~> 0.9"
23
+ spec.add_dependency "decode", "~> 0.13"
24
24
  spec.add_dependency "rackula"
25
25
  spec.add_dependency "falcon"
26
26
  spec.add_dependency "thread-local"
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.6.2
4
+ version: 0.7.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-05-06 00:00:00.000000000 Z
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: utopia
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.9'
47
+ version: '0.13'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.9'
54
+ version: '0.13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rackula
57
57
  requirement: !ruby/object:Gem::Requirement