softcover 1.7.5 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35f8216b104c6b6341a7ff95524712cc97fdafd2153fff6d6c69bcab3f113a06
4
- data.tar.gz: 691d43d5226885e4796440ec770bd0c19df2466fd180b3194a0de0f971a94c36
3
+ metadata.gz: 10ad29d53f34aed6c8b77b1a2f865001b8cd8f462a6da9fe9458650ca5ea8d58
4
+ data.tar.gz: 2ff71d58d7c0e40a0cc59c94c21902c38a483b1de063ee87fb408ea6d3896875
5
5
  SHA512:
6
- metadata.gz: 5a891f8b339375b86a3a4259b7fc9dc07d7f57aa1e2da8d8df3448ad2866a12af4c0ded3720675cbf33dd79121cf33cd4c6e590f096e91015684472a2cb5600c
7
- data.tar.gz: 101c6147113f550d1b56109ec33da95559198f7cd03e14838fd1b0bf44a5a127203d0f4a5e8c95d1960d34454fdcf05a6f1f5bc70298e11097078c1f7be0f23e
6
+ metadata.gz: 51164e791bd53574c7d143c8284af53c3279056bede0d98925f4cfa044d2765b75a9631b903734442ea5874c9a287566401bd3b4dfabdae6773281fd17824069
7
+ data.tar.gz: cddb5948112f74f02fa96a62a4d54f2a40f10e52be99ac51ffcea3e2bef5821e0053e51907a41822da15a41c5724066cbfe8b98f2ecd01b511c1f2678cc4280d
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- softcover (1.7.5)
5
- activesupport (~> 4.2.3)
4
+ softcover (1.8.1)
5
+ activesupport (= 4.2.11.3)
6
6
  async_sinatra (~> 1.1.0)
7
7
  coffee-script (>= 2.2.0)
8
8
  curb (>= 0.9.7)
@@ -11,12 +11,12 @@ PATH
11
11
  listen (~> 3.7.1)
12
12
  maruku (~> 0.7.1)
13
13
  msgpack (~> 1.2.0)
14
- nokogiri (>= 1.6.0, < 2.0)
15
- polytexnic (~> 1.7.2)
14
+ nokogiri (>= 1.14.0, < 2.0)
15
+ polytexnic (~> 1.8.0)
16
16
  pygments.rb (~> 2.1)
17
17
  rest-client (>= 1.8.0)
18
18
  ruby-progressbar (~> 1.10)
19
- sanitize (>= 4.6.3, < 5.3.0)
19
+ sanitize (~> 6.0.1)
20
20
  sinatra (~> 1.4.4)
21
21
  sinatra-respond_to (~> 0.9.0)
22
22
  thin (~> 1.6.1)
@@ -30,8 +30,8 @@ GEM
30
30
  minitest (~> 5.1)
31
31
  thread_safe (~> 0.3, >= 0.3.4)
32
32
  tzinfo (~> 1.1)
33
- addressable (2.8.0)
34
- public_suffix (>= 2.0.2, < 5.0)
33
+ addressable (2.8.1)
34
+ public_suffix (>= 2.0.2, < 6.0)
35
35
  async_sinatra (1.1.0)
36
36
  rack (>= 1.4.1)
37
37
  sinatra (>= 1.3.2)
@@ -40,7 +40,7 @@ GEM
40
40
  coffee-script-source
41
41
  execjs
42
42
  coffee-script-source (1.12.2)
43
- concurrent-ruby (1.1.10)
43
+ concurrent-ruby (1.2.2)
44
44
  coveralls (0.8.23)
45
45
  json (>= 1.8, < 3)
46
46
  simplecov (~> 0.16.1)
@@ -50,7 +50,7 @@ GEM
50
50
  crack (0.4.5)
51
51
  rexml
52
52
  crass (1.0.6)
53
- curb (1.0.0)
53
+ curb (1.0.5)
54
54
  daemons (1.4.1)
55
55
  diff-lcs (1.5.0)
56
56
  docile (1.4.0)
@@ -61,12 +61,12 @@ GEM
61
61
  ffi (1.15.5)
62
62
  hashdiff (1.0.1)
63
63
  http-accept (1.7.0)
64
- http-cookie (1.0.4)
64
+ http-cookie (1.0.5)
65
65
  domain_name (~> 0.5)
66
66
  i18n (0.9.5)
67
67
  concurrent-ruby (~> 1.0)
68
68
  json (2.3.1)
69
- kramdown (2.3.2)
69
+ kramdown (2.4.0)
70
70
  rexml
71
71
  listen (3.7.1)
72
72
  rb-fsevent (~> 0.10, >= 0.10.3)
@@ -75,33 +75,33 @@ GEM
75
75
  method_source (1.0.0)
76
76
  mime-types (3.4.1)
77
77
  mime-types-data (~> 3.2015)
78
- mime-types-data (3.2022.0105)
79
- minitest (5.15.0)
78
+ mime-types-data (3.2023.0218.1)
79
+ minitest (5.18.0)
80
80
  msgpack (1.2.10)
81
81
  netrc (0.11.0)
82
- nokogiri (1.13.3-x86_64-darwin)
82
+ nokogiri (1.14.2-arm64-darwin)
83
+ racc (~> 1.4)
84
+ nokogiri (1.14.2-x86_64-darwin)
83
85
  racc (~> 1.4)
84
- nokogumbo (2.0.5)
85
- nokogiri (~> 1.8, >= 1.8.4)
86
- polytexnic (1.7.2)
86
+ polytexnic (1.8.0)
87
87
  json (~> 2.3.0)
88
88
  kramdown (>= 2.0, < 3.0)
89
89
  msgpack (~> 1.2.0)
90
90
  nokogiri (>= 1.6.0, < 2.0)
91
91
  pygments.rb (~> 2.1)
92
- pry (0.14.1)
92
+ pry (0.14.2)
93
93
  coderay (~> 1.1)
94
94
  method_source (~> 1.0)
95
- public_suffix (4.0.6)
96
- pygments.rb (2.3.0)
97
- racc (1.6.0)
95
+ public_suffix (5.0.1)
96
+ pygments.rb (2.3.1)
97
+ racc (1.6.2)
98
98
  rack (1.6.13)
99
99
  rack-protection (1.5.5)
100
100
  rack
101
- rack-test (1.1.0)
102
- rack (>= 1.0, < 3)
101
+ rack-test (2.1.0)
102
+ rack (>= 1.3)
103
103
  rake (13.0.6)
104
- rb-fsevent (0.11.1)
104
+ rb-fsevent (0.11.2)
105
105
  rb-inotify (0.10.1)
106
106
  ffi (~> 1.0)
107
107
  rest-client (2.1.0)
@@ -118,13 +118,12 @@ GEM
118
118
  rspec-expectations (2.14.5)
119
119
  diff-lcs (>= 1.1.3, < 2.0)
120
120
  rspec-mocks (2.14.6)
121
- ruby-prof (1.4.3)
122
- ruby-progressbar (1.11.0)
121
+ ruby-prof (1.6.1)
122
+ ruby-progressbar (1.13.0)
123
123
  safe_yaml (1.0.4)
124
- sanitize (5.2.3)
124
+ sanitize (6.0.1)
125
125
  crass (~> 1.0.2)
126
- nokogiri (>= 1.8.0)
127
- nokogumbo (~> 2.0)
126
+ nokogiri (>= 1.12.0)
128
127
  simplecov (0.16.1)
129
128
  docile (~> 1.1)
130
129
  json (>= 1.8, < 3)
@@ -145,21 +144,24 @@ GEM
145
144
  rack (~> 1.0)
146
145
  thor (1.2.1)
147
146
  thread_safe (0.3.6)
148
- tilt (2.0.10)
149
- tins (1.31.0)
147
+ tilt (2.1.0)
148
+ tins (1.32.1)
150
149
  sync
151
- tzinfo (1.2.9)
150
+ tzinfo (1.2.11)
152
151
  thread_safe (~> 0.1)
153
152
  unf (0.1.4)
154
153
  unf_ext
155
- unf_ext (0.0.8.1)
156
- webmock (3.14.0)
154
+ unf_ext (0.0.8.2)
155
+ webmock (3.18.1)
157
156
  addressable (>= 2.8.0)
158
157
  crack (>= 0.3.2)
159
158
  hashdiff (>= 0.4.0, < 2.0.0)
160
159
 
161
160
  PLATFORMS
161
+ arm64-darwin-21
162
+ arm64-darwin-22
162
163
  x86_64-darwin-19
164
+ x86_64-darwin-21
163
165
 
164
166
  DEPENDENCIES
165
167
  coveralls
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Softcover
2
2
 
3
- [![CircleCI](https://circleci.com/gh/softcover/softcover.svg?style=shield)](https://circleci.com/gh/softcover/softcover) [![Coverage Status](https://coveralls.io/repos/softcover/softcover/badge.svg)](https://coveralls.io/github/softcover/softcover)
3
+ [![Coverage Status](https://coveralls.io/repos/softcover/softcover/badge.svg)](https://coveralls.io/github/softcover/softcover)
4
4
 
5
5
  Softcover is an ebook typesetting system for technical authors. This is the main gem, `softcover`, which depends on `polytexnic` to convert Markdown or PolyTeX input to HTML and LaTeX, and thence to EPUB, MOBI, and PDF. Authors can use Softcover to publish and optionally sell the resulting ebooks (as well as associated digital goods such as screencasts) on the [Softcover publishing platform](http://www.softcover.io/).
6
6
 
@@ -8,7 +8,6 @@ tmp/
8
8
  generated_polytex/
9
9
 
10
10
  .highlight_cache
11
- .softcover-book
12
11
 
13
12
  # Generated HTML files
14
13
  html/*.html
@@ -40,6 +40,7 @@
40
40
  % American Mathematical Society extensions
41
41
  \usepackage{amsmath}
42
42
  \usepackage{amsfonts}
43
+ \usepackage{amssymb}
43
44
  % 'Verbatim' environment
44
45
  \usepackage{fancyvrb}
45
46
  % Be able to resize text relative to other text
@@ -9,7 +9,6 @@ tmp/
9
9
  generated_polytex/
10
10
 
11
11
  .highlight_cache
12
- .softcover-book
13
12
 
14
13
  # Generated HTML files
15
14
  html/*.html
@@ -8,7 +8,6 @@ tmp/
8
8
  generated_polytex/
9
9
 
10
10
  .highlight_cache
11
- .softcover-book
12
11
 
13
12
  # Generated HTML files
14
13
  html/*.html
@@ -40,6 +40,7 @@
40
40
  % American Mathematical Society extensions
41
41
  \usepackage{amsmath}
42
42
  \usepackage{amsfonts}
43
+ \usepackage{amssymb}
43
44
  % 'Verbatim' environment
44
45
  \usepackage{fancyvrb}
45
46
  % Be able to resize text relative to other text
@@ -9,7 +9,6 @@ tmp/
9
9
  generated_polytex/
10
10
 
11
11
  .highlight_cache
12
- .softcover-book
13
12
 
14
13
  # Generated HTML files
15
14
  html/*.html
@@ -273,6 +273,12 @@ module Softcover
273
273
  end
274
274
  end
275
275
 
276
+ # Escapes spaces in filename directories.
277
+ # E.g., "Mobile Directory" becomes "Mobile\ Directory".
278
+ def escape_spaces(name)
279
+ name.gsub(' ', '\ ')
280
+ end
281
+
276
282
  # Returns HTML for HTML source that includes math.
277
283
  # As a side-effect, html_with_math creates PNGs corresponding to any
278
284
  # math in the given source. The technique involves using PhantomJS to
@@ -285,7 +291,8 @@ module Softcover
285
291
  content = File.read(File.join("html",
286
292
  "#{chapter.slug}.#{html_extension}"))
287
293
  pagejs = "#{File.dirname(__FILE__)}/utils/page.js"
288
- url = "file://#{Dir.pwd}/html/#{chapter.slug}.#{html_extension}"
294
+ dir = escape_spaces(Dir.pwd)
295
+ url = "file://" + dir + "/html/#{chapter.slug}.#{html_extension}"
289
296
  cmd = "#{phantomjs} #{pagejs} #{url}"
290
297
  silence { silence_stream(STDERR) { system cmd } }
291
298
  # Sometimes in tests the phantomjs_source.html file is missing.
data/lib/softcover/cli.rb CHANGED
@@ -97,11 +97,19 @@ module Softcover
97
97
  # ===============================================
98
98
 
99
99
  desc 'server', 'Run local server'
100
- method_option :port, type: :numeric, default: 4000, aliases: '-p'
100
+ method_option :port, type: :numeric, aliases: '-p'
101
101
  method_option :bind, type: :string, default: '0.0.0.0', aliases: '-o'
102
+ method_option :pdf, type: :boolean, default: false
103
+ method_option :overfull, type: :boolean, default: false
102
104
  def server
103
105
  if Softcover::BookManifest::valid_directory?
104
- Softcover::Commands::Server.run options[:port], options[:bind]
106
+ if options[:pdf]
107
+ port = options[:port] || 5000
108
+ else
109
+ port = options[:port] || 4000
110
+ end
111
+ Softcover::Commands::Server.run port, options[:bind],
112
+ options[:pdf], options[:overfull]
105
113
  else
106
114
  puts 'Not in a valid book directory.'
107
115
  exit 1
@@ -22,7 +22,7 @@ module Softcover
22
22
  str += line
23
23
 
24
24
  case line
25
- when %r{\\subsubsection{Exercises}}
25
+ when %r{\\subsection{Exercises}}
26
26
  in_exercise = true
27
27
  when %r{\\end{enumerate}}
28
28
  in_exercise = false
@@ -7,14 +7,14 @@ module Softcover::Commands::Server
7
7
  extend self
8
8
 
9
9
  # Listens for changes to the book's source files.
10
- def listen_for_changes
10
+ def listen_for_changes(is_pdf=false, overfull=false)
11
11
  return if defined?(@no_listener) && @no_listener
12
12
  server_pid = Process.pid
13
13
  filter_regex = /(\.md|\.tex|custom\.sty|custom\.css|Book\.txt|book\.yml)$/
14
14
  @listener = Listen.to('.', only: filter_regex, ignore: /html\//) do |modified|
15
15
  first_modified = modified.try(:first)
16
16
  unless first_modified =~ ignore_regex
17
- rebuild first_modified
17
+ rebuild(is_pdf, modified: first_modified, overfull: overfull)
18
18
  Process.kill("HUP", server_pid)
19
19
  end
20
20
  end
@@ -37,30 +37,42 @@ module Softcover::Commands::Server
37
37
  !Dir.glob(path('chapters/*.md')).empty?
38
38
  end
39
39
 
40
- def rebuild(modified=nil)
40
+ def rebuild(is_pdf, modified: nil, overfull: nil)
41
41
  printf modified ? "=> #{File.basename modified} changed, rebuilding... " :
42
42
  'Building...'
43
43
  t = Time.now
44
- builder = Softcover::Builders::Html.new
45
- builder.build
44
+
45
+ if is_pdf
46
+ if overfull
47
+ options = "--find-overfull"
48
+ else
49
+ options = "--once --nonstop --quiet"
50
+ end
51
+ system "softcover build:pdf #{options}"
52
+ else
53
+ builder = Softcover::Builders::Html.new
54
+ builder.build
55
+ end
46
56
  puts "Done. (#{(Time.now - t).round(2)}s)"
47
57
 
48
58
  rescue Softcover::BookManifest::NotFound => e
49
59
  puts e.message
50
60
  end
51
61
 
52
- def start_server(port, bind)
62
+ def start_server(port, bind, is_pdf)
53
63
  require 'softcover/server/app'
54
- puts "Running Softcover server on http://#{bind}:#{port}"
55
64
  Softcover::App.set :port, port
56
- Softcover::App.set :bind, bind
65
+ unless is_pdf
66
+ puts "Running Softcover server on http://#{bind}:#{port}"
67
+ Softcover::App.set :bind, bind
68
+ end
57
69
  Softcover::App.run!
58
70
  end
59
71
 
60
- def run(port, bind)
61
- rebuild
62
- listen_for_changes
63
- start_server port, bind
72
+ def run(port, bind, is_pdf, overfull)
73
+ rebuild(is_pdf, overfull: overfull)
74
+ listen_for_changes(is_pdf, overfull)
75
+ start_server port, bind, is_pdf
64
76
  end
65
77
  end
66
78
 
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "1.7.5"
2
+ VERSION = "1.8.1"
3
3
  end
data/softcover.gemspec CHANGED
@@ -18,11 +18,11 @@ 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.7.2'
21
+ gem.add_dependency 'polytexnic', '~> 1.8.0'
22
22
  gem.add_dependency 'msgpack', '~> 1.2.0'
23
- gem.add_dependency 'nokogiri', '>= 1.6.0', '< 2.0'
23
+ gem.add_dependency 'nokogiri', '>= 1.14.0', '< 2.0'
24
24
  gem.add_dependency 'thor', '>= 0.18.1', '< 2.0'
25
- gem.add_dependency 'activesupport', '~> 4.2.3'
25
+ gem.add_dependency 'activesupport', '4.2.11.3'
26
26
  gem.add_dependency 'i18n', '>= 0.7.0'
27
27
  gem.add_dependency 'rest-client', '>= 1.8.0'
28
28
  gem.add_dependency 'curb', '>= 0.9.7'
@@ -37,5 +37,5 @@ Gem::Specification.new do |gem|
37
37
  gem.add_dependency 'sinatra-respond_to', '~> 0.9.0'
38
38
  gem.add_dependency 'coffee-script', '>= 2.2.0'
39
39
  gem.add_dependency 'listen', '~> 3.7.1'
40
- gem.add_dependency 'sanitize', '>= 4.6.3', '< 5.3.0'
40
+ gem.add_dependency 'sanitize', '~> 6.0.1'
41
41
  end
@@ -13,10 +13,12 @@ describe Softcover::Commands::Server do
13
13
  it '#run' do
14
14
  Softcover::App.should_receive :run!
15
15
 
16
- port = 5000
17
- bind = "localhost"
16
+ port = 5000
17
+ bind = "localhost"
18
+ pdf = false
19
+ overfull = false
18
20
 
19
- subject.run port, bind
21
+ subject.run port, bind, pdf, overfull
20
22
 
21
23
  expect(Softcover::App.port).to eq port
22
24
  expect(Softcover::App.bind).to eq bind
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.7.5
4
+ version: 1.8.1
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: 2022-03-25 00:00:00.000000000 Z
12
+ date: 2023-03-15 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.7.2
20
+ version: 1.8.0
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.7.2
27
+ version: 1.8.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: msgpack
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -45,7 +45,7 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 1.6.0
48
+ version: 1.14.0
49
49
  - - "<"
50
50
  - !ruby/object:Gem::Version
51
51
  version: '2.0'
@@ -55,7 +55,7 @@ dependencies:
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: 1.6.0
58
+ version: 1.14.0
59
59
  - - "<"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.0'
@@ -83,16 +83,16 @@ dependencies:
83
83
  name: activesupport
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 4.2.3
88
+ version: 4.2.11.3
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
93
+ - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 4.2.3
95
+ version: 4.2.11.3
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: i18n
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -279,22 +279,16 @@ dependencies:
279
279
  name: sanitize
280
280
  requirement: !ruby/object:Gem::Requirement
281
281
  requirements:
282
- - - ">="
283
- - !ruby/object:Gem::Version
284
- version: 4.6.3
285
- - - "<"
282
+ - - "~>"
286
283
  - !ruby/object:Gem::Version
287
- version: 5.3.0
284
+ version: 6.0.1
288
285
  type: :runtime
289
286
  prerelease: false
290
287
  version_requirements: !ruby/object:Gem::Requirement
291
288
  requirements:
292
- - - ">="
293
- - !ruby/object:Gem::Version
294
- version: 4.6.3
295
- - - "<"
289
+ - - "~>"
296
290
  - !ruby/object:Gem::Version
297
- version: 5.3.0
291
+ version: 6.0.1
298
292
  description: Command-line interface for softcover.io
299
293
  email:
300
294
  - michael@softcover.io
@@ -506,7 +500,6 @@ files:
506
500
  - lib/softcover/book_template/images/cover.png
507
501
  - lib/softcover/book_template/images/figures/.gitkeep
508
502
  - lib/softcover/book_template/images/figures/01_michael_hartl_headshot.jpg
509
- - lib/softcover/book_template/images/figures/2011_michael_hartl.png
510
503
  - lib/softcover/book_template/images/testimonial_1.png
511
504
  - lib/softcover/book_template/latex_gitignore
512
505
  - lib/softcover/book_template/latex_styles/apple.eps