utopia-project 0.33.1 → 0.33.2

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: 243e6190a11eda87e544917c3bdd9eac032751d59cbf6774c4d9306674fa2b77
4
- data.tar.gz: d46a3f7228757feeb5e093bcfc5f257a11d2c73607b1488cc604a2d2f2ffe45a
3
+ metadata.gz: b026a55470cb43f0e15336c742d109cdc868d3f60c98b4628d6bfe39b14ed156
4
+ data.tar.gz: 723621437bf6b318120fe1a8260482f3eb1a6809a199af50c9571bc224df1729
5
5
  SHA512:
6
- metadata.gz: b47e681830588383eb8ac12c7da593859835cb6141acbc413d73915102dc919d9294c033c92ea4e986d3258e0594984a14afbec40cb142f63e630a08c6493874
7
- data.tar.gz: 16e76eaa43ef6edf0a18dbb7e1e4ca52b2fd6cb1ae806df8bdd8c451225e7c56773d1ed308eb82ed865c139f0ec20a4bfc583be7886067b62c076368f679214e
6
+ metadata.gz: b2b39d0c3dd6927baf8d106723b949d870f772b91d67494d2ee23bf077c06f93477bbf94fc7ff7c1669d25dc227f3d4f9a22e6a099dc495f15b96b19defc9908
7
+ data.tar.gz: ceff9c6369bd465f9a4da7120be81e3c2b81a3f58cb01181e1823e6c07cffcee8cd21f329387d0510b6613a89af84de1f57aab6cebb310892c78488dc9e5a8b4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2023-2024, by Samuel Williams.
4
+ # Copyright, 2023-2025, by Samuel Williams.
5
5
 
6
- require 'utopia/project'
7
- require 'xrb'
6
+ require "utopia/project"
7
+ require "xrb"
8
8
 
9
9
  def update(path: "readme.md", documentation_url: nil)
10
10
  project = Utopia::Project::Base.new(context.root)
@@ -52,7 +52,7 @@ end
52
52
  # The public documentation URL if it can be determined.
53
53
  def public_documentation_url
54
54
  if metadata = gemspec.metadata
55
- if documentation_uri = metadata['documentation_uri']
55
+ if documentation_uri = metadata["documentation_uri"]
56
56
  return documentation_uri
57
57
  end
58
58
  end
@@ -66,7 +66,14 @@ def usage_section(documentation_url, project)
66
66
  buffer << "Please see the [project documentation](#{documentation_url}) for more details.\n"
67
67
 
68
68
  project.guides.each do |guide|
69
- buffer << " - [#{guide.title}](#{guide.href(documentation_url)}) - #{guide.description.to_markdown}\n"
69
+ if description = guide.description
70
+ buffer << " - [#{guide.title}](#{guide.href(documentation_url)}) - #{description.to_markdown}\n"
71
+ elsif documentation = guide.documentation
72
+ document = project.document(documentation.text, language: guide.documentation.language)
73
+ buffer << " - [#{guide.title}](#{guide.href(documentation_url)}) - #{document.to_markdown}\n"
74
+ else
75
+ buffer << " - [#{guide.title}](#{guide.href(documentation_url)})\n"
76
+ end
70
77
  end
71
78
 
72
79
  return Markly.parse(buffer)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
6
  # Create an empty project in the current directory.
7
7
  def create
@@ -38,7 +38,7 @@ end
38
38
  # @parameter output_path [String] The output path for the static site.
39
39
  # @parameter force [Boolean] Remove the output directory before generating the static content.
40
40
  def static(output_path: "docs", force: true)
41
- require 'rackula/command'
41
+ require "rackula/command"
42
42
 
43
43
  config_path = File.expand_path("../../template/config.ru", __dir__)
44
44
  public_path = File.expand_path("../../public", __dir__)
@@ -60,7 +60,7 @@ end
60
60
 
61
61
  # Extract a description for the project.
62
62
  def description(root: context.root)
63
- require 'markly'
63
+ require "markly"
64
64
 
65
65
  readme_path = File.join(root, "readme.md")
66
66
  if File.exist?(readme_path)
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2025, by Samuel Williams.
5
5
  # Copyright, 2023, by Michael Adams.
6
6
 
7
- require 'utopia/path'
8
- require 'utopia/content/links'
7
+ require "utopia/path"
8
+ require "utopia/content/links"
9
9
 
10
- require 'xrb/reference'
11
- require 'decode'
10
+ require "xrb/reference"
11
+ require "decode"
12
12
 
13
- require 'thread/local'
13
+ require "thread/local"
14
14
 
15
- require_relative 'document'
16
- require_relative 'releases_document'
15
+ require_relative "document"
16
+ require_relative "releases_document"
17
17
 
18
- require_relative 'guide'
19
- require_relative 'linkify'
18
+ require_relative "guide"
19
+ require_relative "linkify"
20
20
 
21
21
  module Utopia
22
22
  module Project
@@ -120,13 +120,6 @@ module Utopia
120
120
  # See {document} for details.
121
121
  # @returns [XRB::MarkupString]
122
122
  def format(text, definition = nil, language: definition&.language, **options)
123
- case text
124
- when Enumerable
125
- text = text.to_a.join("\n")
126
- when nil
127
- return nil
128
- end
129
-
130
123
  if document = self.document(text, definition, language: language)
131
124
  return XRB::Markup.raw(
132
125
  document.to_html(**options)
@@ -140,6 +133,13 @@ module Utopia
140
133
  #
141
134
  # @returns [Document]
142
135
  def document(text, definition = nil, language: definition&.language)
136
+ case text
137
+ when Enumerable
138
+ text = text.to_a.join("\n")
139
+ when nil
140
+ return nil
141
+ end
142
+
143
143
  Document.new(text, self, definition: definition, default_language: language)
144
144
  end
145
145
 
@@ -183,7 +183,7 @@ module Utopia
183
183
  end
184
184
 
185
185
  def readme_document
186
- if path = self.path_for('readme.md') || self.path_for('README.md')
186
+ if path = self.path_for("readme.md") || self.path_for("README.md")
187
187
  Document.new(File.read(path), self)
188
188
  end
189
189
  end
@@ -193,7 +193,7 @@ module Utopia
193
193
  end
194
194
 
195
195
  def releases_document
196
- if path = self.path_for('releases.md')
196
+ if path = self.path_for("releases.md")
197
197
  ReleasesDocument.new(File.read(path), self)
198
198
  end
199
199
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2025, by Samuel Williams.
5
5
 
6
- require_relative 'renderer'
7
- require 'xrb'
6
+ require_relative "renderer"
7
+ require "xrb"
8
8
 
9
9
  module Utopia
10
10
  module Project
@@ -72,6 +72,10 @@ module Utopia
72
72
  end
73
73
  end
74
74
 
75
+ def to_markdown(**options)
76
+ self.root.to_markdown(**options)
77
+ end
78
+
75
79
  def to_html(node = self.root, **options)
76
80
  renderer = Renderer.new(ids: true, flags: Markly::UNSAFE, **options)
77
81
  XRB::Markup.raw(renderer.render(node))
@@ -3,9 +3,9 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
- require 'utopia/path'
7
- require 'xrb/reference'
8
- require 'decode'
6
+ require "utopia/path"
7
+ require "xrb/reference"
8
+ require "decode"
9
9
 
10
10
  module Utopia
11
11
  module Project
@@ -3,7 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
- require 'decode/syntax/rewriter'
6
+ require "decode/syntax/rewriter"
7
7
 
8
8
  module Utopia
9
9
  module Project
@@ -24,14 +24,14 @@ module Utopia
24
24
 
25
25
  def link_to(definition, text)
26
26
  XRB::Builder.fragment do |builder|
27
- builder.inline('a', href: @base.link_for(definition), title: definition.qualified_name) do
27
+ builder.inline("a", href: @base.link_for(definition), title: definition.qualified_name) do
28
28
  builder.text(text)
29
29
  end
30
30
  end
31
31
  end
32
32
 
33
33
  def apply(output = XRB::Builder.new)
34
- output.inline('code', class: "language-#{@language.name}") do
34
+ output.inline("code", class: "language-#{@language.name}") do
35
35
  super
36
36
  end
37
37
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2024, by Samuel Williams.
5
5
 
6
- require_relative 'document'
6
+ require_relative "document"
7
7
 
8
8
  module Utopia
9
9
  module Project
@@ -3,8 +3,8 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2022, by Samuel Williams.
5
5
 
6
- require 'markly'
7
- require 'markly/renderer/html'
6
+ require "markly"
7
+ require "markly/renderer/html"
8
8
 
9
9
  module Utopia
10
10
  module Project
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2025, by Samuel Williams.
5
5
 
6
6
  module Utopia
7
7
  module Project
8
- VERSION = "0.33.1"
8
+ VERSION = "0.33.2"
9
9
  end
10
10
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  require "utopia/project/version"
7
7
 
8
- require 'variant'
8
+ require "variant"
9
9
 
10
- require 'utopia/localization'
10
+ require "utopia/localization"
11
11
 
12
- require_relative 'project/base'
12
+ require_relative "project/base"
13
13
 
14
14
  module Utopia
15
15
  module Project
@@ -43,13 +43,13 @@ module Utopia
43
43
  builder.use Utopia::Static, root: PUBLIC_ROOT
44
44
 
45
45
  builder.use Utopia::Redirection::Rewrite, {
46
- '/' => '/index'
46
+ "/" => "/index"
47
47
  }
48
48
 
49
49
  builder.use Utopia::Redirection::DirectoryIndex
50
50
 
51
51
  builder.use Utopia::Redirection::Errors, {
52
- 404 => '/errors/file-not-found'
52
+ 404 => "/errors/file-not-found"
53
53
  }
54
54
 
55
55
  if locales
@@ -66,7 +66,7 @@ module Utopia
66
66
  # 'gallery' => Utopia::Gallery::Tags.new
67
67
  }
68
68
 
69
- builder.run lambda { |env| [404, {}, []] }
69
+ builder.run lambda {|env| [404, {}, []]}
70
70
  end
71
71
  end
72
72
  end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2020-2024, by Samuel Williams.
3
+ Copyright, 2020-2025, by Samuel Williams.
4
4
  Copyright, 2020, by Olle Jonsson.
5
5
  Copyright, 2022-2023, by dependabot[bot].
6
6
  Copyright, 2023, by Michael Adams.
data/pages/controller.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
6
  prepend Actions
7
7
 
8
- on '**' do
8
+ on "**" do
9
9
  @base = Utopia::Project::Base.instance
10
10
  end
11
11
 
12
- on 'index' do
12
+ on "index" do
13
13
  if @document = @base.readme_document
14
14
  @document.replace_section("Usage") do |header|
15
15
  header.insert_after(@document.html_node("<content:usage/>"))
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2023, by Samuel Williams.
4
+ # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
6
  prepend Actions
7
7
 
8
- on '**/*/index' do |request, path|
8
+ on "**/*/index" do |request, path|
9
9
  name = path.components[-2]
10
10
 
11
11
  @guide = @base.guides.find do |guide|
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2024, by Samuel Williams.
5
5
 
6
6
  prepend Actions
7
7
 
8
- on 'index' do
8
+ on "index" do
9
9
  @document = @base.releases_document
10
10
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
6
  prepend Actions
7
7
 
8
- on '**/*/index' do |request, path|
8
+ on "**/*/index" do |request, path|
9
9
  @lexical_path = path.components.dup
10
10
  # Remove the last "index" part:
11
11
  @lexical_path.pop
data/readme.md CHANGED
@@ -31,6 +31,10 @@ Please see the [project documentation](https://socketry.github.io/utopia-project
31
31
 
32
32
  Please see the [project releases](https://socketry.github.io/utopia-project/releases/index) for all releases.
33
33
 
34
+ ### v0.33.2
35
+
36
+ - Fixed handling of segmented code guides when rendered into a `readme.md` file.
37
+
34
38
  ### v0.33.0
35
39
 
36
40
  - Fix presentation of release notes on releases page.
data/releases.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Changes
2
2
 
3
- This document outlines major changes and new features in each release of the project.
3
+ ## v0.33.2
4
+
5
+ - Fixed handling of segmented code guides when rendered into a `readme.md` file.
4
6
 
5
7
  ## v0.33.0
6
8
 
data/template/config.ru CHANGED
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
 
2
- require 'utopia/setup'
3
+ require "utopia/setup"
3
4
  UTOPIA ||= Utopia.setup(Dir.pwd)
4
5
 
5
- require 'utopia/project'
6
+ require "utopia/project"
6
7
  Utopia::Project.call(self)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  source "https://rubygems.org"
3
4
 
data/template/preload.rb CHANGED
@@ -3,4 +3,4 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2023, by Samuel Williams.
5
5
 
6
- require 'utopia/project'
6
+ require "utopia/project"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia-project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.1
4
+ version: 0.33.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,7 +39,7 @@ cert_chain:
39
39
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
40
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
41
  -----END CERTIFICATE-----
42
- date: 2025-02-13 00:00:00.000000000 Z
42
+ date: 1980-01-02 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: decode
@@ -254,8 +254,8 @@ files:
254
254
  - public/robots.txt
255
255
  - readme.md
256
256
  - releases.md
257
- - template/Gemfile
258
257
  - template/config.ru
258
+ - template/gems.rb
259
259
  - template/preload.rb
260
260
  homepage: https://socketry.github.io/utopia-project
261
261
  licenses:
@@ -271,14 +271,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
271
  requirements:
272
272
  - - ">="
273
273
  - !ruby/object:Gem::Version
274
- version: '3.1'
274
+ version: '3.2'
275
275
  required_rubygems_version: !ruby/object:Gem::Requirement
276
276
  requirements:
277
277
  - - ">="
278
278
  - !ruby/object:Gem::Version
279
279
  version: '0'
280
280
  requirements: []
281
- rubygems_version: 3.6.2
281
+ rubygems_version: 3.6.7
282
282
  specification_version: 4
283
283
  summary: A project documentation tool based on Utopia.
284
284
  test_files: []
metadata.gz.sig CHANGED
Binary file