]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/Add_space_before_slash_in_parent_links.mdwn
Merge commit '546da9bac7135d7d1b02dce0c0eef2209d939fc6' into sipb
[ikiwiki.git] / doc / todo / Add_space_before_slash_in_parent_links.mdwn
1 This [[patch]] adds a space before the forward-slash in the the parent links. There is already a space after the slash.
2
3 > I intentionally put the space after the slash and not before, because I
4 > like how it looks that way. So I don't plan to apply this patch unless a
5 > lot of people disagree with me or whatever. --[[Joey]]
6
7 >> Couldn't we export what's put between the links to a variable? For instance, I might actually want to set it to ' : ' or '→'. --[[madduck]]
8
9 >>> Yes, please.  This seems to be something a lot of people want to customize.  (I certainly do -- a forward slash only looks natural to Unix users)  --[[sabr]]
10
11 >> Joey, would I be right to summarize your position on this as "people who
12 >> want to change the text of the templates should maintain their own version
13 >> of the `.tmpl` files"? It's not clear to me how this todo item could be
14 >> closed in a way acceptable to you, except perhaps as WONTFIX. --[[smcv]]
15
16 Before:
17
18     ikiwiki/ todo/ Add space before slash in parent links
19
20 After:
21
22     ikiwiki / todo / Add space before slash in parent links
23
24 Patch:
25
26     diff --git a/templates/misc.tmpl b/templates/misc.tmpl
27     index 184920e..80e6d0b 100644
28     --- a/templates/misc.tmpl
29     +++ b/templates/misc.tmpl
30     @@ -15,7 +15,7 @@
31
32      <div class="header">
33      <span>
34     -<TMPL_VAR INDEXLINK>/ <TMPL_VAR TITLE>
35     +<TMPL_VAR INDEXLINK> / <TMPL_VAR TITLE>
36      </span>
37      </div>
38
39     diff --git a/templates/page.tmpl b/templates/page.tmpl
40     index 3a1ac9e..1978e93 100644
41     --- a/templates/page.tmpl
42     +++ b/templates/page.tmpl
43     @@ -17,7 +17,7 @@
44      <div class="header">
45      <span>
46      <TMPL_LOOP NAME="PARENTLINKS">
47     -<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>/
48     +<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a> /
49      </TMPL_LOOP>
50      <TMPL_VAR TITLE>
51      </span>
52     diff --git a/templates/recentchanges.tmpl b/templates/recentchanges.tmpl
53     index e03482f..4877395 100644
54     --- a/templates/recentchanges.tmpl
55     +++ b/templates/recentchanges.tmpl
56     @@ -15,7 +15,7 @@
57
58      <div class="header">
59      <span>
60     -<TMPL_VAR INDEXLINK>/ <TMPL_VAR TITLE>
61     +<TMPL_VAR INDEXLINK> / <TMPL_VAR TITLE>
62      </span>
63      </div>
64
65 ----
66
67 It's almost implicit in some of the discussion above but this can be achieved locally if you fork your templates directory from ikiwiki's, with an ammendment such as
68
69     <h1><TMPL_LOOP NAME="PARENTLINKS"><a
70         href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
71         &rarr;
72         </TMPL_LOOP><TMPL_VAR TITLE></h1>
73
74 This is what I do on my site for example. -- [[Jon]]
75
76 > You don't actually need to fork the whole directory, "only" `page.tmpl` -
77 > put `templatedir => "/foo/templates"` in your setup file, copy `page.tmpl`
78 > to that directory, and modify it there. IkiWiki will look in `templatedir`
79 > first, then fall back to its default templates if any are missing from
80 > `templatedir`.
81 >
82 > (Admittedly, `page.tmpl` is the hardest to maintain a fork of, because it
83 > tends to change whenever a new plugin is added...) --[[smcv]]
84
85 ----
86
87 Here is a solution which doesn't require people to create their own
88 `page.tmpl`.  The solution uses an HTML list together with CSS to draw the
89 separator and can therefore be controlled by users.  This change also
90 allows people to control other aspects of how the parentlinks are
91 displayed.  The only drawback is that lynx/w3m don't seem to deal with this
92 CSS feature, but I don't think it's too bad since the parentlinks will
93 simply show up as a list.
94
95 > I guess I could live with w3m having a second list at the top.
96
97 > Does this method look identical in the default theme? What about the
98 > other themes? Several of them do things with parentlinks css.. --[[Joey]]
99
100 (I see that the other patch changes templates/misc.tmpl and
101 templates/recentchanges.tmpl for INDEXLINK.  I haven't done that but can do
102 so if [[Joey]] likes this approach.)
103
104 > Those template no longer have the redundant stuff. --[[Joey]] 
105
106 --[[tbm]]
107
108     diff --git a/doc/style.css b/doc/style.css
109     index 35a1331..b726365 100644
110     --- a/doc/style.css
111     +++ b/doc/style.css
112     @@ -129,6 +129,23 @@ pre {
113         overflow: auto;
114      }
115
116     +ul.parentlinks li:after {
117     +display: marker;
118     +content: "/ ";
119     +background: none;
120     +}
121     +
122     +ul.parentlinks li {
123     +display: inline;
124     +}
125     +
126     +ul.parentlinks
127     +{
128     +padding-left: 0;
129     +display:inline;
130     +list-style-type: none;
131     +}
132     +
133      div.recentchanges {
134         border-style: solid;
135         border-width: 1px;
136     diff --git a/templates/page.tmpl b/templates/page.tmpl
137     index 770ac23..f54493e 100644
138     --- a/templates/page.tmpl
139     +++ b/templates/page.tmpl
140     @@ -44,11 +44,15 @@
141      <TMPL_IF HTML5><section class="pageheader"><TMPL_ELSE><div class="pageheader"></TMPL_IF>
142      <TMPL_IF HTML5><header class="header"><TMPL_ELSE><div class="header"></TMPL_IF>
143      <span>
144     +<TMPL_IF PARENTLINKS>
145      <span class="parentlinks">
146     +<ul class="parentlinks">
147      <TMPL_LOOP PARENTLINKS>
148     -<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>/
149     +<li><a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a></li>
150      </TMPL_LOOP>
151     +</ul>
152      </span>
153     +</TMPL_IF>
154      <span class="title">
155      <TMPL_VAR TITLE>
156      <TMPL_IF ISTRANSLATION>