nanoc-tidy.rb 0.2.1 → 0.2.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: 9ef9ec4aa2d04e43d4caed4ba3e2eecf7c835d81156e5a2025c0f2990470754c
4
- data.tar.gz: d028d3cc3aaa355854fa3f1a234f85cba915c1b08b8e9d7b8f4e5865a293bd6e
3
+ metadata.gz: 3dcf61d9f8cd7befb47dcf0f0f15d3e31b5b6dfa849f19d255c10e0ce0083fbc
4
+ data.tar.gz: eca622d7fe8ac8dd883de3393225420efb9ca9f0ab0c5d39c1b8a3cab41ede3c
5
5
  SHA512:
6
- metadata.gz: 6dfaf3bc792c4c7d079408132087c20ba0aac896692764c79efb2b110aae09a11566fb9af1010df197cfd25af6a43e16f7b7de0823ab6db7132278dc3e05f9d8
7
- data.tar.gz: f94ce085f463bb1229f1d3e5b88b35d5c3a5e141d3ec5f5e20ce12d20e60e34da4e78751d51beb40b73a213e5a42a808f471b5239efb1d952f6f7d7e3ccd5df8
6
+ metadata.gz: 43cd2a510955f332b8aef7d06c884eeb8e958cfa9789a5f96880b9fe5ab744297d1c289b3b8fdcc027c5d8fc60df0a6ea9f03648d66fab47f068e037ec1bbe4d
7
+ data.tar.gz: 3c03bef0d16ff6762522b00f9fb84763fe7cba1ea5bdc1496e3335d874aa2f0bc92a6ff31823f00649877855c567cf7af834db55c707196da3651b5d85458507
data/README.md CHANGED
@@ -21,6 +21,7 @@ being used:
21
21
  # Rules
22
22
  require "nanoc-tidy"
23
23
  compile "/index.html.erb" do
24
+ layout("/default.*")
24
25
  filter(:erb)
25
26
  filter(:tidy)
26
27
  write("/index.html")
@@ -36,6 +37,7 @@ The following example forwards command-line options to
36
37
  # Rules
37
38
  require "nanoc-tidy"
38
39
  compile "/index.html.erb" do
40
+ layout("/default.*")
39
41
  filter(:erb)
40
42
  filter(:tidy, "-upper" => true)
41
43
  write("/index.html")
@@ -24,7 +24,7 @@ class Nanoc::Tidy::Filter < Nanoc::Filter
24
24
  private
25
25
 
26
26
  def tidy(file, options)
27
- system "tidy", "-modify", "-quiet", *tidy_args(options), file.path
27
+ system tidy_exe, "-modify", "-quiet", *tidy_args(options), file.path
28
28
  if $?.success?
29
29
  File.read(file.path).tap { file.tap(&:unlink).close }
30
30
  else
@@ -42,6 +42,14 @@ class Nanoc::Tidy::Filter < Nanoc::Filter
42
42
  end
43
43
  end
44
44
 
45
+ def tidy_exe
46
+ case
47
+ when system("which tidy > /dev/null 2>&1") then "tidy"
48
+ when system("which tidy5 > /dev/null 2>&1") then "tidy5"
49
+ else raise Error, "unable to find a tidy executable on $PATH"
50
+ end
51
+ end
52
+
45
53
  def temporary_file_for(content)
46
54
  dir = File.join(Dir.getwd, "tmp", "nanoc-tidy.rb")
47
55
  mkdir_p(dir) unless Dir.exist?(dir)
@@ -1,5 +1,5 @@
1
1
  module Nanoc
2
2
  module Tidy
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-tidy.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - '0x1eef'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2024-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.4.10
151
+ rubygems_version: 3.5.3
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: nanoc-tidy.rb integrates tidy-html5 into nanoc.