Commit 591fa1f2a57eda6a6edce26dc3ed267e964eedd9

Authored by William Daniau
1 parent 1f4a506577
Exists in master

Utilisation d'un fichier commun pour le bout de code

lançant la coloration syntaxique

Showing 4 changed files with 20 additions and 51 deletions Inline Diff

templates/html/Default.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 1 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 2 2 <html>
<head> 3 3 <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[% title %]</title> 5 5 <title>[% title %]</title>
<meta name='Generator' content='[% generator.name %]'> 6 6 <meta name='Generator' content='[% generator.name %]'>
<link rel="stylesheet" 7 7 <link rel="stylesheet"
href="[% resource('common/zim-style.css') %]" > 8 8 href="[% resource('common/zim-style.css') %]" >
<link rel="stylesheet" 9 9 <link rel="stylesheet"
href="[% resource('common/zim-table-style.css') %]" > 10 10 href="[% resource('common/zim-table-style.css') %]" >
<link rel="stylesheet" 11 11 <link rel="stylesheet"
href="[% resource('common/zim-special.css') %]" > 12 12 href="[% resource('common/zim-special.css') %]" >
<link rel="stylesheet" 13 13 <link rel="stylesheet"
href="[% resource('common/zim-hljs.css') %]" > 14 14 href="[% resource('common/zim-hljs.css') %]" >
15 15
<style type='text/css'> 16 16 <style type='text/css'>
* { font-family: sans-serif } 17 17 * { font-family: sans-serif }
18 18
a:hover { text-decoration: underline; } 19 19 a:hover { text-decoration: underline; }
20 20
/* Centre les images mais elles sont coupées aux sauts de page à l'impression */ 21 21 /* Centre les images mais elles sont coupées aux sauts de page à l'impression */
img { 22 22 img {
display: block; 23 23 display: block;
margin-left: auto; 24 24 margin-left: auto;
margin-right: auto; 25 25 margin-right: auto;
} 26 26 }
27 27
28 28
</style> 29 29 </style>
30 30
<!-- Themes clair : 31 31 <!-- Themes clair :
atom-one-light.css, vs.css googlecode.css github.css 32 32 atom-one-light.css, vs.css googlecode.css github.css
qtcreator_light.css 33 33 qtcreator_light.css
Themes sombres : 34 34 Themes sombres :
agate.css vs2015.css atom-one-dark.css hybrid.css 35 35 agate.css vs2015.css atom-one-dark.css hybrid.css
ir-black.css sunburst.css tomorrow-night-bright.css 36 36 ir-black.css sunburst.css tomorrow-night-bright.css
qtcreator_dark.css 37 37 qtcreator_dark.css
Demo live : https://highlightjs.org/static/demo/ --> 38 38 Demo live : https://highlightjs.org/static/demo/ -->
<link rel="stylesheet" 39 39 <link rel="stylesheet"
href="[% resource('common/hljs/styles/sunburst.css') %]" > 40 40 href="[% resource('common/hljs/styles/sunburst.css') %]" >
41 41
<!-- hljs --> 42 42 <!-- hljs -->
<script src="[% resource('common/hljs/highlight.pack.js') %]"></script> 43 43 <script src="[% resource('common/hljs/highlight.pack.js') %]"></script>
44 44
</head> 45 45 </head>
<body> 46 46 <body>
47 47
[% options.empty_lines = "default" %] 48 48 [% options.empty_lines = "default" %]
49 49
<!-- Header --> 50 50 <!-- Header -->
<div class='header'> 51 51 <div class='header'>
[% IF navigation.prev %] 52 52 [% IF navigation.prev %]
[ <a href='[% uri(navigation.prev) %]'>[% gettext("Prev") %]</a> ] 53 53 [ <a href='[% uri(navigation.prev) %]'>[% gettext("Prev") %]</a> ]
[% ELSE %] 54 54 [% ELSE %]
[ <span class='insen'>[% gettext("Prev") %]</span> ] 55 55 [ <span class='insen'>[% gettext("Prev") %]</span> ]
[% END %] 56 56 [% END %]
57 57
[% IF links.get("index") %] 58 58 [% IF links.get("index") %]
[ <a href='[% uri(links.get("index")) %]'>[% gettext("Index") %]</a> ] 59 59 [ <a href='[% uri(links.get("index")) %]'>[% gettext("Index") %]</a> ]
[% ELSE %] 60 60 [% ELSE %]
[ <span class='insen'>[% gettext("Index") %]</span> ] 61 61 [ <span class='insen'>[% gettext("Index") %]</span> ]
[% END %] 62 62 [% END %]
63 63
[% IF navigation.next %] 64 64 [% IF navigation.next %]
[ <a href='[% uri(navigation.next) %]'>[% gettext("Next") %]</a> ] 65 65 [ <a href='[% uri(navigation.next) %]'>[% gettext("Next") %]</a> ]
[% ELSE %] 66 66 [% ELSE %]
[ <span class='insen'>[% gettext("Next") %]</span> ] 67 67 [ <span class='insen'>[% gettext("Next") %]</span> ]
[% END %] 68 68 [% END %]
</div> 69 69 </div>
70 70
<hr /> 71 71 <hr />
72 72
<!-- Wiki content --> 73 73 <!-- Wiki content -->
74 74
<div class='pages'> 75 75 <div class='pages'>
<!--[% FOR page IN pages %]--> 76 76 <!--[% FOR page IN pages %]-->
<div class='heading'> 77 77 <div class='heading'>
<h1>[% page.title %] <a name='[% anchor(page) %]'></a></h1> 78 78 <h1>[% page.title %] <a name='[% anchor(page) %]'></a></h1>
</div> 79 79 </div>
80 80
<div class='content'> 81 81 <div class='content'>
[% page.body %] 82 82 [% page.body %]
</div> 83 83 </div>
84 84
<br /> 85 85 <br />
86 86
<div class='page-footer'> 87 87 <div class='page-footer'>
<!--[% FOR link IN page.backlinks %]--> 88 88 <!--[% FOR link IN page.backlinks %]-->
[% IF loop.first %]<b>[% gettext("Backlinks:") %]</b>[% END %] 89 89 [% IF loop.first %]<b>[% gettext("Backlinks:") %]</b>[% END %]
90 90
<a href='[% uri(link) %]'>[% link.name %]</a> 91 91 <a href='[% uri(link) %]'>[% link.name %]</a>
92 92
[% IF loop.last %]<br /><br />[% END %] 93 93 [% IF loop.last %]<br /><br />[% END %]
<!--[% END %]--> 94 94 <!--[% END %]-->
95 95
<!--[% FOR file IN page.attachments %]--> 96 96 <!--[% FOR file IN page.attachments %]-->
[% IF loop.first %] 97 97 [% IF loop.first %]
<b>[% gettext("Attachments:") %]</b> 98 98 <b>[% gettext("Attachments:") %]</b>
<table> 99 99 <table>
[% END %] 100 100 [% END %]
101 101
<tr><td><a href='[% uri(file) %]'>[% file.basename %]</a></td><td>&nbsp;</td><td>[% file.size %]</td></tr> 102 102 <tr><td><a href='[% uri(file) %]'>[% file.basename %]</a></td><td>&nbsp;</td><td>[% file.size %]</td></tr>
103 103
[% IF loop.last %] 104 104 [% IF loop.last %]
</table> 105 105 </table>
[% END %] 106 106 [% END %]
<!--[% END %]--> 107 107 <!--[% END %]-->
templates/html/Default_with_index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 1 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 2 2 <html>
<head> 3 3 <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[% title %]</title> 5 5 <title>[% title %]</title>
<meta name='Generator' content='[% generator.name %]'> 6 6 <meta name='Generator' content='[% generator.name %]'>
<link rel="stylesheet" 7 7 <link rel="stylesheet"
href="[% resource('common/zim-style.css') %]" > 8 8 href="[% resource('common/zim-style.css') %]" >
<link rel="stylesheet" 9 9 <link rel="stylesheet"
href="[% resource('common/zim-table-style.css') %]" > 10 10 href="[% resource('common/zim-table-style.css') %]" >
<link rel="stylesheet" 11 11 <link rel="stylesheet"
href="[% resource('common/zim-special.css') %]" > 12 12 href="[% resource('common/zim-special.css') %]" >
<link rel="stylesheet" 13 13 <link rel="stylesheet"
href="[% resource('common/zim-hljs.css') %]" > 14 14 href="[% resource('common/zim-hljs.css') %]" >
15 15
<style type='text/css'> 16 16 <style type='text/css'>
* { font-family: sans-serif } 17 17 * { font-family: sans-serif }
18 18
a:hover { text-decoration: underline; } 19 19 a:hover { text-decoration: underline; }
20 20
/* Centre les images mais elles sont coupées aux sauts de page à l'impression */ 21 21 /* Centre les images mais elles sont coupées aux sauts de page à l'impression */
img { 22 22 img {
display: block; 23 23 display: block;
margin-left: auto; 24 24 margin-left: auto;
margin-right: auto; 25 25 margin-right: auto;
} 26 26 }
27 27
/* Specifique au with index */ 28 28 /* Specifique au with index */
span.insen { color: grey } 29 29 span.insen { color: grey }
30 30
.pages { 31 31 .pages {
max-width: 1000px; 32 32 max-width: 1000px;
padding-left: 320px; 33 33 padding-left: 320px;
} 34 34 }
.menu{ 35 35 .menu{
float:left; width: 300px; 36 36 float:left; width: 300px;
} 37 37 }
hr{clear:both;} 38 38 hr{clear:both;}
39 39
</style> 40 40 </style>
41 41
<!-- Themes clair : 42 42 <!-- Themes clair :
atom-one-light.css, vs.css googlecode.css github.css 43 43 atom-one-light.css, vs.css googlecode.css github.css
qtcreator_light.css 44 44 qtcreator_light.css
Themes sombres : 45 45 Themes sombres :
agate.css vs2015.css atom-one-dark.css hybrid.css 46 46 agate.css vs2015.css atom-one-dark.css hybrid.css
ir-black.css sunburst.css tomorrow-night-bright.css 47 47 ir-black.css sunburst.css tomorrow-night-bright.css
qtcreator_dark.css 48 48 qtcreator_dark.css
Demo live : https://highlightjs.org/static/demo/ --> 49 49 Demo live : https://highlightjs.org/static/demo/ -->
<link rel="stylesheet" 50 50 <link rel="stylesheet"
href="[% resource('common/hljs/styles/sunburst.css') %]" > 51 51 href="[% resource('common/hljs/styles/sunburst.css') %]" >
52 52
<!-- hljs --> 53 53 <!-- hljs -->
<script src="[% resource('common/hljs/highlight.pack.js') %]"></script> 54 54 <script src="[% resource('common/hljs/highlight.pack.js') %]"></script>
55 55
</head> 56 56 </head>
<body> 57 57 <body>
58 58
<!-- Header --> 59 59 <!-- Header -->
<div class='header'> 60 60 <div class='header'>
[% IF navigation.prev %] 61 61 [% IF navigation.prev %]
[ <a href='[% uri(navigation.prev) %]'>[% gettext("Prev") %]</a> ] 62 62 [ <a href='[% uri(navigation.prev) %]'>[% gettext("Prev") %]</a> ]
[% ELSE %] 63 63 [% ELSE %]
[ <span class='insen'>[% gettext("Prev") %]</span> ] 64 64 [ <span class='insen'>[% gettext("Prev") %]</span> ]
[% END %] 65 65 [% END %]
66 66
[% IF links.get("index") %] 67 67 [% IF links.get("index") %]
[ <a href='[% uri(links.get("index")) %]'>[% gettext("Index") %]</a> ] 68 68 [ <a href='[% uri(links.get("index")) %]'>[% gettext("Index") %]</a> ]
[% ELSE %] 69 69 [% ELSE %]
[ <span class='insen'>[% gettext("Index") %]</span> ] 70 70 [ <span class='insen'>[% gettext("Index") %]</span> ]
[% END %] 71 71 [% END %]
72 72
[% IF navigation.next %] 73 73 [% IF navigation.next %]
[ <a href='[% uri(navigation.next) %]'>[% gettext("Next") %]</a> ] 74 74 [ <a href='[% uri(navigation.next) %]'>[% gettext("Next") %]</a> ]
[% ELSE %] 75 75 [% ELSE %]
[ <span class='insen'>[% gettext("Next") %]</span> ] 76 76 [ <span class='insen'>[% gettext("Next") %]</span> ]
[% END %] 77 77 [% END %]
</div> 78 78 </div>
79 79
<hr /> 80 80 <hr />
81 81
<div class="menu"> 82 82 <div class="menu">
[% index() %] 83 83 [% index() %]
</div> 84 84 </div>
85 85
[% options.empty_lines = "default" %] 86 86 [% options.empty_lines = "default" %]
87 87
<!-- Wiki content --> 88 88 <!-- Wiki content -->
89 89
<div class='pages'> 90 90 <div class='pages'>
<!--[% FOR page IN pages %]--> 91 91 <!--[% FOR page IN pages %]-->
<div class='heading'> 92 92 <div class='heading'>
<h1>[% page.title %] <a name='[% anchor(page) %]'></a></h1> 93 93 <h1>[% page.title %] <a name='[% anchor(page) %]'></a></h1>
</div> 94 94 </div>
95 95
<div class='content'> 96 96 <div class='content'>
[% page.body %] 97 97 [% page.body %]
</div> 98 98 </div>
99 99
<br /> 100 100 <br />
101 101
<div class='page-footer'> 102 102 <div class='page-footer'>
<!--[% FOR link IN page.backlinks %]--> 103 103 <!--[% FOR link IN page.backlinks %]-->
[% IF loop.first %]<b>[% gettext("Backlinks:") %]</b>[% END %] 104 104 [% IF loop.first %]<b>[% gettext("Backlinks:") %]</b>[% END %]
105 105
<a href='[% uri(link) %]'>[% link.name %]</a> 106 106 <a href='[% uri(link) %]'>[% link.name %]</a>
107 107
[% IF loop.last %]<br /><br />[% END %] 108 108 [% IF loop.last %]<br /><br />[% END %]
<!--[% END %]--> 109 109 <!--[% END %]-->
110 110
<!--[% FOR file IN page.attachments %]--> 111 111 <!--[% FOR file IN page.attachments %]-->
[% IF loop.first %] 112 112 [% IF loop.first %]
<b>[% gettext("Attachments:") %]</b> 113 113 <b>[% gettext("Attachments:") %]</b>
<table> 114 114 <table>
[% END %] 115 115 [% END %]
116 116
<tr><td><a href='[% uri(file) %]'>[% file.basename %]</a></td><td>&nbsp;</td><td>[% file.size %]</td></tr> 117 117 <tr><td><a href='[% uri(file) %]'>[% file.basename %]</a></td><td>&nbsp;</td><td>[% file.size %]</td></tr>
118 118
[% IF loop.last %] 119 119 [% IF loop.last %]
</table> 120 120 </table>
templates/html/Print.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 1 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 2 2 <html>
<head> 3 3 <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[% title %]</title> 5 5 <title>[% title %]</title>
<meta name='Generator' content='[% generator.name %]'> 6 6 <meta name='Generator' content='[% generator.name %]'>
<!-- ATTENTION Le template Print ne supporte pas les ressources, 7 7 <!-- ATTENTION Le template Print ne supporte pas les ressources,
Il faut mettre des chemins absolus sur les fichiers :( --> 8 8 Il faut mettre des chemins absolus sur les fichiers :( -->
<link rel="stylesheet" 9 9 <link rel="stylesheet"
href="file:////home/daniau/.local/share/zim/templates/html/common/zim-style.css" > 10 10 href="file:////home/daniau/.local/share/zim/templates/html/common/zim-style.css" >
<link rel="stylesheet" 11 11 <link rel="stylesheet"
href="file:////home/daniau/.local/share/zim/templates/html/common/zim-table-style.css" > 12 12 href="file:////home/daniau/.local/share/zim/templates/html/common/zim-table-style.css" >
<link rel="stylesheet" 13 13 <link rel="stylesheet"
href="file:////home/daniau/.local/share/zim/templates/html/common/zim-special.css" > 14 14 href="file:////home/daniau/.local/share/zim/templates/html/common/zim-special.css" >
<link rel="stylesheet" 15 15 <link rel="stylesheet"
href="file:////home/daniau/.local/share/zim/templates/html/common/zim-hljs.css" > 16 16 href="file:////home/daniau/.local/share/zim/templates/html/common/zim-hljs.css" >
<style type='text/css'> 17 17 <style type='text/css'>
18 18
* { font-family: serif } 19 19 * { font-family: serif }
20 20
/* Centre les images mais elles sont coupées aux sauts de page à l'impression */ 21 21 /* Centre les images mais elles sont coupées aux sauts de page à l'impression */
/*img { 22 22 /*img {
display: block; 23 23 display: block;
margin-left: auto; 24 24 margin-left: auto;
margin-right: auto; 25 25 margin-right: auto;
}*/ 26 26 }*/
27 27
</style> 28 28 </style>
29 29
<!-- Themes clair : 30 30 <!-- Themes clair :
atom-one-light.css, vs.css 31 31 atom-one-light.css, vs.css
Themes sombres : 32 32 Themes sombres :
agate.css, vs2015.css, atom-one-dark.css 33 33 agate.css, vs2015.css, atom-one-dark.css
Demo live : https://highlightjs.org/static/demo/ --> 34 34 Demo live : https://highlightjs.org/static/demo/ -->
<link rel="stylesheet" 35 35 <link rel="stylesheet"
href="file:////home/daniau/.local/share/zim/templates/html/common/hljs/styles/atom-one-light-wb.css" > 36 36 href="file:////home/daniau/.local/share/zim/templates/html/common/hljs/styles/atom-one-light-wb.css" >
37 37
<!-- hljs --> 38 38 <!-- hljs -->
<script src="file:////home/daniau/.local/share/zim/templates/html/common/hljs/highlight.pack.js"></script> 39 39 <script src="file:////home/daniau/.local/share/zim/templates/html/common/hljs/highlight.pack.js"></script>
40 40
</head> 41 41 </head>
<body> 42 42 <body>
43 43
[% options.empty_lines = "default" %] 44 44 [% options.empty_lines = "default" %]
45 45
<!-- Wiki content --> 46 46 <!-- Wiki content -->
47 47
[% FOR page IN pages %] 48 48 [% FOR page IN pages %]
[% page.content %] 49 49 [% page.content %]
[% END %] 50 50 [% END %]
51 51
<!-- End wiki content --> 52 52 <!-- End wiki content -->
53 53
<script> 54 54 <script src="file:////home/daniau/.local/share/zim/templates/html/common/go-hljs.js"></script>
/* on remplace octave par plaintext ou nohighlight ou matlab */ 55
var elements = document.getElementsByTagName("code"); 56
for (var i=0; i<elements.length; i++) { 57
var el = elements[i]; 58
var cl = el.getAttribute("class"); 59
if (cl == "octave") { 60
el.setAttribute( "class","matlab"); 61
templates/html/common/go-hljs.js
File was created 1
2
3 /* on remplace octave par plaintext ou nohighlight ou matlab */
4 var elements = document.getElementsByTagName("code");
5 for (var i=0; i<elements.length; i++) {
6 var el = elements[i];
7 var cl = el.getAttribute("class");
8 if (cl == "octave") {
9 el.setAttribute( "class","matlab");
10 }
11 }
12
13 /* Si on utilise la fonction suivante, c'est execute avant le bout de code ci-dessus */
14 /*hljs.initHighlightingOnLoad();*/