<!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 = &quot;03&quot;  # 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 &lt;&lt; &lt;&lt;EOS
</span><del>-&lt;p class=&quot;book_title&quot;&gt;#{book.title}&lt;/p&gt;
</del><ins>+&lt;p class=&quot;book_title&quot;&gt;#{CGI.escapeHTML(book.title)}&lt;/p&gt;
</ins><span class="cx"> EOS
</span><span class="cx">                 unless book.authors.empty?
</span><span class="cx">                     xhtml &lt;&lt; &quot;&lt;ul class=\&quot;book_authors\&quot;&gt;&quot;
</span><span class="cx">                     book.authors.each do |author|
</span><span class="cx">                         xhtml &lt;&lt; &lt;&lt;EOS
</span><del>-&lt;li class=&quot;book_author&quot;&gt;#{author}&lt;/li&gt;
</del><ins>+&lt;li class=&quot;book_author&quot;&gt;#{CGI.escapeHTML(author)}&lt;/li&gt;
</ins><span class="cx"> EOS
</span><span class="cx">                     end
</span><span class="cx">                     xhtml &lt;&lt; &quot;&lt;/ul&gt;&quot;
</span><span class="cx">                 end
</span><span class="cx">                 xhtml &lt;&lt; &lt;&lt;EOS
</span><del>-&lt;p class=&quot;book_binding&quot;&gt;#{book.edition}&lt;/p&gt;
-&lt;p class=&quot;book_publisher&quot;&gt;#{book.publisher}&lt;/p&gt;
</del><ins>+&lt;p class=&quot;book_binding&quot;&gt;#{CGI.escapeHTML(book.edition)}&lt;/p&gt;
+&lt;p class=&quot;book_publisher&quot;&gt;#{CGI.escapeHTML(book.publisher)}&lt;/p&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> EOS
</span><span class="cx">             end
</span></span></pre>
</div>
</div>

</body>
</html>