diff options
-rw-r--r-- | _pages/blogroll.txt | 26 | ||||
-rw-r--r-- | app/blog/models.py | 5 | ||||
-rw-r--r-- | app/lib/mdx_attr_list/__init__.py | 1 | ||||
-rw-r--r-- | app/lib/mdx_attr_list/mdx_attr_list.py | 131 | ||||
-rw-r--r-- | app/pages/models.py | 13 | ||||
-rw-r--r-- | design/sass/_global.scss | 3 | ||||
-rw-r--r-- | design/sass/_homepage.scss | 10 | ||||
-rw-r--r-- | design/sass/_mailing-list.scss | 1 |
8 files changed, 174 insertions, 16 deletions
diff --git a/_pages/blogroll.txt b/_pages/blogroll.txt index 19f20d9..14d9e76 100644 --- a/_pages/blogroll.txt +++ b/_pages/blogroll.txt @@ -14,20 +14,32 @@ Personally I don't care about destination reviews. I refuse to visit sites that Which of course means I don't follow many travel blogs. Here is my list of travel websites that don't suck: -[Note From the Road](http://www.notesfromtheroad.com/) -- If you only click one link in this list, make it this one. +* [Notes From the Road](http://www.notesfromtheroad.com/) -- If you only click one link in this list, make it this one. -[Inhab.it](http://inhab.it/) -- I can't remember how I found inhab.it (I think we have a mutual friend maybe?) +* [Inhab.it](http://inhab.it/) -- I can't remember how I found inhab.it (I think we have a mutual friend maybe?) -[Expeditionary Art](http://expeditionaryart.com/) -- I love this site and am wildly jealous of the amazing artistic talent on display here. +* [Vagabond Journey](http://www.vagabondjourney.com/) -- I first started [following Wade Shepard's site](http://www.vagablogging.net/the-future-of-vagabonding-and-long-term-travel.html) back when I was [editing Rolf Potts' Vagablogging.net](http://www.vagablogging.net/vagablogging-alumni.html). If my math is right, Wade has been traveling continuously for over 15 years now. There is not much about travel that he has not figured out. -[Vagabond Journey](http://www.vagabondjourney.com/) -- I first started [following Wade Shepard's site](http://www.vagablogging.net/the-future-of-vagabonding-and-long-term-travel.html) back when I was [editing Rolf Potts' Vagablogging.net](http://www.vagablogging.net/vagablogging-alumni.html). If my math is right, Wade has been traveling continuously for over 15 years now. There is not much about travel that he has not figured out. +* [Expeditionary Art](http://expeditionaryart.com/) -- I love this site and am wildly jealous of the amazing artistic talent on display here. -[Expert Vagabond](http://expertvagabond.com/) -- Most travel blogs are utter crap, this one is not. Mathew is a talented photographer, good writer and has something all too rare in traveler's these days -- a sense of adventure. +* [Idlewords](http://idlewords.com/) -- Maciej Cegłowski runs [Pinboard.in](https://pinboard.in/) (which I love) and writes some of the longest, best travel pieces you'll find on the web. He also gives [great](http://idlewords.com/bt14.htm) [talks](https://static.pinboard.in/webstock_2014.htm). We share a [strong dislike](http://idlewords.com/2005/04/dabblers_and_blowhards.htm) of [the pompous ass that is Paul Graham](The Art Of The Essay - Luxagraf, Writing). +* [Expert Vagabond](http://expertvagabond.com/) -- Most travel blogs are utter crap, this one is not. Mathew is a talented photographer, good writer and has something all too rare in traveler's these days -- a sense of adventure. +* [Adventure Journal](http://www.adventure-journal.com/) -- One of two magazine-style travel sites I follow. As with anything collaborative it's hit or miss, but there are some great essays for travelers, naturalists and adventurers. +{^ .list--indented } + +### Living Frugally + +Please do not mistake frugal for cheap. There's a reason he was the Frugal Gourmet, not the cheap gourmet. Cheap people have no soul, don't be one. + +* [Early Retirement Extreme]() -- Jacob Fisker stopped blogging a while ago, but everything he wrote remains good advice for anyone looking to extract themeselves from the consumer mindset. + +* [Mr Money Mustache]() -- + + +### Photography -[Adventure Journal](http://www.adventure-journal.com/) -- One of two magazine-style travel sites I follow. As with anything collaborative it's hit or miss, but there are some great essays for travelers, naturalists and adventurers. -### http://ryantatar.com/tearsheets http://shakasandsinglefins.com/post/59875944801/in-print-desillusion-magazine-mavericks diff --git a/app/blog/models.py b/app/blog/models.py index 2e30ccc..a764c5c 100644 --- a/app/blog/models.py +++ b/app/blog/models.py @@ -79,7 +79,10 @@ class Entry(models.Model): return self.title def get_absolute_url(self): - return "/%s/%s" % (self.pub_date.strftime("%Y/%m").lower(), self.slug) + return "/jrnl/%s/%s" % (self.pub_date.strftime("%Y/%m").lower(), self.slug) + + def get_absolute_url_old(self): + return "/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug) def comment_period_open(self): return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date diff --git a/app/lib/mdx_attr_list/__init__.py b/app/lib/mdx_attr_list/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/app/lib/mdx_attr_list/__init__.py @@ -0,0 +1 @@ + diff --git a/app/lib/mdx_attr_list/mdx_attr_list.py b/app/lib/mdx_attr_list/mdx_attr_list.py new file mode 100644 index 0000000..3b77e3c --- /dev/null +++ b/app/lib/mdx_attr_list/mdx_attr_list.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +# from https://gist.githubusercontent.com/richardcrichardc/9520176/raw/a848cd953bf502a3d236ace24bd7f6d3af0d421f/attr_list.py +from __future__ import unicode_literals + +import re + +from markdown.extensions import Extension +from markdown.extensions.attr_list import AttrListTreeprocessor as _AttrListTreeprocessor, isheader +from markdown.util import isBlockLevel + + +class AttrListExtension(Extension): + def extendMarkdown(self, md, md_globals): + md.treeprocessors.add('attr_list', AttrListTreeprocessor(md), '>prettify') + +class AttrListTreeprocessor(_AttrListTreeprocessor): + BASE_RE = r'\{\:([^\}]*)\}' + PARENT_RE = r'\{\^([^\}]*)\}' + HEADER_RE = re.compile(r'[ ]+%s[ ]*$' % BASE_RE) + BLOCK_RE = re.compile(r'\n[ ]*%s[ ]*$' % BASE_RE) + LIST_RE = re.compile(r'\n[ ]*%s[ ]*$' % PARENT_RE) + INLINE_RE = re.compile(r'^%s' % BASE_RE) + + + def _get_last_child(self, elem): + if len(elem): + return self._get_last_child(elem[-1]) + + return elem + + def _is_list(self, elem): + return elem.tag in ['dl', 'ol', 'ul'] + + + def run(self, doc): + for elem in doc.getiterator(): + if isBlockLevel(elem.tag): + if self._is_list(elem): + lc = self._get_last_child(elem) + attr = None + + if lc.tail and lc.tail.strip(): + attr = 'tail' + elif lc.text.strip(): + attr = 'text' + + if attr: + text = getattr(lc, attr) + + m = self.LIST_RE.search(text) + + if m: + self.assign_attrs(elem, m.group(1)) + setattr(lc, attr, text[:m.start()]) + + continue + + # Block level: check for attrs on last line of text + RE = self.BLOCK_RE + + if isheader(elem) or elem.tag == 'dt': + # header or def-term: check for attrs at end of line + RE = self.HEADER_RE + + if len(elem) and elem.tag == 'li': + # special case list items. children may include a ul or ol. + pos = None + # find the ul or ol position + for i, child in enumerate(elem): + if child.tag in ['ul', 'ol']: + pos = i + + break + + if pos is None and elem[-1].tail: + # use tail of last child. no ul or ol. + m = RE.search(elem[-1].tail) + + if m: + self.assign_attrs(elem, m.group(1)) + elem[-1].tail = elem[-1].tail[:m.start()] + elif pos is not None and pos > 0 and elem[pos-1].tail: + # use tail of last child before ul or ol + m = RE.search(elem[pos-1].tail) + + if m: + self.assign_attrs(elem, m.group(1)) + elem[pos-1].tail = elem[pos-1].tail[:m.start()] + elif elem.text: + # use text. ul is first child. + m = RE.search(elem.text) + + if m: + self.assign_attrs(elem, m.group(1)) + elem.text = elem.text[:m.start()] + elif len(elem) and elem[-1].tail: + # has children. Get from tail of last child + m = RE.search(elem[-1].tail) + + if m: + self.assign_attrs(elem, m.group(1)) + elem[-1].tail = elem[-1].tail[:m.start()] + + if isheader(elem): + # clean up trailing #s + elem[-1].tail = elem[-1].tail.rstrip('#').rstrip() + elif elem.text: + # no children. Get from text. + m = RE.search(elem.text) + + if m: + self.assign_attrs(elem, m.group(1)) + elem.text = elem.text[:m.start()] + + if isheader(elem): + # clean up trailing #s + elem.text = elem.text.rstrip('#').rstrip() + else: + # inline: check for attrs at start of tail + if elem.tail: + m = self.INLINE_RE.match(elem.tail) + + if m: + self.assign_attrs(elem, m.group(1)) + elem.tail = elem.tail[m.end():] + +def makeExtension(configs = None): + if configs is None: + configs = {} + + return AttrListExtension(configs) diff --git a/app/pages/models.py b/app/pages/models.py index 62976cd..3ef1a71 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -8,11 +8,16 @@ import yaml from django.conf import settings from django.template.loader import render_to_string from django.template import Context +from mdx_attr_list.mdx_attr_list import AttrListExtension -def markdown_processor(md): - return markdown.markdown(md, ['footnotes'], safe_mode=False) - +def markdown_processor(txt): + md = markdown.Markdown( + extensions=[AttrListExtension(),'footnotes',], + output_format='html5', + safe_mode=False + ) + return md.convert(txt) ''' class Page(models.Model): title = models.CharField(max_length=200) @@ -106,7 +111,7 @@ class _FileLoader(object): for k, v in metadata.items(): setattr(self, k, v) if self.body_markdown: - self.body_html = markdown.markdown(self.body_markdown, ['footnotes'], safe_mode=False) + self.body_html = markdown_processor(self.body_markdown) def read(self): with open(self.filename, "r", encoding="utf-8") as f: diff --git a/design/sass/_global.scss b/design/sass/_global.scss index 2db16cd..5051d3d 100644 --- a/design/sass/_global.scss +++ b/design/sass/_global.scss @@ -21,6 +21,9 @@ a { &:hover { text-decoration: none; } + &:visited { + color: $orange; + } } p { diff --git a/design/sass/_homepage.scss b/design/sass/_homepage.scss index 66d2d54..0e30d1c 100644 --- a/design/sass/_homepage.scss +++ b/design/sass/_homepage.scss @@ -126,14 +126,16 @@ } } } -.black .homepage--archives { +.black { .post--title a { color: white; } - .post--location a { - color: $body_font_light; + .homepage--archives { + .post--location a { + color: $body_font_light; + } + img { @include img_plain; } } - img { @include img_plain; } } .black .homepage--about { &:after, &:before { diff --git a/design/sass/_mailing-list.scss b/design/sass/_mailing-list.scss index 95366b8..561c059 100644 --- a/design/sass/_mailing-list.scss +++ b/design/sass/_mailing-list.scss @@ -1,6 +1,7 @@ //Flexbox mixins rely on https://github.com/timhettler/compass-flexbox .mailing-list { text-align: left; + @extend %clearfix; .form--flex-container { @include display-flex; } |