Merge pull request #54 from gutenbergtools/bk_debug

Bk debug into gutenberg1
random_search
Marshall Zhao 2020-06-11 16:09:32 -04:00 committed by GitHub
commit e70fb4a6e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 123 additions and 127 deletions

View File

@ -48,6 +48,9 @@ class CoverPages (object):
title = gg.xmlspecialchars (row.title)
#Shortening long titles for latest covers
title = title.replace ('"', '"')
title = title.replace ('<', '&lt;')
title = title.replace ('>', '&gt;')
title = title.replace ("'", '&apos;')
short_title = title
title_len = len(title)
short_title = re.sub(r"\-+"," ",short_title)

View File

@ -1,14 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
DON'T USE THIS PAGE FOR SCRAPING.
Seriously. You'll only get your IP blocked.
Read http://www.gutenberg.org/feeds/ to learn how to download Project
Gutenberg metadata much faster than by scraping.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
@ -128,8 +124,7 @@ ${site_top()}
<div id="qr">
<!--! qr code of desktop page for print -->
<span class="qrcode qrcode-desktop noscreen" />
<!--! qr code of mobile page for screen -->
<span class="qrcode qrcode-mobile noprint" title="Go to our mobile site." />
</div>
</div>
@ -139,151 +134,6 @@ ${site_top()}
<li><a href="#download">Download</a></li>
<li><a href="#bibrec">Bibrec</a></li>
</ul>
<div id="bibrec" i18n:comment="On the 'bibrec' tab of the 'bibrec' page.">
<py:for each="e in os.entries">
<py:if test="isinstance (e, bs.DC)">
<div typeof="pgterms:ebook" about="[ebook:$e.project_gutenberg_id]">
<h2>Bibliographic Record <span>${help (_('Table: Bibliographic Record'))}</span></h2>
<table class="bibrec" >
<colgroup>
<col class="narrow" />
<col />
</colgroup>
<tr py:for="author in e.authors">
<th>${author.role}</th>
<td>
<a href="/browse/authors/${author.first_lettter}#a${author.id}"
rel="marcrel:${author.marcrel}" about="/authors/" typeof="pgterms:agent"
itemprop="creator">${author.name_and_dates}</a></td>
</tr>
<tr py:for="marc in e.marcs">
<th>${marc.caption}</th>
<py:choose test="">
<td py:when="marc.code == '010'">
<a class="external"
href="http://lccn.loc.gov/${marc.text}"
title="Look up this book in the Library of Congress catalog.">${marc.text} <span class="icon icon_external_link"/></a>
</td>
<td py:when="marc.code[0]=='5'">
<?python
text = gg.xmlspecialchars (marc.text)
text = re.sub (r'(//\S+)', r'<a href="\1">\1</a>', text)
text = re.sub (r'#(\d+)', r'<a href="/ebooks/\1">#\1</a>', text)
?>
${ Markup (gg.insert_breaks (text)) }
</td>
<td py:when="marc.code=='245'" itemprop="headline">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
<td py:when="marc.code=='240'" itemprop="alternativeHeadline">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
<td py:when="marc.code=='246'" itemprop="alternativeHeadline">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
<td py:otherwise="">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
</py:choose>
</tr>
<tr py:for="language in e.languages"
property="dcterms:language" datatype="dcterms:RFC4646" itemprop="inLanguage" content="${language.id}">
<th>Language</th>
<td py:if="language.id != 'en'"><a href="/browse/languages/${language.id}">${language.language}</a></td>
<td py:if="language.id == 'en'">${language.language}</td>
</tr>
<tr py:for="locc in e.loccs"
property="dcterms:subject" datatype="dcterms:LCC" content="${locc.id}">
<th>LoC Class</th>
<td>
<a href="/browse/loccs/${locc.id.lower ()}">${locc.id}: ${locc.locc}</a>
</td>
</tr>
<tr py:for="subject in e.subjects">
<th>Subject</th>
<td property="dcterms:subject" datatype="dcterms:LCSH">
<a class="block" href="${os.url ('subject', id = subject.id)}">
${subject.subject}
</a>
</td>
</tr>
<tr py:for="dcmitype in e.dcmitypes">
<th>Category</th>
<td property="dcterms:type" datatype="dcterms:DCMIType">${dcmitype.description}</td>
</tr>
<tr>
<th>EBook-No.</th>
<td>${e.project_gutenberg_id}</td>
</tr>
<tr property="dcterms:issued" datatype="xsd:date" content="${e.xsd_release_date_time}">
<th>Release Date</th>
<td itemprop="datePublished">${e.hr_release_date}</td>
</tr>
<tr>
<th>Copyright Status</th>
<td property="dcterms:rights">${e.rights}</td>
</tr>
<tr>
<th>Downloads</th>
<td itemprop="interactionCount" i18n:msg="count">${e.downloads} downloads in the last 30 days.</td>
</tr>
<tr itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">
<th>Price</th>
<td><span itemprop="priceCurrency" content="USD" /><span itemprop="price">$0.00</span><span itemprop="availability" content="In Stock" ><a href="http://schema.org/InStock"></a></span></td>
</tr>
</table>
</div>
</py:if>
</py:for>
<div id="more_stuff">
<py:for each="n, e in enumerate (os.entries)">
<py:if test="isinstance (e, bs.Cat) and e.rel not in ('start', )">
<py:if test="e.header and old_header != e.header">
<h2 class="header">${e.header}</h2>
</py:if>
<?python old_header = e.header ?>
<div class="${e.class_}">
<a rel="nofollow"
href="${e.url}"
type="${e.type}"
charset="${e.charset}"
accesskey="${str (n % 10)}">
<span class="cell leftcell">
<span class="icon icon_${e.icon}" />
</span>
<span class="cell content">
<span class="title">${e.title}</span>
<span py:if="e.subtitle" class="subtitle">${e.subtitle}</span>
<span py:if="e.extra" class="extra">${e.extra}</span>
</span>
<span class="hstrut" />
</a>
</div>
</py:if>
</py:for>
</div> <!-- more stuff -->
</div> <!--! bibrec -->
<div id="download" i18n:comment="On the 'Download' tab of the 'bibrec' page.">
<py:for each="e in os.entries">
@ -365,6 +215,150 @@ ${site_top()}
</div> <!-- download -->
<div id="more_stuff">
<py:for each="n, e in enumerate (os.entries)">
<py:if test="isinstance (e, bs.Cat) and e.rel not in ('start', )">
<py:if test="e.header and old_header != e.header">
<h2 class="header">${e.header}</h2>
</py:if>
<?python old_header = e.header ?>
<div class="${e.class_}">
<a rel="nofollow"
href="${e.url}"
type="${e.type}"
charset="${e.charset}"
accesskey="${str (n % 10)}">
<span class="cell leftcell">
<span class="icon icon_${e.icon}" />
</span>
<span class="cell content">
<span class="title">${e.title}</span>
<span py:if="e.subtitle" class="subtitle">${e.subtitle}</span>
<span py:if="e.extra" class="extra">${e.extra}</span>
</span>
<span class="hstrut" />
</a>
</div>
</py:if>
</py:for>
</div> <!-- more stuff -->
<div id="bibrec" i18n:comment="On the 'bibrec' tab of the 'bibrec' page.">
<py:for each="e in os.entries">
<py:if test="isinstance (e, bs.DC)">
<div typeof="pgterms:ebook" about="[ebook:$e.project_gutenberg_id]">
<h2>Bibliographic Record <span>${help (_('Table: Bibliographic Record'))}</span></h2>
<table class="bibrec" >
<colgroup>
<col class="narrow" />
<col />
</colgroup>
<tr py:for="author in e.authors">
<th>${author.role}</th>
<td>
<a href="/browse/authors/${author.first_lettter}#a${author.id}"
rel="marcrel:${author.marcrel}" about="/authors/" typeof="pgterms:agent"
itemprop="creator">${author.name_and_dates}</a></td>
</tr>
<tr py:for="marc in e.marcs">
<th>${marc.caption}</th>
<py:choose test="">
<td py:when="marc.code == '010'">
<a class="external"
href="http://lccn.loc.gov/${marc.text}"
title="Look up this book in the Library of Congress catalog.">${marc.text} <span class="icon icon_external_link"/></a>
</td>
<td py:when="marc.code[0]=='5'">
<?python
text = gg.xmlspecialchars (marc.text)
text = re.sub (r'(//\S+)', r'<a href="\1">\1</a>', text)
text = re.sub (r'#(\d+)', r'<a href="/ebooks/\1">#\1</a>', text)
?>
${ Markup (gg.insert_breaks (text)) }
</td>
<td py:when="marc.code=='245'" itemprop="headline">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
<td py:when="marc.code=='240'" itemprop="alternativeHeadline">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
<td py:when="marc.code=='246'" itemprop="alternativeHeadline">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
<td py:otherwise="">
${ Markup (gg.insert_breaks (gg.xmlspecialchars (marc.text))) }
</td>
</py:choose>
</tr>
<tr py:for="language in e.languages"
property="dcterms:language" datatype="dcterms:RFC4646" itemprop="inLanguage" content="${language.id}">
<th>Language</th>
<td py:if="language.id != 'en'"><a href="/browse/languages/${language.id}">${language.language}</a></td>
<td py:if="language.id == 'en'">${language.language}</td>
</tr>
<tr py:for="locc in e.loccs"
property="dcterms:subject" datatype="dcterms:LCC" content="${locc.id}">
<th>LoC Class</th>
<td>
<a href="/browse/loccs/${locc.id.lower ()}">${locc.id}: ${locc.locc}</a>
</td>
</tr>
<tr py:for="subject in e.subjects">
<th>Subject</th>
<td property="dcterms:subject" datatype="dcterms:LCSH">
<a class="block" href="${os.url ('subject', id = subject.id)}">
${subject.subject}
</a>
</td>
</tr>
<tr py:for="dcmitype in e.dcmitypes">
<th>Category</th>
<td property="dcterms:type" datatype="dcterms:DCMIType">${dcmitype.description}</td>
</tr>
<tr>
<th>EBook-No.</th>
<td>${e.project_gutenberg_id}</td>
</tr>
<tr property="dcterms:issued" datatype="xsd:date" content="${e.xsd_release_date_time}">
<th>Release Date</th>
<td itemprop="datePublished">${e.hr_release_date}</td>
</tr>
<tr>
<th>Copyright Status</th>
<td property="dcterms:rights">${e.rights}</td>
</tr>
<tr>
<th>Downloads</th>
<td itemprop="interactionCount" i18n:msg="count">${e.downloads} downloads in the last 30 days.</td>
</tr>
<tr itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">
<th>Price</th>
<td><span itemprop="priceCurrency" content="USD" /><span itemprop="price">$0.00</span><span itemprop="availability" content="In Stock" ><a href="http://schema.org/InStock"></a></span></td>
</tr>
</table>
</div>
</py:if>
</py:for>
</div> <!--! bibrec -->
</div> <!--! tabs -->
</div> <!--! tabs-wrapper -->
</div> <!--! body -->
@ -382,7 +376,6 @@ ${site_top()}
about=""
rel="dcterms:conformsTo"
resource="http://www.w3.org/TR/rdfa-syntax" /></a>
<a href="${os.url_carry ('bibrec', format='rdf')}"
title="Download RDF/XML Metadata for this ebook."><img
src="http://www.w3.org/RDF/icons/rdf_metadata_button.32"

View File

@ -34,8 +34,8 @@ var dialog_title = "${os.user_dialog[1]}";
var dialog_message = "${os.user_dialog[0]}";
//]]></script>
<script
src="/js/pg-desktop-one.js?${cherrypy.config['js_mtime']}" />
<!--<script
src="/js/pg-desktop-one.js?${cherrypy.config['js_mtime']}" />-->
<link rel="shortcut icon" href="/gutenberg/favicon" />
<link rel="canonical" href="${os.canonical_url}" />