From 7f474775f9540c7fe9b0d41ba26aebe9684b41b2 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 4 Feb 2017 20:10:59 +0100 Subject: [PATCH 1/8] Update default.css going responsive, It would work better with a new html5 layout --- data/style/default.css | 195 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 180 insertions(+), 15 deletions(-) diff --git a/data/style/default.css b/data/style/default.css index ae2d0183f..a30d53edb 100644 --- a/data/style/default.css +++ b/data/style/default.css @@ -1,19 +1,184 @@ -body {background-color: #3E2723; color: #fff} -div.recipe, div.index { font-family: Times, serif; font-size: 10pt; margin: auto; max-width: 760px; background-color: #FFF8E1; padding: 1em; margin-top: 1em; color: rgba(0,0,0,0.7)} +body { + /*font-size: 160%;*/ + font:160% Georgia, "Times New Roman", Times, serif; +line-height: 1.6; +} -div.recipe img {border-radius: 10%; height: 200px; float: right;} -div.recipe img:hover {border: 1px solid black;} -foo {height: initial; position: absolute; top: 10px; left: 10px} -span.label { font-weight: bold } +h1, h2, h3, h4, h5, h6 { + font-weight: bold; + font-family: "georgia" serif; + text-transform: capitalize; + page-break-after: avoid; + -webkit-column-span: all; + /* Chrome, Safari, Opera */ + column-span: all; + margin-bottom: 0; +} -h3 {font-family: Calibri, Sans-Serif; font-size: 120%; font-weight: bold; color: #6d4c41; border-bottom: 1px solid #ffa000; margin-top: 0px; margin-bottom: 0px;} +h1 { + font-size: 2rem; +} +h2 { + font-size: 1.8rem; +} -div.header p {margin-top: 0; margin-bottom: 0.2em} -div.ing { padding: 1em; background-color: #FFE57F} -ul.ing { margin-top: 0px; padding-left: 0px; color: rgba(0,0,0,1); font-size: 100%;} -li.ing { list-style: none; border-top: 0.3em } -div.header p.title { font-family: Calibri, Sans-Serif; font-size: 35pt; font-weight: bold; color: #3E2723; border-bottom: 8px solid #ff6f00; min-height: 200px; vertical-align: bottom; margin-bottom: 20px; position: relative; padding-top: 30px} -div.header p.title span.label {display: none} -div.recipe div {margin-bottom: 20px;} -div.recipe div p {margin-top: 0} \ No newline at end of file +h3 { + font-size: 1.6rem; +} + +h4 { + font-size: 1.4rem; +} + +h5 { + font-size: 1.2rem; +} + +h6 { + font-size: 1rem; +} + +.instruction p+p, .modifications p+p { + text-indent: 2rem; +} + +div.recipe, div.index { + font-size: 1rem; + max-width: 45rem; + margin: auto; + padding: 1em; + margin-top: 1em; +} + + +div.recipe img { + float: left; + padding: .5rem; + max-width: 30%; + height: auto; +} + +span.label { + font-weight: bold; +} + +p.title { + font-size: 180%; + text-align: center; + font-weight: 400; +} + +p.title span.label { + /*display: none;*/ + visibility: hidden; +} + +div.header p { + margin-top: 0; + margin-bottom: 0.2em; +} + +div.ing { + /*padding: 1rem; + margin: .5rem;*/ + border-top: solid 2px; + border-bottom: solid 2px; + margin: 1rem 0; + padding: 1rem 0; + +} + +ul.ing { + margin: 0; + padding: 0; +} + +li.ing { + list-style: none; + border-top: 0.3em; +} + +ul li { + margin: 0; + padding: 0; + text-indent: 0; +} + +.inggroup { + font-weight: bold; + list-style: none; +} + +.ing { + font-weight: normal; +} + +.ing .inggroup { + margin-left: 2rem +} + +.ing .inggroup .ing { + margin-left: -1rem +} + +div.header { + display: table; + text-align: center; +} + +div.header p { + display: table-row; +} + +div.header p span { + display: table-cell; + text-align: left; +} + +div.header p span.label { + text-align: right; + padding-right: 1rem; +} + +div.header p.title { + display:table-header-group; + width: 100%; +} + +div.header p.title span { + display: inline-block; + width: 100%; + text-align: right; + margin: 0; + padding: 0; +} + +div.header p.title span.label { + width: 0%; + /*display: none;*/ + visibility: hidden; + margin: 0; padding: 0; +} + +@media print { + * { + color: black; + background-color: white; + } + div.recipe, div.index { + font-size: 10px; + max-width: 100%; + } + div.ing { + border: none; + margin: 0; + padding: 0; + } + div.recipe img { + max-width: 4.5cm; + } + a:link:after { content: " (" attr(href) ") "; } + @page {margin: 0.5cm;} + +} From d60002d0d2a46b65aa82e88aa2f6ed298f56af60 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 4 Feb 2017 20:20:02 +0100 Subject: [PATCH 2/8] testing to move to HTML5 I'm not a programmer, nor I'm abl eto compile so theese mods are not tested. Please read mi comments, they start as # AR... These are my proposal for a more semantic (html5) output: NAV (index button) ARTICLE (the full recipe) HEADER the title FIGURE the image ASIDE TABLE of header elements SECTION TABLE of ingredients SECTION instructions SECTION notes First and most important - the title is an H1 elment, not a P moving DIVs to Html5 semantic tags adding an "index" button that shall disappear in a one-page head formatted as table - I wish to do it also for the ingredients but I wasn't able, sorry. --- .../html_plugin/html_exporter.py | 101 +++++++++++++----- 1 file changed, 74 insertions(+), 27 deletions(-) diff --git a/gourmet/plugins/import_export/html_plugin/html_exporter.py b/gourmet/plugins/import_export/html_plugin/html_exporter.py index b137cdf87..f524063e4 100644 --- a/gourmet/plugins/import_export/html_plugin/html_exporter.py +++ b/gourmet/plugins/import_export/html_plugin/html_exporter.py @@ -46,7 +46,7 @@ def __init__ (self, rd, r, out, conv=None, change_units=change_units, do_markup=True, use_ml=True) - + def htmlify (self, text): t=text.strip() #t=xml.sax.saxutils.escape(t) @@ -64,6 +64,9 @@ def write_head (self): if self.start_html: self.out.write(HTML_HEADER_START) self.out.write("%s"%self.get_title()) + # AR add html5shiv # + self.out.write("") + if self.css: if self.embed_css: self.out.write("