sitepress-server 4.1.1 → 5.0.0.beta
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bd49541ad2108abf123b99a55d2a4f66287f8602c3eeaecf4d2ca3386ebb24b
|
|
4
|
+
data.tar.gz: 9dff716b44aef66f6079fd3a50a199c4456a6792e24e97110fd65ec156b1728b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d084e465bae6172803df1114df9c74d5358dbe64cd519e05d189103a38963fb40efbcf16a764878130f95304d208b7b6d45e6a11a32ee1f42dc5ba0723ee8dba
|
|
7
|
+
data.tar.gz: c6bbc4abbe089a95ab726fb560d45f3578c3442ef0bf70e56cd9b82925e6aa15560c4f8322e160d3727ce8e96260d5d330d28832cc7bc70a4c0f3db2e11a53bf
|
data/lib/sitepress/server.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "action_controller/railtie"
|
|
2
|
-
require "
|
|
2
|
+
require "propshaft"
|
|
3
3
|
require "sitepress-rails"
|
|
4
4
|
|
|
5
5
|
# Require the gems listed in Gemfile, including any gems
|
|
@@ -45,22 +45,11 @@ module Sitepress
|
|
|
45
45
|
# found and fail silently.
|
|
46
46
|
routes.append { sitepress_pages root: true, controller: "site", constraints: nil }
|
|
47
47
|
|
|
48
|
-
#
|
|
48
|
+
# Setup logger.
|
|
49
49
|
logger = ActiveSupport::Logger.new(STDOUT)
|
|
50
50
|
logger.formatter = config.log_formatter
|
|
51
51
|
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
52
52
|
|
|
53
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
|
54
|
-
# This option may cause significant delays in view rendering with a large
|
|
55
|
-
# number of complex assets.
|
|
56
|
-
config.assets.debug = false
|
|
57
|
-
|
|
58
|
-
# Suppress logger output for asset requests.
|
|
59
|
-
config.assets.quiet = true
|
|
60
|
-
|
|
61
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
62
|
-
config.assets.compile = true
|
|
63
|
-
|
|
64
53
|
# Allow any host to connect to the development server. The actual binding is
|
|
65
54
|
# controlled by server in the `sitepress-cli`; not by Rails.
|
|
66
55
|
config.hosts << proc { true } if config.respond_to? :hosts
|
|
@@ -69,6 +58,3 @@ module Sitepress
|
|
|
69
58
|
paths["config/initializers"] << File.expand_path("./config/initializers")
|
|
70
59
|
end
|
|
71
60
|
end
|
|
72
|
-
|
|
73
|
-
# Load the SassC template handler if SassC is installed as part of this stand-alone server.
|
|
74
|
-
require_relative "sass_template_handlers" if defined? SassC::Engine
|
|
@@ -8,6 +8,7 @@ class SiteController < ApplicationController
|
|
|
8
8
|
# won't be properly handled.
|
|
9
9
|
rescue_from Exception, with: :standard_error
|
|
10
10
|
rescue_from ActionView::Template::Error, with: :action_view_template_error
|
|
11
|
+
rescue_from Sitepress::ParseError, with: :parse_error
|
|
11
12
|
rescue_from Sitepress::ResourceNotFoundError, with: :page_not_found
|
|
12
13
|
|
|
13
14
|
layout :site_layout
|
|
@@ -25,6 +26,14 @@ class SiteController < ApplicationController
|
|
|
25
26
|
render_exception(template: "action_template_error", exception: exception)
|
|
26
27
|
end
|
|
27
28
|
|
|
29
|
+
def parse_error(exception)
|
|
30
|
+
raise exception unless has_error_reporting_enabled?
|
|
31
|
+
|
|
32
|
+
@title = "Parse error"
|
|
33
|
+
@exception = exception
|
|
34
|
+
render "parse_error", layout: "sitepress", status: :internal_server_error, formats: :html
|
|
35
|
+
end
|
|
36
|
+
|
|
28
37
|
def render_exception(template:, exception:)
|
|
29
38
|
raise exception unless has_error_reporting_enabled?
|
|
30
39
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
<% adjusted_line = @exception.line_number + current_page.asset.body_line_offset - 1 %>
|
|
2
|
+
<h2><%= @exception.class %>: <%= @exception.message %> in <%= current_page.asset.path %>:<%= adjusted_line %></h2>
|
|
2
3
|
<h3>Source</h3>
|
|
3
4
|
|
|
4
5
|
<code>
|
|
5
|
-
<pre><%= current_page.asset.path %>:<%=
|
|
6
|
+
<pre><%= current_page.asset.path %>:<%= adjusted_line %>
|
|
6
7
|
<%= @exception.annotated_source_code.join("\n") %></pre>
|
|
7
8
|
</code>
|
|
8
9
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<h2><%= @exception.class %></h2>
|
|
2
|
+
<h3><%= @exception.message %></h3>
|
|
3
|
+
|
|
4
|
+
<p>This error typically occurs when there's invalid YAML in the frontmatter of a page.</p>
|
|
5
|
+
|
|
6
|
+
<h3>Common causes</h3>
|
|
7
|
+
<ul>
|
|
8
|
+
<li>Missing closing <code>---</code> delimiter</li>
|
|
9
|
+
<li>Invalid YAML syntax (bad indentation, missing quotes around special characters)</li>
|
|
10
|
+
<li>Tabs instead of spaces for indentation</li>
|
|
11
|
+
<li>Special characters that need quoting: <code>: { } [ ] , & * # ? | - < > = ! % @ \</code></li>
|
|
12
|
+
</ul>
|
|
13
|
+
|
|
14
|
+
<h3>Backtrace</h3>
|
|
15
|
+
<code>
|
|
16
|
+
<pre><%= @exception.backtrace.join("\n") %></pre>
|
|
17
|
+
</code>
|
|
18
|
+
|
|
19
|
+
<h3>Resources</h3>
|
|
20
|
+
<table>
|
|
21
|
+
<thead>
|
|
22
|
+
<th>Request path</th>
|
|
23
|
+
<th>Asset path</th>
|
|
24
|
+
<th>Media type</th>
|
|
25
|
+
</thead>
|
|
26
|
+
<tbody>
|
|
27
|
+
<% site.resources.each do |resource| %>
|
|
28
|
+
<tr>
|
|
29
|
+
<td><%= link_to resource.request_path, resource.request_path %></td>
|
|
30
|
+
<td><%= resource.asset.path %></td>
|
|
31
|
+
<td><%= resource.asset.mime_type %></td>
|
|
32
|
+
</tr>
|
|
33
|
+
<% end %>
|
|
34
|
+
</tbody>
|
|
35
|
+
</table>
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sitepress-server
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0.beta
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brad Gessler
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-02-20 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rack-test
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 5.0.0.beta
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 5.0.0.beta
|
|
40
40
|
email:
|
|
41
41
|
- bradgessler@gmail.com
|
|
42
42
|
executables: []
|
|
@@ -44,7 +44,6 @@ extensions: []
|
|
|
44
44
|
extra_rdoc_files: []
|
|
45
45
|
files:
|
|
46
46
|
- lib/sitepress-server.rb
|
|
47
|
-
- lib/sitepress/sass_template_handlers.rb
|
|
48
47
|
- lib/sitepress/server.rb
|
|
49
48
|
- rails/app/assets/config/manifest.js
|
|
50
49
|
- rails/app/controllers/application_controller.rb
|
|
@@ -53,6 +52,7 @@ files:
|
|
|
53
52
|
- rails/app/views/layouts/sitepress.html.erb
|
|
54
53
|
- rails/app/views/site/action_template_error.html.erb
|
|
55
54
|
- rails/app/views/site/not_found.html.erb
|
|
55
|
+
- rails/app/views/site/parse_error.html.erb
|
|
56
56
|
- rails/app/views/site/standard_error.html.erb
|
|
57
57
|
- rails/public/_sitepress/images/logo.svg
|
|
58
58
|
- rails/public/_sitepress/stylesheets/site.css
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Rails doesn't compile .scss or .sass files that are outside of the asset pipeline,
|
|
2
|
-
# so we add support for that here with this patch.
|
|
3
|
-
module Sass
|
|
4
|
-
class SassCHandler
|
|
5
|
-
def call(template, source = template.source)
|
|
6
|
-
SassC::Engine.new(source).render.inspect + '.html_safe'
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
class SassHandler
|
|
11
|
-
def call(template, source = template.source)
|
|
12
|
-
SassC::Engine.new(SassC::Sass2Scss.convert(source)).render.inspect + '.html_safe'
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
ActionView::Template.register_template_handler :sass, Sass::SassHandler.new
|
|
18
|
-
ActionView::Template.register_template_handler :scss, Sass::SassCHandler.new
|