Merge pull request #49 from gutenbergtools/master

merge changes from master branch
revert-49-master
Marshall Zhao 2020-03-11 13:45:25 -04:00 committed by GitHub
commit a7ffd32581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 210 additions and 131 deletions

View File

@ -64,7 +64,7 @@ tools.gzip.on: True
tools.gzip.mime_types: ['text/html', 'application/xhtml+xml', 'application/atom+xml']
tools.I18nTool.on: True
tools.I18nTool.default: 'en_US'
tools.I18nTool.default: 'en'
tools.I18nTool.mo_dir: CherryPyApp.install_dir + '/i18n'
tools.I18nTool.domain: 'messages'

View File

@ -39,7 +39,7 @@ class CoverPages (object):
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xml:base="http://www.gutenberg.org">
<head>
<title>Cover Flow</title>
<style>
<!--<style>
.cover-thumb {
display: inline-block;
background-position: center;
@ -53,7 +53,7 @@ class CoverPages (object):
width: 210px;
height: 310px;
}
</style>
</style>-->
</head>
<body><div>"""
@ -69,6 +69,7 @@ class CoverPages (object):
style="background-image: url({url})"> </a>\n""".format (
url = url, href = href, title = title, size = size)
return (s + '</div></body></html>\n').encode ('utf-8')
def index (self, count, size, order, **kwargs):

View File

@ -129,9 +129,7 @@ class HTMLFormatter (XMLishFormatter):
""" Produce HTML output. """
CONTENT_TYPE = 'text/html; charset=UTF-8'
DOCTYPE = ('html',
'-//W3C//DTD XHTML+RDFa 1.0//EN',
'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd')
DOCTYPE = 'html5'
def __init__ (self):
super (HTMLFormatter, self).__init__ ()
@ -139,7 +137,7 @@ class HTMLFormatter (XMLishFormatter):
def get_serializer (self):
# return BaseFormatter.XHTMLSerializer (doctype = self.DOCTYPE, strip_whitespace = False)
return genshi.output.XHTMLSerializer (doctype = self.DOCTYPE, strip_whitespace = False)
return genshi.output.HTMLSerializer (doctype = self.DOCTYPE, strip_whitespace = False)
def fix_dc (self, dc, os):
@ -195,16 +193,14 @@ class MobileFormatter (XMLishFormatter):
""" Produce HTML output suitable for mobile devices. """
CONTENT_TYPE = mt.xhtml + '; charset=UTF-8'
DOCTYPE = ('html',
'-//WAPFORUM//DTD XHTML Mobile 1.2//EN',
'http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd')
DOCTYPE = 'html5'
def __init__ (self):
super (MobileFormatter, self).__init__ ()
def get_serializer (self):
return genshi.output.XMLSerializer (doctype = self.DOCTYPE, strip_whitespace = False)
return genshi.output.HTMLSerializer (doctype = self.DOCTYPE, strip_whitespace = False)
def fix_dc (self, dc, os):

View File

@ -21,7 +21,7 @@ Gutenberg metadata much faster than by scraping.
xmlns:marcrel="http://www.loc.gov/loc.terms/relators/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xml:lang="${os.lang}"
version="XHTML+RDFa 1.0">
>
<?python
import re
@ -53,8 +53,7 @@ Gutenberg metadata much faster than by scraping.
title="${explain (topic)}"><span class="icon icon_help noprint" /></a>
</py:def>
<head profile="http://a9.com/-/spec/opensearch/1.1/"
xmlns:og="http://opengraphprotocol.org/schema/">
<head xmlns:og="http://opengraphprotocol.org/schema/">
${site_head ()}
@ -63,7 +62,7 @@ Gutenberg metadata much faster than by scraping.
<link rel="alternate nofollow" type="${mt.rdf}"
href="${os.url ('bibrec', id = os.id, format = 'rdf')}" />
<style type="text/css">
<style>
.qrcode { background: transparent url(${os.qrcode_url}) 0 0 no-repeat; }
</style>
<meta name="google" content="notranslate" />
@ -149,7 +148,7 @@ ${site_top()}
<h2>Bibliographic Record <span>${help (_('Table: Bibliographic Record'))}</span></h2>
<table class="bibrec" summary="Bibliographic data of author and book.">
<table class="bibrec" >
<colgroup>
<col class="narrow" />
<col />
@ -245,7 +244,7 @@ ${site_top()}
<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" href="http://schema.org/InStock" content="In Stock" /></td>
<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>
@ -289,15 +288,16 @@ ${site_top()}
<py:for each="e in os.entries">
<py:if test="isinstance (e, bs.DC)">
<div about="[ebook:$e.project_gutenberg_id]" rel="dcterms:hasFormat" rev="dcterms:isFormatOf">
<div about="[ebook:$e.project_gutenberg_id]" rel="dcterms:hasFormat" ><!--! rev="dcterms:isFormatOf" -->
<h2>Download This eBook</h2>
<table class="files" summary="Table of available file types and sizes.">
<table class="files">
<colgroup>
<col class="narrow" />
<col />
<col />
<col />
<col class="narrow noprint" />
<col class="narrow noprint" />
<col class="narrow noprint" />
@ -320,8 +320,7 @@ ${site_top()}
<td><span class="icon icon_${e.icon}" /></td>
<td property="dcterms:format" content="${file_.mediatypes[-1]}" datatype="dcterms:IMT"
class="unpadded icon_save"
><a href="/${file_.filename}" type="${file_.mediatypes[-1]}" charset="${file_.encoding}"
class="link"
><a href="/${file_.filename}" type="${file_.mediatypes[-1]}" class="link"
title="Download">${file_.hr_filetype}</a></td>
<td class="noscreen">${file_.url}</td>
<td class="right"

View File

@ -8,7 +8,7 @@
xmlns:fb="http://www.facebook.com/2008/fbml"
py:strip="">
<head>
<style type="text/css">
<style>
.icon { background: transparent url(/pics/sprite.png?${cherrypy.config['css_mtime']}) 0 0 no-repeat; }
</style>
<link rel="stylesheet" type="text/css"

View File

@ -22,8 +22,7 @@ which contains *all* Project Gutenberg metadata in one RDF/XML file.
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:og="http://opengraphprotocol.org/schema/"
xmlns:fb="http://www.facebook.com/2008/fbml"
xml:lang="${os.lang}"
version="XHTML+RDFa 1.0">
xml:lang="${os.lang}">
<?python
old_header = os.title
@ -33,7 +32,7 @@ which contains *all* Project Gutenberg metadata in one RDF/XML file.
<xi:include href="site-layout.html" />
<xi:include href="social-functions.html" />
<head profile="http://a9.com/-/spec/opensearch/1.1/">
<head >
${site_head ()}
<title>${os.title} - ${os.pg}</title>

View File

@ -11,18 +11,15 @@ py:strip="">
from i18n_tool import ugettext as _
?>
<py:def function="site_head">
<style type="text/css">
<style >
.icon { background: transparent url(/pics/sprite.png?${cherrypy.config['css_mtime']}) 0 0 no-repeat; }
</style>
<link rel="stylesheet" type="text/css"
href="/gutenberg/pg-desktop-one.css?${cherrypy.config['css_mtime']}" />
<link rel="stylesheet" type="text/css"
href="/gutenberg/new_nav.css?${cherrypy.config['css_mtime']}"/>
<link rel="stylesheet" type="text/css"
href="/gutenberg/style.css?${cherrypy.config['css_mtime']}"/>
href="/css/pg-desktop-one.css?${cherrypy.config['css_mtime']}" />
<!--! IE8 does not recognize application/javascript -->
<script type="text/javascript">//<![CDATA[
<script>//<![CDATA[
var json_search = "${os.json_search}";
var mobile_url = "${os.mobile_url}";
var canonical_url = "${os.canonical_url}";
@ -34,10 +31,10 @@ var dialog_title = "${os.user_dialog[1]}";
var dialog_message = "${os.user_dialog[0]}";
//]]></script>
<script type="text/javascript"
<script
src="/js/pg-desktop-one.js?${cherrypy.config['js_mtime']}" />
<link rel="shortcut icon" href="/gutenberg/favicon" />
<link rel="shortcut icon" href="/pics/favicon" />
<link rel="canonical" href="${os.canonical_url}" />
<link rel="search"
@ -55,8 +52,8 @@ href="${os.url_carry (format = 'opds')}" />
<meta py:if="os.viewport" name="viewport" content="${os.viewport}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="${os.lang}" />
<meta http-equiv="default-style" content="text/css" />
<!--! plain old metadata -->
<meta name="title" content="${os.title}" />
@ -113,15 +110,102 @@ title="Powered by PostgreSQL">
<py:def function="copyright">
<div class="copyright" i18n:comment="The copyright notice on the footer of every page.">
© 2020 Project Gutenberg Literary Archive Foundation — All Rights Reserved.
© 20032019 Project Gutenberg Literary Archive Foundation — All Rights Reserved.
</div>
</py:def>
<py:def function="site_top">
<xi:include href="../../menu.html" />
<!-- <xi:include href="/../gutenbergsite/_includes/menu.html"/>-->
<div id="fb-root" />
<div id="print-head" class="noscreen">
<div class="center">${os.desktop_url}<br/><br/>${os.tagline}</div>
</div>
<div id="screen-head" class="noprint">
<table>
<tr i18n:comment="The logo, tagline and badges at the very top of every page.">
<td rowspan="2" id="logo" i18n:comment="The PG logo at the top left of every page.">
<a href="/wiki/Main_Page" title="Go to the Main Page.">
<span class="icon icon_logo" />
</a>
</td>
<td id="tagline-badges" colspan="2">
<table>
<tr>
<td id="tagline">${os.tagline}</td>
<td id="paypal-badge" class="badge">${paypal ()}</td>
<td id="flattr-badge" class="badge">${flattr ()}</td>
</tr>
</table>
</td>
</tr>
<tr id="menubar-search">
<td id="menubar" i18n:comment="The menu bar at the top of every page.">
<a py:if="os.page != 'start'"
id="menubar-first"
tabindex="11" accesskey="1"
title="Start a new search."
href="${os.url ('start')}">Search</a>
<span py:if="os.page == 'start'"
id="menubar-first" class="grayed">Search</span>
<a tabindex="22"
title="Our latest releases."
href="/ebooks/search/?sort_order=release_date">Latest</a>
<a tabindex="31"
title="Read the Project Gutenberg terms of use."
href="/terms_of_use/">Terms of Use</a>
<a tabindex="32"
href="/wiki/Gutenberg:Project_Gutenberg_Needs_Your_Donation"
title="Learn why we need some money.">Donate?</a>
<a tabindex="33" accesskey="m" href="${os.mobile_url}"
title="Go to our mobile site.">Mobile</a>
</td>
<td id="search" i18n:comment="The search box at the top right of every page.">
<form method="get" action="${os.desktop_search}"
enctype="multipart/form-data">
<table class="borderless">
<tr>
<td id="search-button-cell">
<button id="search-button" type="submit" title="Execute the search. &lt;enter&gt;">
<span class="icon icon_smsearch" />
</button>
</td>
<td id="search-input-cell">
<input id="search-input" name="query" type="text" title="${os.placeholder} &lt;s&gt;"
accesskey="s" value="${os.search_terms}" />
</td>
<td id="help-button-cell">
<button id="help-button" type="button" title="Open the help menu. &lt;h&gt;"
accesskey="h">Help</button>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<div id="helpbox" class="hide">
<xi:include href="help.html" />
</div>
</div>
</py:def>
<py:def function="site_footer">
<div class="footer" i18n:comment="On the footer of every page.">
<ul>
@ -179,7 +263,7 @@ title="Powered by PostgreSQL">
<!--! xml:lang avoids extraction for translation -->
<input xml:lang="en" type="hidden" name="cmd" value="_s-xclick" />
<input xml:lang="en" type="hidden" name="hosted_button_id" value="XKAL6BZL3YPSN" />
<input type="image" name="submit"
<input type="image" alt="paypal icon" name="submit"
src="/pics/paypal/${os.paypal_lang}.gif"
title="Send us money through PayPal." />
</div>

View File

@ -10,7 +10,7 @@
?>
<py:def function="site_head">
<style type="text/css">
<style >
.icon { background: transparent url(/pics/sprite.png?${cherrypy.config['css_mtime']}) 0 0 no-repeat; }
</style>
<link rel="stylesheet" type="text/css"

View File

@ -54,7 +54,7 @@
<a href="https://twitter.com/share?${p (params)}"
title="Share on Twitter"
onclick="open_share_popup(this.href, this.target, 640, 320)"
target="_tw_share_popup">
target="_top">
<span class="icon icon_twitter" />
</a>
</div>