Visually nicer 'edit in github' and nav bar

This commit is contained in:
Ed Ward 2017-06-12 12:39:12 +02:00
parent bc1078a91e
commit da762c68fe
2 changed files with 12 additions and 12 deletions

View File

@ -464,17 +464,16 @@ for header in fileStruct:
parent = GetParent(fileStruct, pageNumber) parent = GetParent(fileStruct, pageNumber)
# Make the 'Previous' & 'Next' content # Make the 'Previous', 'Up' & 'Next' content
nLink = '' nLink = ''
pLink = '' pLink = ''
uLink = '' uLink = ''
if pageNumber > 0: if pageNumber > 0:
pLink = '<li><a title="' + fileStruct[pageNumber - 1]['title'] + '" href="/' + fileStruct[pageNumber - 1]['filename'] + '/" class="previous"> &larr; Previous </a></li>' pLink = '<li class="previous"><a title="' + fileStruct[pageNumber - 1]['title'] + '" href="/' + fileStruct[pageNumber - 1]['filename'] + '/" class="previous"> &larr; Previous </a></li>'
if pageNumber < len(fileStruct) - 1: if pageNumber < len(fileStruct) - 1:
nLink = '<li><a title="' + fileStruct[pageNumber + 1]['title'] + '" href="/' + fileStruct[pageNumber + 1]['filename'] + '/" class="next"> Next &rarr; </a></li>' nLink = '<li class="next"><a title="' + fileStruct[pageNumber + 1]['title'] + '" href="/' + fileStruct[pageNumber + 1]['filename'] + '/" class="next"> Next &rarr; </a></li>'
if level > 0: if level > 0:
uLink = '<li><a title="' + fileStruct[parent]['title'] + '" href="/' + fileStruct[parent]['filename'] + '/" class="active"> &uarr; Up </a></li>' uLink = '<li><a title="' + fileStruct[parent]['title'] + '" href="/' + fileStruct[parent]['filename'] + '/" class="active"> &uarr; Up </a></li>'
@ -493,11 +492,11 @@ for header in fileStruct:
# Chapters, subchapters, sections & subsections can all have content, # Chapters, subchapters, sections & subsections can all have content,
# but the basic fundamental organizing unit WRT content is still the # but the basic fundamental organizing unit WRT content is still the
# chapter. # chapter.
githublink = '' githubedit = ''
if level > 0: if level > 0:
if 'include' in header: if 'include' in header:
srcFile = open('include/' + header['include']) srcFile = open('include/' + header['include'])
githublink = '<div style="float:right;"><a title="Edit in GitHub" href="' + githuburl + header['include'] + '"><img src="/images/github.png"></a></div>' githubedit = '<span style="float:right;"><a title="Edit in GitHub" href="' + githuburl + header['include'] + '"><img src="/images/github.png"></a></span>'
content = srcFile.read() content = srcFile.read()
srcFile.close() srcFile.close()
@ -538,7 +537,7 @@ for header in fileStruct:
page = page.replace('{{ page.title }}', header['title']) page = page.replace('{{ page.title }}', header['title'])
page = page.replace('{% tree %}', sidebar) page = page.replace('{% tree %}', sidebar)
page = page.replace('{% prevnext %}', prevnext) page = page.replace('{% prevnext %}', prevnext)
page = page.replace('{% githublink %}', githublink) page = page.replace('{% githubedit %}', githubedit)
page = page.replace('{% breadcrumbs %}', breadcrumbs) page = page.replace('{% breadcrumbs %}', breadcrumbs)
page = page.replace('{{ content }}', content + more) page = page.replace('{{ content }}', content + more)
@ -563,6 +562,7 @@ page = page.replace('{{ page.title }}', 'Ardour Table of Contents')
page = page.replace('{% tree %}', sidebar) page = page.replace('{% tree %}', sidebar)
page = page.replace('{{ content }}', toc) page = page.replace('{{ content }}', toc)
page = page.replace('{% prevnext %}', '') page = page.replace('{% prevnext %}', '')
page = page.replace('{% githubedit %}', '')
page = page.replace('{% breadcrumbs %}', '') page = page.replace('{% breadcrumbs %}', '')
os.mkdir(siteDir + 'toc', 0o775) os.mkdir(siteDir + 'toc', 0o775)

View File

@ -48,17 +48,17 @@
<div class="span12" id="content"> <div class="span12" id="content">
{% breadcrumbs %} {% breadcrumbs %}
<div id="content-main"> <div id="content-main">
<h1 class="title">{{ page.title }}</h1> {% githubedit %}
<h1 class="title">{{ page.title }}</h1>
{{ content }}
{% githublink %}
{% prevnext %}
{{ content }}
{% prevnext %}
</div> </div>
</div> </div>
</div></div> </div></div>
<script type="text/javascript"> <script type="text/javascript">
// I'll go to hell for this // I'll go to hell for this
var isA = function(regex) { return navigator.userAgent.match(regex) }; var isA = function(regex) { return navigator.userAgent.match(regex) };