From 52df0dc47ab07cb6b44438993e2d361312b4b374 Mon Sep 17 00:00:00 2001 From: Skami18 Date: Sat, 23 Jul 2011 14:53:55 +0200 Subject: [PATCH] Added the documentation for template inheritance Requires a re-reading by someone speaking English better than me... --- docs/_static/theme-basic.zip | Bin 0 -> 1449 bytes docs/themes.rst | 96 +++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 docs/_static/theme-basic.zip diff --git a/docs/_static/theme-basic.zip b/docs/_static/theme-basic.zip new file mode 100644 index 0000000000000000000000000000000000000000..d1e4754a44fcedc4c1c16f34b3782c225d13da3c GIT binary patch literal 1449 zcmWIWW@h1H0D)14dG;9W((8wS6ac%z{v7~nSlXJ z1ifa@?NLjPW7=i{?%>6U=(#wrR2My!>G1rlT`v1U_xwrQE(L(%f)Tjl0irVcqV9wdeM| zwVw5WTWqfF5yn$XK6f;kTIT2;dZJdt<=683ZE3CjyUv8GiV3#2*Urp$td2bTa^u~( zTj~+vbUhI@oOt2BD=tYafd%(8UroP>%kc!aUgmd{=n_OXCb<|I-Y-^b`Ayx2)hI}K zFHQY!m-4{A#)^@F;SUo7gA_KSic2bUQuTm_f&<)inU+bm9tK6L!WXNgaq zH*?M2re0ff@K_P&?Z}*|*CeD?X8d7Tc_TsNVXm%ik8Z#fH?ECG89HUMG8XN!3$6^2 z+O0D0qgU_BQm?voMIrLvZ`z&?d1)Zy_{i*g?9Ov<8qc;C=Vo`Nl}A znLqev^PF&5skrlA*&&tSOZ#){TT3#z1N^z!vXzYXEXdc~#HG`7S5JBU=@WU9mCtofH4rmK2RR&CybLe@`RGfvuzJzi+Mb+X1Yvsv6LW?VT@0-7fU7~VR9n6P}w3dxsfv4CtAX0Ajw%K>f{avlYm3d*Bc zO~sW%A*KQo5W|wjE-a=Z)11OPn40F4A?7(7N|W*1~5 z*P|N=$vi+~L74}uvAD7hazOmTW-L-h0-6uXNEqg`vH?Sofei?`f!VPGSk^Ky00373 BtK + + {% extends "index.html" %} + + +Example +------- + +With this system, it is possible to create a theme with just two file. + +base.html +""""""""" + +The first file is the ``templates/base.html`` template: + +.. code-block:: html+jinja + + {% extends "!simple/base.html" %} + + {% block head %} + {{ super() }} + + {% endblock %} + + +1. On the first line, we extends the ``base.html`` template of the ``simple`` theme, so we don't have to rewrite the entire file. +2. On the third line, we open the ``head`` block, that has already been defined in the ``simple`` theme +3. On the fourth line, the function ``super()`` keeps the content previously inserted in the ``head`` block. +4. On the fifth line, we append a stylesheet to the page +5. On the last line, we close the ``head`` block. + +This file will be extended by all the others templates, so the stylesheet will be included in all pages. + +style.css +""""""""" + +The second file is the ``static/css/style.css`` CSS stylesheet: + +.. code-block:: css + + body { + font-family : monospace ; + font-size : 100% ; + background-color : white ; + color : #111 ; + width : 80% ; + min-width : 400px ; + min-height : 200px ; + padding : 1em ; + margin : 5% 10% ; + border : thin solid gray ; + border-radius : 5px ; + display : block ; + } + + a:link { color : blue ; text-decoration : none ; } + a:hover { color : blue ; text-decoration : underline ; } + a:visited { color : blue ; } + + h1 a { color : inherit !important } + h2 a { color : inherit !important } + h3 a { color : inherit !important } + h4 a { color : inherit !important } + h5 a { color : inherit !important } + h6 a { color : inherit !important } + + pre { + margin : 2em 1em 2em 4em ; + } + + #menu li { + display : inline ; + } + + #post-list { + margin-bottom : 1em ; + margin-top : 1em ; + } + +Download +"""""""" + +You can download this example theme :download:`here <_static/theme-basic.zip>`.