publishr 0.5.3 → 0.5.4
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.
- data/lib/document_skeleton/.gitignore +3 -0
- data/lib/epub_skeleton/epub.css +5 -0
- data/lib/publishr/epub_renderer.rb +3 -2
- data/lib/publishr/html_processor.rb +8 -1
- data/lib/publishr/project.rb +5 -4
- data/lib/publishr/version.rb +1 -1
- metadata +11 -16
- data/publishr/.gitignore +0 -4
- data/publishr/Gemfile +0 -4
- data/publishr/Rakefile +0 -1
- data/publishr/lib/publishr.rb +0 -5
- data/publishr/lib/publishr/version.rb +0 -3
- data/publishr/publishr.gemspec +0 -24
data/lib/epub_skeleton/epub.css
CHANGED
@@ -17,12 +17,13 @@
|
|
17
17
|
|
18
18
|
module Publishr
|
19
19
|
class EpubRenderer
|
20
|
-
def initialize(name,inpath,outpath,metadata)
|
20
|
+
def initialize(name,inpath,outpath,metadata,rails_resources_url='')
|
21
21
|
@name = name
|
22
22
|
@inpath = inpath
|
23
23
|
@outpath = outpath
|
24
24
|
@metadata = metadata
|
25
25
|
@gempath = Publishr::gempath
|
26
|
+
@rails_resources_url = rails_resources_url
|
26
27
|
|
27
28
|
@html_files = []
|
28
29
|
@image_files = []
|
@@ -53,7 +54,7 @@ module Publishr
|
|
53
54
|
Dir[File.join(@inpath,'*.txt')].each do |infilepath|
|
54
55
|
kramdown = File.open(infilepath, 'r').read
|
55
56
|
html = Kramdown::Document.new(kramdown, kramdown_options).to_html
|
56
|
-
degraded_html = HtmlProcessor.new(html,@inpath,@metadata
|
57
|
+
degraded_html = HtmlProcessor.new(html,@inpath,@metadata,@rails_resources_url).degrade
|
57
58
|
outfilepath = File.join(@outpath, File.basename(infilepath).gsub(/(.*).txt/, '\1.html'))
|
58
59
|
File.open(outfilepath, 'w'){ |f| f.write degraded_html }
|
59
60
|
end
|
@@ -44,7 +44,8 @@ module Publishr
|
|
44
44
|
improve_typography
|
45
45
|
make_uppercase
|
46
46
|
change_footnote_references
|
47
|
-
|
47
|
+
mark_merge_conflicts
|
48
|
+
change_resources_url_for_rails unless @rails_resources_url.to_s.empty?
|
48
49
|
process_footnotes if @process_footnotes == true
|
49
50
|
add_footnote if @add_footnote == true and @line.include?('<p>')
|
50
51
|
end
|
@@ -104,5 +105,11 @@ module Publishr
|
|
104
105
|
@line.gsub!(/href="(.*?.css)/){ "href=\"#{ @rails_resources_url }#{ $1 }" }
|
105
106
|
@line.gsub!(/src="(.*?.jpg)/){ "src=\"#{ @rails_resources_url }#{ $1 }" }
|
106
107
|
end
|
108
|
+
|
109
|
+
def mark_merge_conflicts
|
110
|
+
@line.gsub! /«««.*$/, '<span style="color:red;">'
|
111
|
+
@line.gsub! '=======', '</span></p><p><span style="color:orange;">'
|
112
|
+
@line.gsub! /»»».*$/, '</span></p>'
|
113
|
+
end
|
107
114
|
end
|
108
115
|
end
|
data/lib/publishr/project.rb
CHANGED
@@ -21,17 +21,18 @@ module Publishr
|
|
21
21
|
@@gempath = File.expand_path('../../../', __FILE__)
|
22
22
|
|
23
23
|
class Project
|
24
|
-
def initialize(name,absolutepath,absoluteconverterspath)
|
24
|
+
def initialize(name,absolutepath,absoluteconverterspath,rails_resources_url='')
|
25
25
|
@name = name
|
26
26
|
@inpath = absolutepath
|
27
27
|
@converterspath = absoluteconverterspath
|
28
|
+
@rails_resources_url = rails_resources_url
|
28
29
|
|
29
30
|
@metadata = YAML::load(File.open(File.join(@inpath,'metadata.yml'), 'r').read)
|
30
31
|
end
|
31
32
|
|
32
33
|
def make_kindle
|
33
34
|
outpath = File.join(@inpath,'epub')
|
34
|
-
epub = EpubRenderer.new(@name,@inpath,outpath,@metadata)
|
35
|
+
epub = EpubRenderer.new(@name,@inpath,outpath,@metadata, @rails_resources_url)
|
35
36
|
epub.render
|
36
37
|
binaryfile = File.join(@converterspath,'kindlegen')
|
37
38
|
epubfile = File.join(@inpath,"#{ @name }.epub")
|
@@ -42,8 +43,8 @@ module Publishr
|
|
42
43
|
lines << line
|
43
44
|
end
|
44
45
|
end
|
45
|
-
FileUtils.rm_r outpath
|
46
|
-
#FileUtils.cp File.join(@inpath,"#{ @name }.mobi"), '/media/Kindle/documents'
|
46
|
+
# FileUtils.rm_r outpath
|
47
|
+
# FileUtils.cp File.join(@inpath,"#{ @name }.mobi"), '/media/Kindle/documents'
|
47
48
|
lines.join('<br />')
|
48
49
|
end
|
49
50
|
|
data/lib/publishr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: publishr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: kramdown
|
16
|
-
requirement: &
|
16
|
+
requirement: &9112700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9112700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: kramdown
|
27
|
-
requirement: &
|
27
|
+
requirement: &9111420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *9111420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sanitize
|
38
|
-
requirement: &
|
38
|
+
requirement: &9110300 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *9110300
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sanitize
|
49
|
-
requirement: &
|
49
|
+
requirement: &9095620 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *9095620
|
58
58
|
description: Fast publishing for ebooks and paper
|
59
59
|
email:
|
60
60
|
- michael@billgastro.com
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- README
|
69
69
|
- Rakefile
|
70
70
|
- bin/publishr
|
71
|
+
- lib/document_skeleton/.gitignore
|
71
72
|
- lib/document_skeleton/cover.jpg
|
72
73
|
- lib/document_skeleton/covertext.txt
|
73
74
|
- lib/document_skeleton/frontmatter.txt
|
@@ -92,12 +93,6 @@ files:
|
|
92
93
|
- lib/publishr/version.rb
|
93
94
|
- lib/tex_templates/book.tex
|
94
95
|
- publishr.gemspec
|
95
|
-
- publishr/.gitignore
|
96
|
-
- publishr/Gemfile
|
97
|
-
- publishr/Rakefile
|
98
|
-
- publishr/lib/publishr.rb
|
99
|
-
- publishr/lib/publishr/version.rb
|
100
|
-
- publishr/publishr.gemspec
|
101
96
|
homepage: ''
|
102
97
|
licenses: []
|
103
98
|
post_install_message:
|
data/publishr/.gitignore
DELETED
data/publishr/Gemfile
DELETED
data/publishr/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/publishr/lib/publishr.rb
DELETED
data/publishr/publishr.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "publishr/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "publishr"
|
7
|
-
s.version = Publishr::VERSION
|
8
|
-
s.authors = ["Michael Franzl"]
|
9
|
-
s.email = ["michael@billgastro.com"]
|
10
|
-
s.homepage = ""
|
11
|
-
s.summary = %q{TODO: Write a gem summary}
|
12
|
-
s.description = %q{TODO: Write a gem description}
|
13
|
-
|
14
|
-
s.rubyforge_project = "publishr"
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
# specify any dependencies here; for example:
|
22
|
-
# s.add_development_dependency "rspec"
|
23
|
-
# s.add_runtime_dependency "rest-client"
|
24
|
-
end
|