revealing 1.2.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcbd8c769d938e3504cc380edd46cbd7288a63271829da2faf8b2ef41b1c9b62
4
- data.tar.gz: b602ba7250675cc5b761b5edd9b35606ce5f85cc6770f343147425f3650b4574
3
+ metadata.gz: d42e25725650911b0db7d824e93ea671948f801b35c919fcbc72961c1a2bb7ab
4
+ data.tar.gz: 76c6b2cd5acfd1e9e5e973d33c387cdde943a2e157490e14d4140196820d55f3
5
5
  SHA512:
6
- metadata.gz: d6a9a2d429485905ac7f191d211485739a7ee83c3382c7bf3221ed71fb0036c2b0bb5244adfb48475c90e01afcebb9bf88feb0502ffed425b51bfb559ef7c39b
7
- data.tar.gz: 42729979c92eaa079cdb2881c592c3a62d08704efaf799c5caa6791b9fcacce9a6351a6db8ecc463ad71bdbc86f65516989b73c63390c5beb6af30a12d77d71a
6
+ metadata.gz: 6769159967e6aa9892b7fbff20c5bf6370e5ff2ec1e6528f87ffae83ade885f95e74bcb5ba04b0419087f27bf3a66de67eb5a305ef97540e478025df717db97a
7
+ data.tar.gz: a7255e38b81b155dbd5c414b00a02bcdd54894a4f6400cc7c3f247ba3c9140db1d22ce5733920cf85a48aa4f4cd13dd61cdfcc8b13d7983c39711f09919b16d3
data/.overcommit.yml ADDED
@@ -0,0 +1,33 @@
1
+ # Extend the default configuration defined in:
2
+ # https://github.com/brigade/overcommit/blob/master/config/default.yml
3
+
4
+ PreCommit:
5
+ BundleCheck:
6
+ enabled: true
7
+ LocalPathsInGemfile:
8
+ enabled: true
9
+ RakeTarget:
10
+ enabled: true
11
+ targets:
12
+ - rubocop
13
+ - spec:unit
14
+ TrailingWhitespace:
15
+ enabled: true
16
+
17
+ PostCheckout:
18
+ BundleInstall:
19
+ enabled: true
20
+
21
+ PostMerge:
22
+ BundleInstall:
23
+ enabled: true
24
+
25
+ PostRewrite:
26
+ BundleInstall:
27
+ enabled: true
28
+
29
+ PrePush:
30
+ RakeTarget:
31
+ enabled: true
32
+ targets:
33
+ - default
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.6.2
1
+ ruby-2.6.3
data/README.markdown CHANGED
@@ -37,8 +37,10 @@ Unique features:
37
37
 
38
38
  # TODO
39
39
 
40
- 1. `doctor` checks that all the template files are present
41
- 1. Treat mathjax config as yet another header file
40
+ 1. Expose DITAA's `--scale` via attribute
41
+ 1. PR homebrew's [ditaa](https://github.com/Homebrew/homebrew-core/blob/master/Formula/ditaa.rb) to use `-Djava.awt.headless=true`
42
+ 1. pandoc-ditaa-inline filter should write files to cache dir and read it from there via SHA
43
+ - still keep the SVG inline, but do not call ditaa again if unchanged
42
44
  1. Expose customization of
43
45
  * highlight-style
44
46
  * theme
data/lib/revealing/cli.rb CHANGED
@@ -5,6 +5,7 @@ require_relative 'prerequisite'
5
5
  module Revealing
6
6
  PREREQUISITES = [
7
7
  Prerequisite.new('curl'),
8
+ Prerequisite.new('ditaa'),
8
9
  Prerequisite.new('gm', 'graphicsmagick'),
9
10
  Prerequisite.new('gpp'),
10
11
  Prerequisite.new('pandoc'),
@@ -17,13 +18,29 @@ module Revealing
17
18
 
18
19
  desc 'doctor', 'Checks whether your system is fit for revealing.'
19
20
  def doctor
20
- PREREQUISITES.each do |tool|
21
- if tool.available?
22
- puts "OK: #{tool} is available."
23
- else
24
- warn "Error: #{tool.command} is not available. Install it using `#{tool.install_hint}`."
21
+ anything_missing = false
22
+ missing_tools = PREREQUISITES.reject(&:available?)
23
+
24
+ if missing_tools.any?
25
+ anything_missing = true
26
+ warn 'Error: The following required tools are not available:'
27
+ missing_tools.each do |tool|
28
+ warn " * #{tool} - install it with `#{tool.install_hint}`"
25
29
  end
26
30
  end
31
+
32
+ missing_files = target_files_in(Pathname.getwd).reject(&:exist?)
33
+
34
+ if missing_files.any?
35
+ anything_missing = true
36
+ warn 'Error: The following files do not exist:'
37
+ missing_files.each do |missing|
38
+ warn " * #{missing.relative_path_from(Pathname.getwd)}"
39
+ end
40
+ warn 'Consider running `revealing init` to create them.'
41
+ end
42
+
43
+ exit 1 if anything_missing
27
44
  end
28
45
 
29
46
  desc 'init [DIRECTORY]', 'initialize a new revealing project in DIRECTORY. Defaults to the current working directory.'
@@ -31,11 +48,9 @@ module Revealing
31
48
  project_directory = Pathname(directory)
32
49
  project_directory.mkdir unless project_directory.exist?
33
50
 
34
- templates_directory = Pathname(__dir__) / '../../templates/init'
35
-
36
51
  # FileUtils.cp_r overwrites the target if it exists, but we want to preserve it
37
52
  # and print information about what happened
38
- source_target_pairs(templates_directory, project_directory).each do |src, target|
53
+ template_files.zip(target_files_in(project_directory)).each do |src, target|
39
54
  if target.exist?
40
55
  warn "#{target} exists; skipping"
41
56
  else
@@ -46,13 +61,22 @@ module Revealing
46
61
  end
47
62
  end
48
63
 
64
+ desc 'version', 'Prints version information'
65
+ def version
66
+ puts "revealing #{Revealing::VERSION}"
67
+ end
68
+ map %w(-V --version) => :version
69
+
49
70
  private
50
71
 
51
- def source_target_pairs(src_dir, target_dir)
52
- src_dir
53
- .glob('**/*')
54
- .select(&:file?)
55
- .map{|e| [e, target_dir / e.relative_path_from(src_dir)]}
72
+ TEMPLATES_DIR = Pathname(__dir__) / '../../templates'
73
+
74
+ def template_files
75
+ TEMPLATES_DIR.glob('**/*').select(&:file?)
76
+ end
77
+
78
+ def target_files_in(dir)
79
+ template_files.map{|f| dir / f.relative_path_from(TEMPLATES_DIR)}
56
80
  end
57
81
  end
58
82
  end
@@ -51,9 +51,9 @@ file TARGET_FILE => [ TARGET_DIR, REVEAL_JS_TARGET_DIR, GPP_FILE, DIRTY_FILE, ME
51
51
  --variable history=true
52
52
  --variable revealjs-url=#{REVEAL_JS}
53
53
  --mathjax=https://cdnjs.cloudflare.com/ajax/libs/mathjax/#{MATH_JAX_VERSION}/MathJax.js?config=TeX-AMS_CHTML-full
54
- --include-in-header=#{__dir__ + '/../../templates/mathjax/config.js'}
55
54
  "--metadata-file=#{METADATA_FILE.to_path}"
56
55
  #{HEADERS.map { |h| "--include-in-header=#{h}" }.join("\n")}
56
+ --lua-filter #{__dir__}/../../tools/pandoc-ditaa-inline/ditaa-inline.lua
57
57
  #{GPP_FILE}
58
58
  ).split("\n").join(' ')
59
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Revealing
4
- VERSION = '1.2.0'
4
+ VERSION = '1.4.0'
5
5
  end
data/revealing.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'guard'
34
34
  spec.add_development_dependency 'guard-bundler'
35
35
  spec.add_development_dependency 'guard-rspec'
36
+ spec.add_development_dependency 'overcommit'
36
37
  spec.add_development_dependency 'pry'
37
38
  spec.add_development_dependency 'pry-byebug'
38
39
  spec.add_development_dependency 'rspec'
@@ -0,0 +1,30 @@
1
+ # Pandoc Filter for DITAA
2
+
3
+ Turns inline DITAA diagrams into SVG. Needs a local installation of ditaa, e.g. `brew install ditaa`.
4
+
5
+ # Example
6
+
7
+ Given this markdown document (note the DITAA block) saved as `example.markdown`
8
+
9
+ ```markdown
10
+ The following graph shows two boxes, connected:
11
+
12
+ ```ditaa
13
+ +-----+ +-----+
14
+ | A |-->| B |
15
+ +-----+ +-----+
16
+ ```
17
+
18
+ As you can see, ditaa renders that quite pretty. It's turned into an embedded SVG.
19
+
20
+ ```
21
+
22
+ The following command turns the DITAA block into SVG, embedded in the HTML:
23
+
24
+ ```command
25
+ $ pandoc --lua-filter ditaa-inline.lua --out example.html example.markdown
26
+ ```
27
+
28
+ The result looks like this:
29
+
30
+ ![](example.png)
@@ -0,0 +1,6 @@
1
+ function CodeBlock(block)
2
+ if block.classes[1] == "ditaa" then
3
+ local img = pandoc.pipe("ditaa", {"-", "-", "--svg", "--scale", "1.0"}, block.text)
4
+ return pandoc.Para({pandoc.RawInline("html", img)})
5
+ end
6
+ end
@@ -0,0 +1,25 @@
1
+ # Example
2
+
3
+ Given this markdown document (note the DITAA block) saved as `example.markdown`:
4
+
5
+ ```markdown
6
+ The following graph shows two boxes, connected:
7
+
8
+ ```ditaa
9
+ +-----+ +-----+
10
+ | A |-->| B |
11
+ +-----+ +-----+
12
+ ```
13
+
14
+ As you can see, ditaa renders that quite pretty. It's turned into an embedded SVG.
15
+ ```
16
+
17
+ The following command turns the DITAA block into SVG, embedded in the HTML:
18
+
19
+ ```command
20
+ $ pandoc --lua-filter ditaa-inline.lua --out example.html example.markdown
21
+ ```
22
+
23
+ The result looks like this:
24
+
25
+ ![](example.png)
@@ -0,0 +1,31 @@
1
+ <p>The following graph shows two boxes, connected:</p>
2
+ <p><?xml version='1.0' encoding='UTF-8' standalone='no'?>
3
+ <svg
4
+ xmlns='http://www.w3.org/2000/svg'
5
+ width='210'
6
+ height='98'
7
+ shape-rendering='geometricPrecision'
8
+ version='1.0'>
9
+ <defs>
10
+ <filter id='f2' x='0' y='0' width='200%' height='200%'>
11
+ <feOffset result='offOut' in='SourceGraphic' dx='5' dy='5' />
12
+ <feGaussianBlur result='blurOut' in='offOut' stdDeviation='3' />
13
+ <feBlend in='SourceGraphic' in2='blurOut' mode='normal' />
14
+ </filter>
15
+ </defs>
16
+ <g stroke-width='1' stroke-linecap='square' stroke-linejoin='round'>
17
+ <rect x='0' y='0' width='210' height='98' style='fill: #ffffff'/>
18
+ <path stroke='gray' fill='gray' filter='url(#f2)' d='M25.0 35.0 L25.0 63.0 L85.0 63.0 L85.0 35.0 z' />
19
+ <path stroke='gray' fill='gray' filter='url(#f2)' d='M125.0 63.0 L185.0 63.0 L185.0 35.0 L125.0 35.0 z' />
20
+ <path stroke='#000000' stroke-width='1,000000' stroke-linecap='round' stroke-linejoin='round' fill='white' d='M25.0 35.0 L25.0 63.0 L85.0 63.0 L85.0 35.0 z' />
21
+ <path stroke='#000000' stroke-width='1,000000' stroke-linecap='round' stroke-linejoin='round' fill='white' d='M125.0 63.0 L185.0 63.0 L185.0 35.0 L125.0 35.0 z' />
22
+ <path stroke='none' stroke-width='1,000000' stroke-linecap='round' stroke-linejoin='round' fill='#000000' d='M110.0 42.0 L120.0 49.0 L110.0 56.0 z' />
23
+ <path stroke='#000000' stroke-width='1,000000' stroke-linecap='round' stroke-linejoin='round' fill='none' d='M115.0 49.0 L95.0 49.0 ' />
24
+ <text x='52' y='54' font-family='Courier' font-size='15' stroke='none' fill='#000000' ><![CDATA[A ]]></text>
25
+ <text x='153' y='54' font-family='Courier' font-size='15' stroke='none' fill='#000000' ><![CDATA[B ]]></text>
26
+ </g>
27
+ </svg></p>
28
+ <p>As you can see, ditaa renders that quite pretty. It’s turned into an embedded SVG.</p>
29
+ <p>Other blocks are left untouched:</p>
30
+ <div class="sourceCode" id="cb1"><pre class="sourceCode ruby"><code class="sourceCode ruby"><a class="sourceLine" id="cb1-1" title="1">puts <span class="st">&quot;olleH&quot;</span>.reverse</a></code></pre></div>
31
+ <p>That’s it!</p>
@@ -0,0 +1,17 @@
1
+ The following graph shows two boxes, connected:
2
+
3
+ ```ditaa
4
+ +-----+ +-----+
5
+ | A |-->| B |
6
+ +-----+ +-----+
7
+ ```
8
+
9
+ As you can see, ditaa renders that quite pretty. It's turned into an embedded SVG.
10
+
11
+ Other blocks are left untouched:
12
+
13
+ ```ruby
14
+ puts "olleH".reverse
15
+ ```
16
+
17
+ That's it!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revealing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steffen Uhlig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-19 00:00:00.000000000 Z
11
+ date: 2019-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: overcommit
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pry
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +204,7 @@ extensions: []
190
204
  extra_rdoc_files: []
191
205
  files:
192
206
  - ".gitignore"
207
+ - ".overcommit.yml"
193
208
  - ".rspec"
194
209
  - ".rubocop.yml"
195
210
  - ".ruby-version"
@@ -207,12 +222,18 @@ files:
207
222
  - lib/revealing/tasks/reveal.js.rake
208
223
  - lib/revealing/version.rb
209
224
  - revealing.gemspec
210
- - templates/init/Gemfile
211
- - templates/init/README.markdown
212
- - templates/init/Rakefile
213
- - templates/init/metadata.yml
214
- - templates/init/src/index.markdown
215
- - templates/mathjax/config.js
225
+ - templates/Gemfile
226
+ - templates/README.markdown
227
+ - templates/Rakefile
228
+ - templates/headers/mathjax.js
229
+ - templates/metadata.yml
230
+ - templates/src/index.markdown
231
+ - tools/pandoc-ditaa-inline/README.markdown
232
+ - tools/pandoc-ditaa-inline/ditaa-inline.lua
233
+ - tools/pandoc-ditaa-inline/examples/README.markdown
234
+ - tools/pandoc-ditaa-inline/examples/example.html
235
+ - tools/pandoc-ditaa-inline/examples/example.markdown
236
+ - tools/pandoc-ditaa-inline/examples/example.png
216
237
  homepage:
217
238
  licenses:
218
239
  - MIT
File without changes
File without changes
File without changes
File without changes