# HG changeset patch # User Steve Losh # Date 1327368625 18000 # Node ID c4bee2f20591f8881b48dac35efd9605b16f1987 # Parent 790fe5ece24e11f282135e18bdd274e933074935 Linkify titles. diff -r 790fe5ece24e -r c4bee2f20591 d/base.py --- a/d/base.py Mon Jan 23 20:07:28 2012 -0500 +++ b/d/base.py Mon Jan 23 20:30:25 2012 -0500 @@ -38,8 +38,10 @@

{project_title}

+
''' POST = ''' +
{footer}
@@ -116,10 +118,19 @@ e('.toc > ul').html(subtoc) return unicode(e) +def _linkify_title(content): + e = pq(content) + + title = e('.markdown h1').text() + e('.markdown h1').html('' + title + '') + + return unicode(e) + def _ensure_dir(path): if not os.path.isdir(path): os.makedirs(path) + def _render(title, footer, path, target, page_type, toc=None): if page_type == 'index': pre, post = INDEX_PRE, POST @@ -141,7 +152,7 @@ content += post.format(footer=footer) if page_type == 'content': - content = _fix_md_toc(content) + content = _linkify_title(_fix_md_toc(content)) if not os.path.isdir(target): os.makedirs(target) @@ -171,6 +182,7 @@ return _render(title, footer, path, target, 'index', toc) + def render_files(): _ensure_dir(BUILD_LOC) _ensure_dir(j(BUILD_LOC, '_dmedia'))