softcover 1.1.14 → 1.1.15
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/bin/make_figures +35 -0
- data/bin/rename_screenshot +65 -0
- data/lib/softcover/article_template/chapters/an_article.md +3 -3
- data/lib/softcover/article_template/chapters/an_article.tex +3 -3
- data/lib/softcover/article_template/full_size_figures/.gitkeep +0 -0
- data/lib/softcover/article_template/images/{01_michael_hartl_headshot.jpg → figures/01_michael_hartl_headshot.jpg} +0 -0
- data/lib/softcover/book_template/chapters/a_chapter.md +3 -3
- data/lib/softcover/book_template/chapters/a_chapter.tex +4 -4
- data/lib/softcover/book_template/full_size_figures/.gitkeep +0 -0
- data/lib/softcover/book_template/images/{01_michael_hartl_headshot.jpg → figures/01_michael_hartl_headshot.jpg} +0 -0
- data/lib/softcover/book_template/images/{2011_michael_hartl.png → figures/2011_michael_hartl.png} +0 -0
- data/lib/softcover/version.rb +1 -1
- data/softcover.gemspec +1 -1
- data/spec/app_spec.rb +1 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26a421fe45ea31ed314b9b15750f8c62cfce195c
|
4
|
+
data.tar.gz: e28cecc7e64e2bf3caaa59ae26753ad80ceba16f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05aa987ac22a29857cb4be06d7429cc5283bc86be3f41ac5291ab042f034d21b032a4c879a00b4546417bf1a48874e55586104d7bdc6ac75c19c827610f7939
|
7
|
+
data.tar.gz: 6d5475cb6525839cdaea610ab0fac3ecaee79375ec6be975b10994105f64c2e2d3112360e49b8197d92c85ca401503176cb5a5c27e7ec99b8123fc44c5b6ac39
|
data/bin/make_figures
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
# Makes display figures based on the full-size figures.
|
5
|
+
# The idea is to avoid throwing away data by storing full-size figures,
|
6
|
+
# but resize them to a size appropriate for use in the document.
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: rename_screenshot [options]"
|
11
|
+
|
12
|
+
opts.on("-a", "Regenerate all figures from full-size images") do
|
13
|
+
options[:all] = true
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("-w", "Resize to given width (in pixels)") do |width|
|
17
|
+
options[:width] = width
|
18
|
+
end
|
19
|
+
end.parse!
|
20
|
+
|
21
|
+
width = (options[:width] || "700") + '\>'
|
22
|
+
target_dir = "images/figures"
|
23
|
+
Dir.glob('full_size_figures/*').each do |full_size_filename|
|
24
|
+
if full_size_filename =~ /(\w+)-full\.(.*)/
|
25
|
+
# Needed for backwards compatibility.
|
26
|
+
filename = "#{target_dir}/#{$1}.#{$2}"
|
27
|
+
else
|
28
|
+
filename = "#{target_dir}/#{File.basename(full_size_filename)}"
|
29
|
+
end
|
30
|
+
unless File.exist?(filename) && !options[:all]
|
31
|
+
cmd = "convert #{full_size_filename} -resize #{width} #{filename}"
|
32
|
+
system cmd
|
33
|
+
end
|
34
|
+
end
|
35
|
+
system "git add -A"
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
# Renames a screenshot.
|
6
|
+
# This is intended for use with Shift-Cmd-4 on Mac OS X.
|
7
|
+
# 1. Use Shift-Cmd-4 to take a screenshot
|
8
|
+
# 2. Run `rename_screenshot figure_name` to create a full-size figure
|
9
|
+
# called `figure_name.png` in the `full_size_figures` directory.
|
10
|
+
# A corresponding smaller resized figure is automagically created
|
11
|
+
# in the `images/figures` directory. The idea is to keep the full-size figures
|
12
|
+
# in case they're ever needed, but to resize them so they're not too big
|
13
|
+
# for inclusion in the document.
|
14
|
+
# The method is to look for the most recently modified PNG file on the desktop
|
15
|
+
# and move it (while renaming it) to the `full_size_figures` directory. Then
|
16
|
+
# a normal-size figure is generated using the `make_figures` script.
|
17
|
+
|
18
|
+
def figure(name)
|
19
|
+
"images/figures/#{name}.png"
|
20
|
+
end
|
21
|
+
|
22
|
+
def rm(filename)
|
23
|
+
FileUtils.rm(filename) if File.exist?(filename)
|
24
|
+
end
|
25
|
+
|
26
|
+
options = {}
|
27
|
+
OptionParser.new do |opts|
|
28
|
+
opts.banner = "Usage: rename_screenshot [options]"
|
29
|
+
|
30
|
+
opts.on("-f", "Force overwrite of existing file") do
|
31
|
+
options[:force] = true
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on("-i", "Invert a renaming by removing the relevant images") do
|
35
|
+
options[:invert] = true
|
36
|
+
end
|
37
|
+
end.parse!
|
38
|
+
|
39
|
+
name = ARGV.shift
|
40
|
+
if name.nil?
|
41
|
+
puts "usage: rename_screenshot filename [options]"
|
42
|
+
exit 1
|
43
|
+
end
|
44
|
+
FileUtils.mkdir("full_size_figures") unless File.exist?("full_size_figures")
|
45
|
+
target = "full_size_figures/#{name}.png"
|
46
|
+
|
47
|
+
if options[:invert]
|
48
|
+
rm(target) if File.exist?(target)
|
49
|
+
rm(figure(name))
|
50
|
+
end
|
51
|
+
|
52
|
+
most_recent = Dir["#{ENV['HOME']}/Desktop/*.png"].sort_by do |a|
|
53
|
+
File.stat(a).mtime
|
54
|
+
end.reverse.first
|
55
|
+
response = 'y'
|
56
|
+
if File.exist?(target) && !options[:force]
|
57
|
+
puts "File #{target} already exists. Replace? [Y/n]"
|
58
|
+
response = gets.strip.downcase
|
59
|
+
end
|
60
|
+
unless response.downcase == 'n'
|
61
|
+
FileUtils.mv(most_recent, target)
|
62
|
+
rm(figure(name))
|
63
|
+
system "make_figures"
|
64
|
+
system "git add -A"
|
65
|
+
end
|
@@ -71,13 +71,13 @@ proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
71
71
|
|
72
72
|
Softcover supports the inclusion of images, like this:
|
73
73
|
|
74
|
-

|
74
|
+

|
75
75
|
|
76
76
|
Using \LaTeX\ labels, you can also include a caption (as in Figure~\ref{fig:captioned_image}) or just a figure number (as in Figure~\ref{fig:figure_number}).
|
77
77
|
|
78
|
-

|
78
|
+

|
79
79
|
|
80
|
-

|
80
|
+

|
81
81
|
|
82
82
|
### Tables
|
83
83
|
|
@@ -71,20 +71,20 @@ proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
71
71
|
|
72
72
|
Softcover supports the inclusion of images, like this:
|
73
73
|
|
74
|
-
\image{images/01_michael_hartl_headshot.jpg}
|
74
|
+
\image{images/figures/01_michael_hartl_headshot.jpg}
|
75
75
|
|
76
76
|
Using \LaTeX\ labels, you can also include a caption (as in Figure~\ref{fig:captioned_image}) or just a figure number (as in Figure~\ref{fig:figure_number}).
|
77
77
|
|
78
78
|
\begin{figure}[h]
|
79
79
|
\begin{center}
|
80
|
-
\image{images/01_michael_hartl_headshot.jpg}
|
80
|
+
\image{images/figures/01_michael_hartl_headshot.jpg}
|
81
81
|
\end{center}
|
82
82
|
\caption{Some dude.\label{fig:captioned_image}}
|
83
83
|
\end{figure}
|
84
84
|
|
85
85
|
\begin{figure}[h]
|
86
86
|
\begin{center}
|
87
|
-
\image{images/01_michael_hartl_headshot.jpg}
|
87
|
+
\image{images/figures/01_michael_hartl_headshot.jpg}
|
88
88
|
\end{center}
|
89
89
|
\caption{\label{fig:figure_number}}
|
90
90
|
\end{figure}
|
File without changes
|
File without changes
|
@@ -73,13 +73,13 @@ This is the second section.
|
|
73
73
|
|
74
74
|
Softcover supports the inclusion of images, like this:
|
75
75
|
|
76
|
-

|
76
|
+

|
77
77
|
|
78
78
|
Using \LaTeX\ labels, you can also include a caption (as in Figure~\ref{fig:captioned_image}) or just a figure number (as in Figure~\ref{fig:figure_number}).
|
79
79
|
|
80
|
-

|
80
|
+

|
81
81
|
|
82
|
-

|
82
|
+

|
83
83
|
|
84
84
|
### Tables
|
85
85
|
|
@@ -87,20 +87,20 @@ Softcover supports \href{http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_
|
|
87
87
|
|
88
88
|
You can include raw graphics like this:
|
89
89
|
|
90
|
-
\includegraphics{images/01_michael_hartl_headshot.jpg}
|
90
|
+
\includegraphics{images/figures/01_michael_hartl_headshot.jpg}
|
91
91
|
|
92
92
|
\noindent You can also include centered images:
|
93
93
|
|
94
|
-
\image{images/01_michael_hartl_headshot.jpg}
|
94
|
+
\image{images/figures/01_michael_hartl_headshot.jpg}
|
95
95
|
|
96
96
|
\noindent Or include one with a box, like so:
|
97
97
|
|
98
|
-
\imagebox{images/01_michael_hartl_headshot.jpg}
|
98
|
+
\imagebox{images/figures/01_michael_hartl_headshot.jpg}
|
99
99
|
|
100
100
|
To turn an image into a figure, use the \kode{figure} environment (Figure~\ref{fig:the_dude}).
|
101
101
|
|
102
102
|
\begin{figure}
|
103
|
-
\imagebox{images/01_michael_hartl_headshot.jpg}
|
103
|
+
\imagebox{images/figures/01_michael_hartl_headshot.jpg}
|
104
104
|
\caption{Some \href{http://michaelhartl.com/}{dude}.\label{fig:the_dude}}
|
105
105
|
\end{figure}
|
106
106
|
|
File without changes
|
File without changes
|
data/lib/softcover/book_template/images/{2011_michael_hartl.png → figures/2011_michael_hartl.png}
RENAMED
File without changes
|
data/lib/softcover/version.rb
CHANGED
data/softcover.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'polytexnic', '~> 1.1.
|
21
|
+
gem.add_dependency 'polytexnic', '~> 1.1.9'
|
22
22
|
gem.add_dependency 'msgpack', '~> 0.4.2'
|
23
23
|
gem.add_dependency 'nokogiri', '~> 1.6.0'
|
24
24
|
gem.add_dependency 'thor', '~> 0.18.1'
|
data/spec/app_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softcover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hartl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: polytexnic
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.1.
|
20
|
+
version: 1.1.9
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.1.
|
27
|
+
version: 1.1.9
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: msgpack
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -295,6 +295,8 @@ description: CLI interface for softcover.io
|
|
295
295
|
email:
|
296
296
|
- michael@softcover.io
|
297
297
|
executables:
|
298
|
+
- make_figures
|
299
|
+
- rename_screenshot
|
298
300
|
- sc
|
299
301
|
- softcover
|
300
302
|
extensions: []
|
@@ -405,6 +407,8 @@ files:
|
|
405
407
|
- LICENSE.txt
|
406
408
|
- README.md
|
407
409
|
- Rakefile
|
410
|
+
- bin/make_figures
|
411
|
+
- bin/rename_screenshot
|
408
412
|
- bin/sc
|
409
413
|
- bin/softcover
|
410
414
|
- lib/softcover.rb
|
@@ -422,6 +426,7 @@ files:
|
|
422
426
|
- lib/softcover/article_template/epub/OEBPS/styles/custom_epub.css
|
423
427
|
- lib/softcover/article_template/epub/OEBPS/styles/epub.css
|
424
428
|
- lib/softcover/article_template/epub/OEBPS/styles/page-template.xpgt
|
429
|
+
- lib/softcover/article_template/full_size_figures/.gitkeep
|
425
430
|
- lib/softcover/article_template/html/.gitkeep
|
426
431
|
- lib/softcover/article_template/html/MathJax/MathJax.js
|
427
432
|
- lib/softcover/article_template/html/MathJax/config/TeX-AMS-MML_SVG.js
|
@@ -964,12 +969,12 @@ files:
|
|
964
969
|
- lib/softcover/article_template/html/stylesheets/custom.css
|
965
970
|
- lib/softcover/article_template/html/stylesheets/softcover.css
|
966
971
|
- lib/softcover/article_template/images/.gitkeep
|
967
|
-
- lib/softcover/article_template/images/01_michael_hartl_headshot.jpg
|
968
972
|
- lib/softcover/article_template/images/cover-web.png
|
969
973
|
- lib/softcover/article_template/images/cover.jpg
|
970
974
|
- lib/softcover/article_template/images/cover.pdf
|
971
975
|
- lib/softcover/article_template/images/cover.png
|
972
976
|
- lib/softcover/article_template/images/figures/.gitkeep
|
977
|
+
- lib/softcover/article_template/images/figures/01_michael_hartl_headshot.jpg
|
973
978
|
- lib/softcover/article_template/images/testimonial_1.png
|
974
979
|
- lib/softcover/article_template/latex_gitignore
|
975
980
|
- lib/softcover/article_template/latex_styles/applekeys.sty
|
@@ -1002,6 +1007,7 @@ files:
|
|
1002
1007
|
- lib/softcover/book_template/epub/OEBPS/styles/custom_epub.css
|
1003
1008
|
- lib/softcover/book_template/epub/OEBPS/styles/epub.css
|
1004
1009
|
- lib/softcover/book_template/epub/OEBPS/styles/page-template.xpgt
|
1010
|
+
- lib/softcover/book_template/full_size_figures/.gitkeep
|
1005
1011
|
- lib/softcover/book_template/html/.gitkeep
|
1006
1012
|
- lib/softcover/book_template/html/MathJax/MathJax.js
|
1007
1013
|
- lib/softcover/book_template/html/MathJax/config/TeX-AMS-MML_SVG.js
|
@@ -1544,13 +1550,13 @@ files:
|
|
1544
1550
|
- lib/softcover/book_template/html/stylesheets/custom.css
|
1545
1551
|
- lib/softcover/book_template/html/stylesheets/softcover.css
|
1546
1552
|
- lib/softcover/book_template/images/.gitkeep
|
1547
|
-
- lib/softcover/book_template/images/01_michael_hartl_headshot.jpg
|
1548
|
-
- lib/softcover/book_template/images/2011_michael_hartl.png
|
1549
1553
|
- lib/softcover/book_template/images/cover-web.png
|
1550
1554
|
- lib/softcover/book_template/images/cover.jpg
|
1551
1555
|
- lib/softcover/book_template/images/cover.pdf
|
1552
1556
|
- lib/softcover/book_template/images/cover.png
|
1553
1557
|
- lib/softcover/book_template/images/figures/.gitkeep
|
1558
|
+
- lib/softcover/book_template/images/figures/01_michael_hartl_headshot.jpg
|
1559
|
+
- lib/softcover/book_template/images/figures/2011_michael_hartl.png
|
1554
1560
|
- lib/softcover/book_template/images/testimonial_1.png
|
1555
1561
|
- lib/softcover/book_template/latex_gitignore
|
1556
1562
|
- lib/softcover/book_template/latex_styles/applekeys.sty
|