static_site_builder 0.5.0 → 0.6.0
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 +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +2 -2
- data/lib/static_site_builder/renderers/template_renderer.rb +3 -3
- data/lib/static_site_builder/version.rb +1 -1
- data/lib/static_site_builder.rb +2 -2
- data/templates/default_template.html +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38a16b2cbd426b2c6cb677d4622c77f6dd35a12f5d08a671528865164e6cf3d0
|
4
|
+
data.tar.gz: b2f4216782693622921c0f25b19758d5085706ad74205f09bb53eda45ac1861e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e9463929b6cd1eeef361d81197cad845e76cd0599cb7052e9e9ea1761a8515141fbfb6c807c9a5e0f7e3c1779ed0f63e0b95b5a61faa9391bf6c7b0f24fb5d2
|
7
|
+
data.tar.gz: cb724da0fd50819e82217f6ff8fc36b935bb24bf8c1a228beafa7e4d375186efae5c2e0b87bded9335d851079218a9e2cb7b3bd8b4a05fccd1e913e43026edf6
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.4
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
static_site_builder (0.
|
4
|
+
static_site_builder (0.6.0)
|
5
5
|
redcarpet (~> 3.4)
|
6
6
|
thor (~> 1.1)
|
7
7
|
|
@@ -11,14 +11,14 @@ GEM
|
|
11
11
|
byebug (11.1.3)
|
12
12
|
coderay (1.1.3)
|
13
13
|
method_source (1.0.0)
|
14
|
-
minitest (5.
|
14
|
+
minitest (5.15.0)
|
15
15
|
pry (0.14.1)
|
16
16
|
coderay (~> 1.1)
|
17
17
|
method_source (~> 1.0)
|
18
18
|
rake (13.0.6)
|
19
19
|
redcarpet (3.5.1)
|
20
|
-
thor (1.1
|
21
|
-
yart (0.
|
20
|
+
thor (1.2.1)
|
21
|
+
yart (0.2.0)
|
22
22
|
|
23
23
|
PLATFORMS
|
24
24
|
ruby
|
@@ -37,4 +37,4 @@ RUBY VERSION
|
|
37
37
|
ruby 2.7.0p0
|
38
38
|
|
39
39
|
BUNDLED WITH
|
40
|
-
2.2.
|
40
|
+
2.2.31
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Build a HTML website from markdown files.
|
4
4
|
|
5
|
-
This gem will convert your markdown files into HTML files, embedding the generated HTML into a template (making up the full webpage). This gem's default [
|
5
|
+
This gem will convert your markdown files into HTML files, embedding the generated HTML into a template (making up the full webpage). This gem's default [Simple.css](https://simplecss.org/) template will be used unless you specify a template of your own. More on this further down.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -32,7 +32,7 @@ For full usage of `site_builder`, see:
|
|
32
32
|
|
33
33
|
## Templating
|
34
34
|
|
35
|
-
The default template uses
|
35
|
+
The default template uses [Simple.css](https://simplecss.org/) to enable a stylish and responsive web design out of the box.
|
36
36
|
|
37
37
|
Custom templates are simply HTML files which include an editable region (inside a `<body>` tag) consisting of the following markdown:
|
38
38
|
|
@@ -2,14 +2,14 @@ module StaticSiteBuilder
|
|
2
2
|
# Renders the given HTML body inside the given HTML webpage template.
|
3
3
|
class TemplateRenderer < Renderer
|
4
4
|
EDITABLE_REGION = '<div id="editable_region"></div>'.freeze
|
5
|
-
DEFAULT_TEMPLATE = "
|
5
|
+
DEFAULT_TEMPLATE = File.join("..", "templates", "default_template.html").freeze
|
6
6
|
|
7
7
|
attr_reader :template_filepath, :gem_included_template, :html
|
8
8
|
|
9
9
|
# Initializes a HTML template with either a template_filepath to a HTML file
|
10
10
|
# or a HTML string. Either way the HTML should be valid and contain the
|
11
11
|
# EDITABLE_REGION. If no params are provided then the DEFAULT_TEMPLATE is
|
12
|
-
# used instead. The DEFAULT_TEMPLATE uses
|
12
|
+
# used instead. The DEFAULT_TEMPLATE uses simple.css (from a CDN).
|
13
13
|
# The html takes precedence over the template_filepath if provided.
|
14
14
|
# The gem_included_template param distinguishes between a user created
|
15
15
|
# template (on their local file system) and an included template (built
|
@@ -53,7 +53,7 @@ module StaticSiteBuilder
|
|
53
53
|
path = @template_filepath
|
54
54
|
|
55
55
|
if @gem_included_template
|
56
|
-
relative_path = "
|
56
|
+
relative_path = File.join("..", "..", @template_filepath)
|
57
57
|
path = File.expand_path(relative_path, File.dirname(__FILE__))
|
58
58
|
end
|
59
59
|
|
data/lib/static_site_builder.rb
CHANGED
@@ -15,7 +15,7 @@ module StaticSiteBuilder
|
|
15
15
|
# embed each built webpage in. The output_dirpath will default to the
|
16
16
|
# markdown_dirpath if not set.
|
17
17
|
def self.build_website(markdown_dirpath, template, output_dirpath=nil)
|
18
|
-
pattern = "
|
18
|
+
pattern = File.join(markdown_dirpath, "*.md")
|
19
19
|
|
20
20
|
Dir.glob(pattern).map { |f| self.build_webpage(f, template, output_dirpath) }
|
21
21
|
end
|
@@ -42,7 +42,7 @@ module StaticSiteBuilder
|
|
42
42
|
filename_with_md_ext = File.basename(markdown_filepath)
|
43
43
|
filename_without_md_ext = filename_with_md_ext.gsub(".md", "")
|
44
44
|
|
45
|
-
html_filepath = "#{
|
45
|
+
html_filepath = File.join(output_dirpath, "#{filename_without_md_ext}.html")
|
46
46
|
File.open(html_filepath, "w") { |f| f.write(html) }
|
47
47
|
|
48
48
|
html_filepath
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
6
|
-
<link rel="stylesheet" href="https://
|
6
|
+
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<div id="editable_region"></div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: static_site_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Telford
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
|
-
rubygems_version: 3.
|
173
|
+
rubygems_version: 3.2.31
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Gem for building static content websites from markdown.
|