Prev | Current Page 168 | Next

David Berube

"Practical Reporting with Ruby and Rails"

They are
marked with italics in Listing 6-2. See the ???Using eBay APIs??? section earlier in this chapter for instructions on
how to sign up for an eBay developer account and create an authorization token.
Finally, the last part of the code, shown in Listing 6-3, will create the report in LaTeX
and print out the results to a PDF file.
Listing 6-3. Average Price Reporter, Part 3 (average_price_report.rb)
class String
def latex_escape()
replacements= { '\\' =>'$\backslash$',
'$'=>'\$',
'%'=>'\%',
'&'=>'\&',
'_'=>'\_',
'~'=>'*~*',
'#'=>'\#',
'{'=>'$\{$',
'}'=>'$\}$',
}
self.gsub(/[#{replacements.keys.join('|')}]/) do |match|
replacements[match]
end
end
end
temporary_latex_file='average_price_report.tex' # This file name will also control
# the output file name. The
# file will be named
# average_price_report.pdf.
latex_source='
\documentclass[8pt]{article}
\begin{document}
CHAPTER 6 n TRACKING AUCTIONS WITH EBAY 119
\huge % Switch to huge size and
\textbf{Competitor Average Price Report} % print a header at the
% top of the page.


Pages:
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
Katie Melua badania kierowców sennik siatki expekt