diff options
author | Matt Singleton <matt@xcolour.net> | 2022-01-15 10:11:26 -0600 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2022-01-16 13:04:41 -0600 |
commit | 72e2b1675b300d9ffde1b93a1f2f567df49343cf (patch) | |
tree | 2033f942b683de4a74e31f82564cb5ab43d20523 | |
parent | 17921744313bcffeb65f9cd9fb387364691a39db (diff) |
basic visual style
-rw-r--r-- | TODO.md | 8 | ||||
-rw-r--r-- | external_link.svg | 1 | ||||
-rw-r--r-- | fsm.py | 4 | ||||
-rw-r--r-- | gemini.py | 3 | ||||
-rw-r--r-- | style.css | 46 |
5 files changed, 29 insertions, 33 deletions
@@ -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 @@ +<svg width="16px" height="16px" viewBox="0 0 24 24" style="cursor:pointer"><g stroke-width="2.1" stroke="#666" fill="none" stroke-linecap="round" stroke-linejoin="round"><polyline points="17 13.5 17 19.5 5 19.5 5 7.5 11 7.5"></polyline><path d="M14,4.5 L20,4.5 L20,10.5 M20,4.5 L11,13.5"></path></g></svg> @@ -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('<li{}><a href="{}">{}</a></li>\n'.format(external, url, text)) + self._output.write('<li class="link"><a href="{}">{}</a>{}</li>\n'.format(url, text, external)) self._offset += 1 else: self._fsm.pop_state() @@ -19,7 +19,8 @@ def gem2html(gem: str) -> str: parser = fsm.Parser(gem.split('\n'), html) parser.parse() html.write('</div>\n</body>\n</html>') - print(html.getvalue()) + with open('latest.html', 'w') as fp: + fp.write(html.getvalue()) return html.getvalue() @@ -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: '⇒ '; } |