Fixed unicode issue in page.py, render pre blocks of standard email template in monospace

This commit is contained in:
Anand Doshi 2014-05-12 12:29:19 +05:30
parent 0c62be6a7f
commit 6475d9381a
2 changed files with 49 additions and 45 deletions

View file

@ -71,19 +71,19 @@ class Page(Document):
fpath = os.path.join(path, scrub(self.name) + '.js')
if os.path.exists(fpath):
with open(fpath, 'r') as f:
self.script = f.read()
self.script = unicode(f.read(), "utf-8")
# css
fpath = os.path.join(path, scrub(self.name) + '.css')
if os.path.exists(fpath):
with open(fpath, 'r') as f:
self.style = f.read()
self.style = unicode(f.read(), "utf-8")
# html
fpath = os.path.join(path, scrub(self.name) + '.html')
if os.path.exists(fpath):
with open(fpath, 'r') as f:
self.content = f.read()
self.content = unicode(f.read(), "utf-8")
if frappe.lang != 'en':
from frappe.translate import get_lang_js

View file

@ -5,15 +5,15 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{{ subject }}</title>
<style>
/* -------------------------------------
GLOBAL
/* -------------------------------------
GLOBAL
------------------------------------- */
img {
max-width: 100%;
img {
max-width: 100%;
}
body {
width: 100% !important;
width: 100% !important;
height: 100%;
}
@ -21,18 +21,18 @@ body {
background-color: #eee;
}
.wrapper * {
.wrapper * {
margin:0;
padding:0;
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
font-size: 100%;
line-height: 1.6;
}
/* -------------------------------------
ELEMENTS
/* -------------------------------------
ELEMENTS
------------------------------------- */
.wrapper a {
.wrapper a {
color: #348eda;
}
@ -66,7 +66,7 @@ body {
border-radius: 25px;
}
.last {
.last {
margin-bottom: 0;
}
@ -92,10 +92,10 @@ body {
margin-right: 5px;
}
/* -------------------------------------
BODY
/* -------------------------------------
BODY
------------------------------------- */
table.body-wrap {
table.body-wrap {
width: 100%;
padding: 10px;
}
@ -105,18 +105,18 @@ table.body-wrap .container{
}
/* -------------------------------------
FOOTER
/* -------------------------------------
FOOTER
------------------------------------- */
table.footer-wrap {
width: 100%;
table.footer-wrap {
width: 100%;
clear:both!important;
}
.footer-wrap .container p {
font-size:12px;
color:#666;
}
table.footer-wrap a{
@ -124,19 +124,19 @@ table.footer-wrap a{
}
/* -------------------------------------
TYPOGRAPHY
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
.wrapper h1,
.wrapper h2,
.wrapper h3{
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
line-height: 1.1;
margin-top:15px;
margin-bottom:15px;
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
line-height: 1.1;
margin-top:15px;
margin-bottom:15px;
color:#000;
line-height: 1.2;
font-weight:200;
font-weight:200;
}
.wrapper h1 {
@ -152,23 +152,23 @@ table.footer-wrap a{
margin: 20px 0;
border-top: 1px solid #eee;
}
.wrapper p,
.wrapper ul,
.wrapper ol {
margin-bottom: 10px;
font-weight: normal;
.wrapper p,
.wrapper ul,
.wrapper ol {
margin-bottom: 10px;
font-weight: normal;
font-size:14px;
}
.wrapper ul li,
.wrapper ul li,
.wrapper ol li {
margin-left:5px;
list-style-position: inside;
}
/* ---------------------------------------------------
/* ---------------------------------------------------
RESPONSIVENESS
Nuke it from orbit. It's the only way to be sure.
Nuke it from orbit. It's the only way to be sure.
------------------------------------------------------ */
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
@ -188,12 +188,12 @@ table.footer-wrap a{
.content {
max-width:600px;
margin:0 auto;
display:block;
display:block;
}
/* Let's make sure tables in the content area are 100% wide */
.content table {
width: 100%;
.content table {
width: 100%;
}
a.no-decoration {
@ -209,9 +209,13 @@ small, .small {
color: #999999;
}
pre, code {
font-family: monospace !important;
}
</style>
</head>
<body>
<div class="wrapper">
@ -233,7 +237,7 @@ small, .small {
</table>
</div>
<!-- /content -->
</td>
<td></td>
</tr>
@ -245,7 +249,7 @@ small, .small {
<tr>
<td></td>
<td class="container">
<!-- content -->
<div class="content">
<table>
@ -257,7 +261,7 @@ small, .small {
</table>
</div>
<!-- /content -->
</td>
<td></td>
</tr>
@ -269,4 +273,4 @@ small, .small {
<div class="print-html">{{ print_html or "" }}</div>
</body>
</html>
</html>