From 72e2b1675b300d9ffde1b93a1f2f567df49343cf Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 15 Jan 2022 10:11:26 -0600 Subject: basic visual style --- TODO.md | 8 +++++--- external_link.svg | 1 + fsm.py | 4 ++-- gemini.py | 3 ++- style.css | 46 +++++++++++++++++++--------------------------- 5 files changed, 29 insertions(+), 33 deletions(-) create mode 100644 external_link.svg diff --git a/TODO.md b/TODO.md index 5788296..0431ffb 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,13 @@ - - [ ] open non-gemini links externally and display differently + - [x] open non-gemini links externally and display differently - [ ] keyboard navigation - vim-style - scroll - highlight and follow links - - forward and bac ak + - forward and back - url bar - [ ] search in page - [ ] work with search pages - [x] stdlib url parsing in gemini module - - [ ] nice typography + - [x] nice typography + - [ ] html templates + - [ ] deal with non utf8 charsets diff --git a/external_link.svg b/external_link.svg new file mode 100644 index 0000000..ce9bd89 --- /dev/null +++ b/external_link.svg @@ -0,0 +1 @@ + diff --git a/fsm.py b/fsm.py index 963aa0a..b7439d1 100644 --- a/fsm.py +++ b/fsm.py @@ -104,12 +104,12 @@ class Parser(object): if url_parts.scheme in ('gemini', ''): external = '' else: - external = ' class="external"' + external = open('external_link.svg').read() if len(parts) == 1: text = url else: text = parts[1] - self._output.write('{}\n'.format(external, url, text)) + self._output.write('\n'.format(url, text, external)) self._offset += 1 else: self._fsm.pop_state() diff --git a/gemini.py b/gemini.py index b940bb7..2d29236 100644 --- a/gemini.py +++ b/gemini.py @@ -19,7 +19,8 @@ def gem2html(gem: str) -> str: parser = fsm.Parser(gem.split('\n'), html) parser.parse() html.write('\n\n') - print(html.getvalue()) + with open('latest.html', 'w') as fp: + fp.write(html.getvalue()) return html.getvalue() diff --git a/style.css b/style.css index 1189a93..b75a239 100644 --- a/style.css +++ b/style.css @@ -1,37 +1,29 @@ -#root { -font-size: 20px; -font-family: Garamond, Georgia, sans-serif; +html { + font-size: 18px; + font-family: Garamond, Georgia, sans-serif; } -p.h1 { -font-size: 40px; -} -p.h2 { -font-size: 30px; -} -p.h3{font-size: 23px; } -p { - line-height: 1.5; - margin: 0 0 20px; -} -a:active { color: tomato; } -a:focus { border: 1px dotted tomato; } + pre { font-family: Courier, monospace; - font-size: 10%; } + blockquote { - font-style: italic; + border-left: 5px solid #ddd; + padding: 0.6em 0.6em 0.2em; + font-style: italic; } + blockquote:before { - content: "\201C"; - display: inline-block; - padding-right: 8px; + content: "\201C"; + display: inline-block; + padding-right: 0.4rem; + font-size: 4em; + line-height: 0; + vertical-align: -0.4em; + color: lightgrey; + margin-right: 0.1em; } -/* - * Begin custom styles. - */ - -li.external a { - color: red; +li.link::marker { + content: '⇒ '; } -- cgit v1.2.3