Permalink
Browse files

Change all the things

  • Loading branch information...
1 parent 0fa71a7 commit b64dc1dafcdc4a79e0d5bd7b6a02479b3e3ccc2c @Gadgetoid committed Nov 1, 2016
View
@@ -2,5 +2,5 @@ output/
*.py[cod]
env/
.DS_store
-.sass_cache/
+.sass-cache/
@@ -11,18 +11,16 @@
</div>
<div id="crumbtrail">
<p>
- <a class="more" href="/">&laquo; Return to the Raspberry Pi GPIO Pinout</a>
+ <a class="more" href="/">&laquo; {{strings:return_home}}</a>
</p>
</div>
<div id="boards_header">
<article>
- <h1>Raspberry Pi HATs, pHATs &amp; Add-ons</h1>
- <p>Click on a HAT, pHAT or add-on for more details and to see which pins it uses!</p>
+ <h1>{{strings:boards_title}}</h1>
+ <p>{{strings:boards_subtitle}}</p>
</article>
</div>
- <div id="pages">
- <div id="boards"><ul>{{content}}</ul></div>
- </div>
+ <div id="boards"><ul>{{content}}</ul></div>
<div id="lang">
<ul class="lang-nav">
{{lang_links}}
View
@@ -15,7 +15,7 @@
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', '{{analytics_id}}', 'auto');
+ ga('create', '{{settings:analytics_id}}', 'auto');
ga('send', 'pageview');
</script>
@@ -25,8 +25,10 @@
<h1 class="logo"><a title="Raspberry Pi GPIO Pinout home" href="/"><img src="{{resource_url}}pinout-logo.png" /><span>Raspberry Pi</span>n<span class="out">out</span></a></h1>
{{main_content}}
-
+
+ <div class="footer">
{{footer}}
+ </div>
</div>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1.9.1/jquery-1.9.1.min.js"></script>
@@ -16,9 +16,7 @@
{{featured_boards}}
</ul>
</div>
- <div id="pages">
- {{content}}
- </div>
+ {{content}}
<div id="lang">
<ul class="lang-nav">
{{lang_links}}
View
@@ -42,7 +42,10 @@
'github_repository': 'GitHub Repository',
'buy_now': 'Buy Now',
'translate_msg': '<a href="https://github.com/gadgetoid/Pinout2">This page needs translating, can you help?</a><br><br>',
- 'browse_addons': 'Browse more HATs, pHATs and add-ons'
+ 'browse_addons': 'Browse more HATs, pHATs and add-ons',
+ 'return_home': 'Return to the Raspberry Pi GPIO Pinout',
+ 'boards_title': 'Raspberry Pi HATs, pHATs &amp; Add-ons',
+ 'boards_subtitle': 'Click on a HAT, pHAT or add-on for more details and to see which pins it uses!'
}
@@ -495,8 +498,8 @@ def get_lang_urls(src):
resource_url = pinout.get_setting('resource_url', '/resources/') # '/pinout-tr/resources/'
url_suffix = pinout.get_setting('url_suffix', '') # '.html'
-template_main = open('src/{}/template/layout.html'.format(lang)).read()
-template_boards = open('src/{}/template/boards.html'.format(lang)).read()
+template_main = open('common/page.html'.format(lang)).read()
+template_boards = open('common/boards.html'.format(lang)).read()
template_footer = open('src/{}/template/footer.html'.format(lang)).read()
pages = {}
@@ -645,7 +648,8 @@ def interfaces_menu(current):
pin_nav = render_nav(pin_url)
pin_html = pinout.render_html(template_main,
template_footer,
- analytics_id=pinout.settings['analytics_id'],
+ strings,
+ pinout.settings,
lang_links="\n\t\t".join(langlinks),
hreflang="\n\t\t".join(hreflang),
nav=pin_nav,
@@ -718,7 +722,8 @@ def interfaces_menu(current):
html = pinout.render_html(template,
template_footer,
- analytics_id=pinout.settings['analytics_id'],
+ strings,
+ pinout.settings,
lang_links="\n\t\t".join(langlinks),
hreflang="\n\t\t".join(hreflang),
nav=nav,
View
@@ -27,13 +27,27 @@ def render_html(*args, **kwargs):
html = html.replace('{{main_content}}',args[0])
html = html.replace('{{footer}}',args[1])
+ strings = args[2]
+
+ for key in strings:
+ if type(strings[key]) in [str, unicode]:
+ html = html.replace('{{strings:' + key + '}}', strings[key])
+
+ settings = args[3]
+
+ for key in settings:
+ if type(settings[key]) in [str, unicode]:
+ html = html.replace('{{settings:' + key + '}}', settings[key])
+
kwargs['v'] = str(int(time.time()))
+
for key in kwargs:
if type(kwargs[key]) == dict:
for d_key, d_value in kwargs[key].iteritems():
html = html.replace('{{' + key + '_' + d_key + '}}', d_value)
- elif type(kwargs[key]) == str:
+ elif type(kwargs[key]) in [str, unicode]:
html = html.replace('{{' + key + '}}', kwargs[key])
+
return html
Oops, something went wrong.

0 comments on commit b64dc1d

Please sign in to comment.