# HG changeset patch # User Ludovic Chabant # Date 1437929639 25200 # Node ID 32612333a367c0bdd1d7081fe59ffad827f3bfac # Parent 1c452b7ab8b1da2d10b3c6f6c5e907d0c14ef6fe docs: Add some syntax highlighting to tutorial pages. diff -r 1c452b7ab8b1 -r 32612333a367 docs/docs/01_tutorial/02_making-things-pretty.md --- a/docs/docs/01_tutorial/02_making-things-pretty.md Sun Jul 26 09:53:09 2015 -0700 +++ b/docs/docs/01_tutorial/02_making-things-pretty.md Sun Jul 26 09:53:59 2015 -0700 @@ -1,5 +1,6 @@ --- title: "Part 2: Making Things Pretty" +needs_pygments: true --- In the [first part of this tutorial][part1], we created a very simple blog with @@ -56,16 +57,18 @@ Second, change the code to: - {% raw %} - {% for post in pagination.posts %} - * {{post.date}} **[{{post.title}}]({{post.url}})** - {% endfor %} +```htmldjango +{% raw %} +{% for post in pagination.posts %} +* {{post.date}} **[{{post.title}}]({{post.url}})** +{% endfor %} -
- {% if pagination.prev_page %}{% endif %} - {% if pagination.next_page %}{% endif %} -
- {% endraw %} +
+ {% if pagination.prev_page %}{% endif %} + {% if pagination.next_page %}{% endif %} +
+{% endraw %} +``` We're still showing links to the previous/next pagination at the bottom, but now instead of showing a classic river of posts, we're showing a concise and simple @@ -84,11 +87,13 @@ Let's change the loop to: - {% raw %} - {% for post in pagination.posts %} - * {{post.date}} **[{{post.title}}]({{post.url}})**{%if post.hint%}: {{post.hint}}{%endif%} - {% endfor %} - {% endraw %} +```jinja +{% raw %} +{% for post in pagination.posts %} +* {{post.date}} **[{{post.title}}]({{post.url}})**{%if post.hint%}: {{post.hint}}{%endif%} +{% endfor %} +{% endraw %} +``` This will show a post's `hint` if it is defined. Of course, if you refresh the page now, nothing will change. @@ -96,10 +101,12 @@ Now go into some of your posts, and add something like this to their configuration header: - --- - - hint: Where we announce things - --- +``` +--- + +hint: Where we announce things +--- +``` Refresh the home page, and you'll see this new piece of metadata displayed next to the post's title! @@ -123,7 +130,11 @@ Edit `templates/default.html` and replace the last line of the footer (_i.e._ just before ``) with this: -

About this site – {{ piecrust.branding|safe }}

+```jinja +{% raw %} +

About this site – {{ piecrust.branding|safe }}

+{% endraw %} +``` Refresh your browser, and you should see a link to the "_About_" page at the bottom of every page, including blog posts. diff -r 1c452b7ab8b1 -r 32612333a367 docs/docs/01_tutorial/03_adding-colours.md --- a/docs/docs/01_tutorial/03_adding-colours.md Sun Jul 26 09:53:09 2015 -0700 +++ b/docs/docs/01_tutorial/03_adding-colours.md Sun Jul 26 09:53:59 2015 -0700 @@ -13,7 +13,11 @@ `{%raw%}{% if site.css %}{%endraw%}` and `{%raw%}{% endif %}{%endraw%}`. Replace it with: - +```htmldjango +{% raw %} + +{% endraw %} +``` Now create the file `assets/myblog.less`. Leave it empty for now. @@ -29,33 +33,35 @@ Now start writing some Less CSS code in the empty file (you can learn more about the Less CSS syntax on the [official website][less]): - @color-primary: #FF481C; - @color-secondary1: #083D78; - @color-secondary2: #CBF66E; - @color-secondary2-dark: #74AC00; +```css +@color-primary: #FF481C; +@color-secondary1: #083D78; +@color-secondary2: #CBF66E; +@color-secondary2-dark: #74AC00; - body { - font-family: sans-serif; - color: @color-primary; - background: darken(@color-secondary1, 20%); - } +body { + font-family: sans-serif; + color: @color-primary; + background: darken(@color-secondary1, 20%); +} - a { - color: @color-secondary2; - text-decoration: none; +a { + color: @color-secondary2; + text-decoration: none; - &:hover { - text-decoration: underline; - } - &:visited { - color: @color-secondary2-dark; - } + &:hover { + text-decoration: underline; + } + &:visited { + color: @color-secondary2-dark; } +} - #container { - width: 640px; - margin: 0 auto; - } +#container { + width: 640px; + margin: 0 auto; +} +``` When you save, you should see that PieCrust picks it up right away and compiles the Less file into a CSS file that your browser can fetch. diff -r 1c452b7ab8b1 -r 32612333a367 docs/docs/02_general/04_how-it-works.md --- a/docs/docs/02_general/04_how-it-works.md Sun Jul 26 09:53:09 2015 -0700 +++ b/docs/docs/02_general/04_how-it-works.md Sun Jul 26 09:53:59 2015 -0700 @@ -64,11 +64,13 @@ The default formatter is [Markdown][]. So our page becomes: -

This page lists all the recipes written so far in Ludovic’s Blog:

- +```html +

This page lists all the recipes written so far in Ludovic’s Blog:

+ +``` ### Layout rendering @@ -78,27 +80,31 @@ example page is using the `simple` layout, and if we assume the file `templates/simple.html` looks like this: - {%raw%} - - {{page.title}} - - {{content|safe}} - - - {%endraw%} +```htmldjango +{%raw%} + +{{page.title}} + +{{content|safe}} + + +{%endraw%} +``` ...then our final page will be: - - All Recipes - -

This page lists all the recipes written so far in Ludovic’s Blog:

- - - +```html + +All Recipes + +

This page lists all the recipes written so far in Ludovic’s Blog:

+ + + +``` Of course, we glossed over a lot of things here, which you will want to learn about: