petit-felix 0.1.4 → 0.1.5

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petit-felix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - PunishedFelix
@@ -43,6 +43,20 @@ dependencies:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.1.12
46
+ - !ruby/object:Gem::Dependency
47
+ name: eqn
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: 1.6.5
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 1.6.5
46
60
  description: Converts markdown files into PDF documents using options passed in a
47
61
  hash.
48
62
  email:
@@ -57,10 +71,18 @@ files:
57
71
  - lib/felix/metadata.rb
58
72
  - lib/felix/task_manager.rb
59
73
  - lib/petit-felix.rb
60
- - lib/task/basic_pdf_task.rb
74
+ - lib/task/basic_pdf_classic_task.rb
61
75
  - lib/task/default_task.rb
76
+ - lib/task/pdf_single_task.rb
77
+ - lib/task/template_pdf_task.rb
62
78
  - lib/version.rb
63
- - lib/worker/basic_pdf_writer.rb
79
+ - lib/worker/basic_pdf_writer_classic.rb
80
+ - lib/worker/pdf_writer.rb
81
+ - lib/worker/pdf_writer/bounding_box.rb
82
+ - lib/worker/pdf_writer/column_box.rb
83
+ - lib/worker/template_pdf_calls.rb
84
+ - lib/worker/template_pdf_writer.rb
85
+ - templates/zine-single.json
64
86
  homepage: https://github.com/badgernested/petit-felix
65
87
  licenses:
66
88
  - MIT
@@ -68,6 +90,7 @@ metadata: {}
68
90
  rdoc_options: []
69
91
  require_paths:
70
92
  - lib
93
+ - templates
71
94
  required_ruby_version: !ruby/object:Gem::Requirement
72
95
  requirements:
73
96
  - - ">="
@@ -1,133 +0,0 @@
1
- require "task/default_task"
2
- require "worker/basic_pdf_writer"
3
-
4
- module PetitFelix
5
-
6
- module Task
7
-
8
- class BasicPDFTask < PetitFelix::Task::DefaultTask
9
-
10
- NAME = "basic_pdf"
11
-
12
- ## Default options of the application
13
- DEFAULT_OPTIONS = {
14
- "columns" => 1,
15
- "default_font_size" => 12,
16
- "header1_size" => 32,
17
- "header2_size" => 28,
18
- "header3_size" => 20,
19
- "header4_size" => 18,
20
- "header5_size" => 16,
21
- "header6_size" => 14,
22
- "quote_size" => 14,
23
- "margin" => 40,
24
- "font_normal" => "./assets/font/Unageo-Regular.ttf",
25
- "font_italic"=> "./assets/font/Unageo-Regular-Italic.ttf",
26
- "font_bold"=> "./assets/font/Unageo-ExtraBold.ttf",
27
- "font_bold_italic" => "./assets/font/Unageo-ExtraBold-Italic.ttf",
28
- "paginator_start_count" => 1,
29
- "paginator_start" => 1,
30
- "paginator" => true,
31
- "paginator_alternate" => false,
32
- "back_text" => "",
33
- "back_text_margin" => 0,
34
- "back_text_size" => 14,
35
- "front_title_size"=> 32,
36
- "front_author_size" => 18,
37
- "front_date_size" => 14,
38
- "back_publisher" => "",
39
- "back_publisher_size" => 14,
40
- "front_publisher" => "",
41
- "front_publisher_size" => 14,
42
- "paginator_size" => 12,
43
- "back_author" => "",
44
- "back_author_size" => 16,
45
- }
46
-
47
-
48
- def render_zine options
49
-
50
- page = File.read(options["filename"])
51
-
52
- # splits the page into parts for metadata and content
53
-
54
- # Felix metadata handler
55
- metadata_helper = PetitFelix::Metadata.new
56
-
57
- page_data = metadata_helper.split page
58
-
59
- metadata = metadata_helper.get_metadata page_data[0]
60
-
61
- content = page_data[1]
62
-
63
- # stores options + metadata. metadata overrides options.
64
- metaoptions = {}
65
-
66
- options.keys.each do |key|
67
- metaoptions[key] = options[key]
68
- end
69
-
70
- metadata.keys.each do |key|
71
- metaoptions[key] = metadata[key]
72
- end
73
-
74
- # Only continue if metadata has a title
75
-
76
- if metadata.key?("title")
77
-
78
- # Parameters
79
-
80
- page_layout = :portrait
81
- print_scaling = :none
82
-
83
- if metaoptions.key?("page_layout")
84
- page_layout = metaoptions["page_layout"]
85
-
86
- if page_layout.is_a? String
87
- if page_layout.include?("portrait")
88
- page_layout = :portrait
89
- else
90
- if page_layout.include?("landscape")
91
- page_layout = :landscape
92
- end
93
- end
94
- end
95
- end
96
-
97
- # Generates PDF
98
-
99
- pdf = PetitFelix::Worker::BasicPDFWriter.new(
100
- page_layout: page_layout,
101
- print_scaling: print_scaling)
102
-
103
- pdf.set_options metaoptions
104
-
105
- # Adds extra fonts
106
-
107
- pdf.initialize_font
108
-
109
- # Title page generation
110
-
111
- pdf.title_page
112
-
113
- # Does the main content
114
- pdf.main_block content
115
-
116
- # Does page numbering
117
- pdf.page_numbering
118
-
119
- # Back page generation
120
- pdf.back_page
121
-
122
- # Outputs to file
123
- pdf.output
124
-
125
- end
126
- end
127
-
128
-
129
- end
130
-
131
- end
132
-
133
- end