rock_books 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE_NOTES.md +5 -0
- data/lib/rock_books/documents/book_set.rb +7 -0
- data/lib/rock_books/helpers/html_helper.rb +29 -0
- data/lib/rock_books/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7462246cd8ae62e943c75905486e1732586bd2d9c746c5ea145bd3c751cf637
|
4
|
+
data.tar.gz: 78fa22e6f1186a552d453340d2ac052e342f959ea1fb58c9a8ed6fc0ea4ed37b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b24be35a05935f8ae333f656d6400523a43a8f118b54cb0d42ecdc64bc405ac1ee5543d4292deef13676f898597ff6548142beb5089dc041fddd3e06bdceb6a0
|
7
|
+
data.tar.gz: 458d376cbad3a5d420c3908c6eb8a33037539b6d43d28f50ca5f55327d76edcd85b4d243a975fe72efdda40e0ea96b64570d3e3e551ef8678e354be0d05e4232
|
data/RELEASE_NOTES.md
CHANGED
@@ -3,6 +3,7 @@ require 'awesome_print'
|
|
3
3
|
require_relative 'chart_of_accounts'
|
4
4
|
require_relative 'journal'
|
5
5
|
require_relative '../filters/journal_entry_filters' # for shell mode
|
6
|
+
require_relative '../helpers/html_helper'
|
6
7
|
require_relative '../helpers/parse_helper'
|
7
8
|
require_relative '../reports/balance_sheet'
|
8
9
|
require_relative '../reports/income_statement'
|
@@ -113,6 +114,12 @@ module RockBooks
|
|
113
114
|
run_command("textutil -convert html -font 'Courier New Bold' -fontsize 11 #{txt_filespec} -output #{html_filespec}")
|
114
115
|
run_command("cupsfilter #{html_filespec} > #{pdf_filespec}")
|
115
116
|
run_command("textutil -convert html -font 'Courier New Bold' -fontsize 14 #{txt_filespec} -output #{html_filespec}")
|
117
|
+
|
118
|
+
hyperlinkized_text, replacements_made = HtmlHelper.convert_receipts_to_hyperlinks(File.read(html_filespec))
|
119
|
+
if replacements_made
|
120
|
+
File.write(html_filespec, hyperlinkized_text)
|
121
|
+
end
|
122
|
+
|
116
123
|
puts "Created reports in txt, html, and pdf for #{"%-20s" % short_name} at #{File.dirname(txt_filespec)}.\n\n\n"
|
117
124
|
end
|
118
125
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module RockBooks
|
2
|
+
module HtmlHelper
|
3
|
+
|
4
|
+
module_function
|
5
|
+
|
6
|
+
def self.convert_receipts_to_hyperlinks(html_text)
|
7
|
+
html_lines = html_text.split("\n")
|
8
|
+
replacements_made = false
|
9
|
+
|
10
|
+
html_lines.each_with_index do |line, index|
|
11
|
+
matches = /Receipt:\s*(.*?)</.match(line)
|
12
|
+
if matches
|
13
|
+
receipt_filespec = matches[1]
|
14
|
+
line_with_hyperlink = line.gsub( \
|
15
|
+
/Receipt:\s*#{receipt_filespec}/, \
|
16
|
+
%Q{Receipt: <a href="../../../receipts/#{receipt_filespec}">#{receipt_filespec}</a>})
|
17
|
+
html_lines[index] = line_with_hyperlink
|
18
|
+
replacements_made = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if replacements_made
|
23
|
+
html_text = html_lines.join("\n")
|
24
|
+
end
|
25
|
+
|
26
|
+
[html_text, replacements_made]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/rock_books/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Bennett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/rock_books/filters/acct_amount_filters.rb
|
119
119
|
- lib/rock_books/filters/journal_entry_filters.rb
|
120
120
|
- lib/rock_books/helpers/book_set_loader.rb
|
121
|
+
- lib/rock_books/helpers/html_helper.rb
|
121
122
|
- lib/rock_books/helpers/parse_helper.rb
|
122
123
|
- lib/rock_books/reports/balance_sheet.rb
|
123
124
|
- lib/rock_books/reports/income_statement.rb
|