summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.md8
-rw-r--r--external_link.svg1
-rw-r--r--fsm.py4
-rw-r--r--gemini.py3
-rw-r--r--style.css46
5 files changed, 29 insertions, 33 deletions
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 @@
+<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>
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('<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()
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('</div>\n</body>\n</html>')
- 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: '⇒ ';
}