Skip to content

Commit 06e1a10

Browse files
committedMay 28, 2015
nicer mako highlight
1 parent 0e196ae commit 06e1a10

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed
 

Diff for: ‎stories/creating-a-theme.txt

+13-13
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ That file is a **template** used to generate parts of the pages. It's large and
205205

206206
The part we want to change is this:
207207

208-
.. code:: mako
208+
.. code:: html+mako
209209

210210
<%def name="html_stylesheets()">
211211
%if use_bundles:
@@ -226,7 +226,7 @@ The part we want to change is this:
226226

227227
And we will change it so it uses the lanyon styles instead of theme.css (again, ignore the bundles for now!):
228228

229-
.. code:: mako
229+
.. code:: html+mako
230230

231231
<%def name="html_stylesheets()">
232232
%if use_bundles:
@@ -299,12 +299,12 @@ If we look for the equivalent code in Nikola's side, we see this:
299299
So Nikola has the "masthead" above the nav element, and uses list elements in nav instead of bare links.
300300
Not all that different is it?
301301

302-
Let's make it lanyon-like! We will need 2 more templates: `base.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base.tmpl>`__ and `base_header.tmpl`<https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base_header.tmpl>`__. Get them and put them in your ``themes/lanyon/templates`` folder.
302+
Let's make it lanyon-like! We will need 2 more templates: `base.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base.tmpl>`__ and `base_header.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base_header.tmpl>`__. Get them and put them in your ``themes/lanyon/templates`` folder.
303303

304304
Let's look at ``base.tmpl`` first. It's short and nice, it looks like a webpage without
305305
all the interesting stuff:
306306

307-
.. code:: mako
307+
.. code:: html+mako
308308

309309
## -*- coding: utf-8 -*-
310310
<%namespace name="base" file="base_helper.tmpl" import="*"/>
@@ -340,7 +340,7 @@ by the ``html_navigation_links`` function out of the ``NAVIGATION_LINKS`` option
340340

341341
So, first, lets change that base template to be more lanyon-like:
342342

343-
.. code:: mako
343+
.. code:: html+mako
344344

345345
## -*- coding: utf-8 -*-
346346
<%namespace name="base" file="base_helper.tmpl" import="*"/>
@@ -404,7 +404,7 @@ feature of your web browser is your best friend for these situations.
404404
Another problem is that the contents of the nav element are wrong. They are not bare links. We will fix that in
405405
``base_header.html``, like this:
406406

407-
.. code:: mako
407+
.. code:: html+mako
408408

409409
<%def name="html_navigation_links()">
410410
<nav id="menu" role="navigation" class="sidebar-nav">
@@ -453,7 +453,7 @@ Now let's look at the content. In Lanyon, this is how the "main" content looks:
453453
Everything inside the "container content" div is ... the content. The rest is a masthead with the site title
454454
and at the bottom a label for the sidebar's toggle. Easy to do in ``base.tmpl`` (only showing relevant part):
455455

456-
.. code:: mako
456+
.. code:: html+mako
457457

458458
<!-- Wrap is the content to shift when toggling the sidebar. We wrap the
459459
content to avoid any CSS collisions with our real content. -->
@@ -539,7 +539,7 @@ Also, the accessibility link on top is visible when it should not. That's becaus
539539
One clear problem is that the title "Lanyon A Jekyll theme" is set in the theme itself. We don't do that sort of things
540540
in Nikola, we have settings for that. So, let's use it. There is a ``html_site_title`` function in ``base_helper.tmpl`` which is just the thing. So we change base.tmpl to use it:
541541

542-
.. code:: mako
542+
.. code:: html+mako
543543

544544
<div class="wrap">
545545
<div class="masthead">
@@ -576,7 +576,7 @@ Versus our port:
576576

577577
So, it looks like we will have to fix ``html_site_title`` after all:
578578

579-
.. code:: mako
579+
.. code:: html+mako
580580

581581
<%def name="html_site_title()">
582582
<h3 id="brand" class="masthead-title">
@@ -589,7 +589,7 @@ As for the actual content, that's not in any of the templates we have seen so fa
589589
things in the way the Lanyon CSS expects it to. Here's the original, which you can find in Nikola's source
590590
code:
591591

592-
.. code:: mako
592+
.. code:: html+mako
593593

594594
## -*- coding: utf-8 -*-
595595
<%namespace name="helper" file="index_helper.tmpl"/>
@@ -638,7 +638,7 @@ code:
638638
And this is how it looks after I played with it for a while, making it generate code that looks closer to
639639
the Lanyon original:
640640

641-
.. code:: mako
641+
.. code:: html+mako
642642

643643
<%block name="content">
644644
<%block name="content_header"></%block>
@@ -681,7 +681,7 @@ With these changes, it looks ... similar?
681681

682682
Similar changes (basically adding classnames to elements) needed to be done in ``post_header.tmpl``:
683683

684-
.. code:: mako
684+
.. code:: html+mako
685685

686686
<%def name="html_post_header()">
687687
<header>
@@ -717,7 +717,7 @@ Let's see the color schemes first. They apply easily, just tweak your ``body`` e
717717

718718
We can tweak ``base.tmpl`` to do just that:
719719

720-
.. code:: mako
720+
.. code:: html+mako
721721

722722
% if lanyon_subtheme:
723723
<body class="${lanyon_subtheme}">

0 commit comments

Comments
 (0)