<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[663] trunk/alexandria/lib/alexandria/export_library.rb: export_library.rb: used CGI.escapeHTML when exporting ONIX (which is an XML) or HTML web page</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>663</dd>
<dt>Author</dt> <dd>laurusnobilis</dd>
<dt>Date</dt> <dd>2007-03-16 18:18:06 -0400 (Fri, 16 Mar 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>export_library.rb: used CGI.escapeHTML when exporting ONIX (which is an XML) or HTML web page</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkalexandrialibalexandriaexport_libraryrb">trunk/alexandria/lib/alexandria/export_library.rb</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkalexandrialibalexandriaexport_libraryrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/export_library.rb (662 => 663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/export_library.rb        2007-03-16 20:58:01 UTC (rev 662)
+++ trunk/alexandria/lib/alexandria/export_library.rb        2007-03-16 22:18:06 UTC (rev 663)
</span><span class="lines">@@ -15,6 +15,8 @@
</span><span class="cx"> # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
</span><span class="cx"> # Boston, MA 02111-1307, USA.
</span><span class="cx">
</span><ins>+require 'cgi'
+
</ins><span class="cx"> module Alexandria
</span><span class="cx"> class ExportFormat
</span><span class="cx"> attr_reader :name, :ext, :message
</span><span class="lines">@@ -146,22 +148,22 @@
</span><span class="cx"> prod.add_element('NotificationType').text = "03" # confirmed
</span><span class="cx"> prod.add_element('ProductForm').text = 'BA' # book
</span><span class="cx"> prod.add_element('ISBN').text = book.isbn
</span><del>- prod.add_element('DistinctiveTitle').text = book.title
</del><ins>+ prod.add_element('DistinctiveTitle').text = CGI.escapeHTML(book.title)
</ins><span class="cx"> unless book.authors.empty?
</span><span class="cx"> book.authors.each do |author|
</span><span class="cx"> elem = prod.add_element('Contributor')
</span><span class="cx"> # author
</span><span class="cx"> elem.add_element('ContributorRole').text = 'A01'
</span><del>- elem.add_element('PersonName').text = author
</del><ins>+ elem.add_element('PersonName').text = CGI.escapeHTML(author)
</ins><span class="cx"> end
</span><span class="cx"> end
</span><del>- prod.add_element('PublisherName').text = book.publisher
</del><ins>+ prod.add_element('PublisherName').text = CGI.escapeHTML(book.publisher)
</ins><span class="cx"> if book.notes and not book.notes.empty?
</span><span class="cx"> elem = prod.add_element('OtherText')
</span><span class="cx"> # reader description
</span><span class="cx"> elem.add_element('TextTypeCode').text = '12'
</span><span class="cx"> elem.add_element('TextFormat').text = '00' # ASCII
</span><del>- elem.add_element('Text').text = book.notes
</del><ins>+ elem.add_element('Text').text = CGI.escapeHTML(book.notes)
</ins><span class="cx"> end
</span><span class="cx"> if File.exists?(cover(book))
</span><span class="cx"> elem = prod.add_element('MediaFile')
</span><span class="lines">@@ -276,20 +278,20 @@
</span><span class="cx"> EOS
</span><span class="cx"> end
</span><span class="cx"> xhtml << <<EOS
</span><del>-<p class="book_title">#{book.title}</p>
</del><ins>+<p class="book_title">#{CGI.escapeHTML(book.title)}</p>
</ins><span class="cx"> EOS
</span><span class="cx"> unless book.authors.empty?
</span><span class="cx"> xhtml << "<ul class=\"book_authors\">"
</span><span class="cx"> book.authors.each do |author|
</span><span class="cx"> xhtml << <<EOS
</span><del>-<li class="book_author">#{author}</li>
</del><ins>+<li class="book_author">#{CGI.escapeHTML(author)}</li>
</ins><span class="cx"> EOS
</span><span class="cx"> end
</span><span class="cx"> xhtml << "</ul>"
</span><span class="cx"> end
</span><span class="cx"> xhtml << <<EOS
</span><del>-<p class="book_binding">#{book.edition}</p>
-<p class="book_publisher">#{book.publisher}</p>
</del><ins>+<p class="book_binding">#{CGI.escapeHTML(book.edition)}</p>
+<p class="book_publisher">#{CGI.escapeHTML(book.publisher)}</p>
</ins><span class="cx"> </div>
</span><span class="cx"> EOS
</span><span class="cx"> end
</span></span></pre>
</div>
</div>
</body>
</html>