Merge pull request #51 from gutenbergtools/html5

Html5
gut2-dev
Marshall Zhao 2020-03-13 12:18:39 -04:00 committed by GitHub
commit c5265d1c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 37 additions and 38 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

@ -10,5 +10,6 @@ WorkingDirectory=/var/lib/autocat/autocat3
ExecStartPre=-/usr/bin/mkdir -p /var/run/autocat
ExecStart=/usr/local/bin/pipenv run python CherryPyApp.py
[Install]
WantedBy=multi-user.target

View File

@ -67,6 +67,9 @@ sudo touch /var/run/autocat/autocat3.pid
# Better to set the group name as pgweb for /var/run/autocat
sudo chown -R autocat:pgweb /var/run/autocat
#####
##### To install or update the autocat3 service
#####
sudo systemctl enable /var/lib/autocat/autocat3/autocat3.service
sudo systemctl start autocat3
@ -74,10 +77,10 @@ sudo systemctl start autocat3
# it might be due to monit (the monitoring system) fighting to restart. Or it might be that the
# service is in an uncertain state, not stopped. Try:
sudo service autocat3 stop
systemctl disable autocat3.service
systemctl enable /var/lib/autocat/autocat3/autocat3.service
systemctl restart autocat3.service
systemctl status autocat3.service
sudo systemctl disable autocat3.service
sudo systemctl enable /var/lib/autocat/autocat3/autocat3.service
sudo systemctl restart autocat3.service
sudo systemctl status autocat3.service
# `sudo rm /etc/systemd/system/autocat3.service` is probably not needed. As of July 20 2019,
# we are having problems with monit trying to restart. It might be necessary to also stop

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 @@ Gutenberg metadata much faster than by scraping.
<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 @@ Gutenberg metadata much faster than by scraping.
<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,14 +288,15 @@ Gutenberg metadata much faster than by scraping.
<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 />
<col class="narrow noprint" />
<col class="narrow noprint" />
@ -320,8 +320,7 @@ Gutenberg metadata much faster than by scraping.
<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,7 +11,7 @@
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>
@ -19,7 +19,7 @@
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}";
@ -31,7 +31,7 @@
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="/pics/favicon" />
@ -52,8 +52,8 @@
<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}" />
@ -243,7 +243,7 @@
<!--! 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>