-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented Ruby 2.0 compatibility #3
Open
mwlang
wants to merge
8
commits into
metaskills:master
Choose a base branch
from
mwlang:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d8075c9
changes to work with Ruby 2.0
mwlang a496740
documented Ruby 2.0
mwlang 4b2069e
removed extraneous debugging code
mwlang f9764b0
changing ASCII-8BIT to WINDOWS-1252 encoding for writer
mwlang 89c7241
changing encoding to Windows-1252
mwlang f9e4912
reverted fileinfo back to ASCII-8BIT
mwlang 7abfd9b
testing ISO-8859-1 contents
mwlang 9339c70
removed debugging messages
mwlang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#encoding: UTF-8 | ||
$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib") | ||
require "pdf/writer" | ||
|
||
MAIN_TEXT_WIDTH = 330 | ||
MAIN_TEXT_LINE_SPACING = 16 | ||
PADDING_BOTTOM = 20 | ||
|
||
def write_text(pdf, text, options = {}) | ||
y = options[:y] if options[:y] | ||
left = options[:left] if options[:left] | ||
width = options[:width] if options[:width] | ||
size = options[:font_size] || 0 | ||
height = options[:leading] | ||
|
||
# Filled with the text that would flow onto the next page | ||
next_page_text = nil | ||
|
||
text.each_line do |line| | ||
start = true | ||
loop do | ||
break if (line.nil? or line.empty?) and not start | ||
|
||
start = false | ||
|
||
y -= height | ||
|
||
if y < (pdf.absolute_bottom_margin + PADDING_BOTTOM) | ||
if options[:no_newpage] | ||
# Collect remaining text so it can be returned | ||
next_page_text = "" if next_page_text.nil? | ||
next_page_text += line | ||
line = nil | ||
else | ||
pdf.start_new_page | ||
y = options[:new_page_y] || multi_page_top_y(pdf) | ||
end | ||
end | ||
|
||
if next_page_text.nil? | ||
line = pdf.add_text_wrap(left, y, width, line, size) | ||
end | ||
end | ||
end | ||
|
||
if options[:no_newpage] | ||
{:leftover_text => next_page_text, :next_line_y => y} | ||
else | ||
y | ||
end | ||
end | ||
|
||
|
||
pdf = PDF::Writer.new | ||
top_logo_file = '/Users/mwlang/projects/clients/taftlaw/taft_site/website/public/images/hr_taft_logo.jpg' | ||
pdf.image(top_logo_file, {:width => 85, :justification => :right, :pad => 0 }) | ||
|
||
body = "\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n\r\nCHARLES R. \"ROCKY\" SAXBE is Partner-in-Charge of the Columbus office. He maintains an active litigation practice representing clients in all aspects of civil litigation. Over the course of his illustrious career, he has acted as principal litigation counsel in numerous complex litigation cases, including serving as principal outside Ohio special counsel for the State of Ohio in the national tobacco litigation. He has appeared in numerous jury trials and has appeared before the Ohio Supreme Court, Ohio Courts of Appeals, and the Sixth Circuit U.S. Court of Appeals. According to <em>Chambers USA</em>, who interviews clients for feedback, Rocky is held in high regard \"for his political acumen, especially in election law-related and complex civil litigation.\" Rocky has a long affiliation with the political scene in Ohio, having served four terms in the Ohio House of Representatives. He provides counsel to elected officials, political party organizations and candidates on election, campaign finance and public ethics law.\r\n\r\n<strong>Representative Experience</strong>\r\n\r\n\r\n\t<C:bullet/>Served as principal outside Ohio special counsel for the State of Ohio in the \"national tobacco litigation,\" contributing significantly to the record setting $10 billion settlement for the State of Ohio.\r\n\t<C:bullet/>Has been the principal litigation counsel in numerous complex litigations, including numerous jury trials and has appeared before Ohio Supreme Court, Ohio Courts of Appeals, and the Sixth Circuit U.S. Court of Appeals.\r\n\t<C:bullet/>Provided counsel to elected officials, political party organizations and candidates on election, campaign finance and public ethics law.\r\n\t<C:bullet/>Frequent mediator assigned by the Federal Court for the Southern District of Ohio, providing expert testimony in the areas of attorneys' fees and malpractice.\r\n\t<C:bullet/>Serves as legislative counsel for the Ohio Association of Municipal and County Judges.\r\n\r\n\r\n<strong>Achievements and Awards</strong>\r\n\r\n\r\n\t<C:bullet/>Recipient of the Ohio State Bar Association Distinguished Service Award\r\n\t<C:bullet/>AV Peer Review (Preeminent) Rated by Martindale-Hubbell\r\n\t<C:bullet/><em>Best Lawyers in America, </em>Commercial Litigation, Government Relations Law & Bet-the-Company Litigation\r\n\t<C:bullet/>Listed for inclusion in <em>Ohio Super Lawyers</em>, General Litigation (2004 - 2013)\r\n\t<C:bullet/><em>Chambers USA</em>, Litigation\r\n\r\n\r\n<strong>Professional Memberships and Community Service</strong>\r\n\r\n\r\n\t<C:bullet/>Columbus Bar Association\r\n\t<C:bullet/>Ohio State Bar Association\r\n\t<C:bullet/>American Bar Associations\r\n\t<C:bullet/>Champaign County Bar Association\r\n\t<C:bullet/>Greater Columbus Arts Council, Past Chairman\r\n\t<C:bullet/>Bexley Library Board, Past President\r\n\t<C:bullet/>Columbus College of Art and Design, Past Chairman\r\n\t<C:bullet/>Central State University, Past Trustee\r\n\t<C:bullet/>Mechanicsburg Lodge #113 F&AM, Past Master\r\n\t<C:bullet/>Ancient and Accepted Scottish Rite, 33°\r\n\t<C:bullet/>Vietnam Veterans of America\r\n\t<C:bullet/>American Legion\r\n\t<C:bullet/>Scioto Valley Rugby Football Club (SVRFC Hall of Fame)\r\n\r\n\r\n<strong>Other Professional Experience</strong>\r\n\r\n\r\n\t<C:bullet/>U.S. Marine Corps, infantry platoon commander with the First Marine Division in the Republic of Vietnam and was discharged with the rank of Captain\r\n\t<C:bullet/>Elected to the Ohio House of Representatives in 1974 where he served four terms\r\n\t<C:bullet/>Republican nominee for Ohio Attorney General in 1982\r\n\r\n" | ||
write_text(pdf, | ||
body, | ||
{ | ||
:no_newpage => true, | ||
:y => pdf.absolute_top_margin - 140, | ||
:left => pdf.absolute_left_margin, | ||
:leading => MAIN_TEXT_LINE_SPACING, | ||
:width => MAIN_TEXT_WIDTH | ||
} | ||
) | ||
|
||
pdf.render |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made me laugh