comparison trunk/src/docgen/page/writer.d @ 717:cb8edb09108a

Updated docgen (mostly) to new tango. Reflective options. Updated translations.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Fri, 01 Feb 2008 15:05:56 +0200
parents 381044a3feac
children
comparison
equal deleted inserted replaced
716:08e6174a2e1c 717:cb8edb09108a
4 */ 4 */
5 module docgen.page.writer; 5 module docgen.page.writer;
6 6
7 public import docgen.misc.misc; 7 public import docgen.misc.misc;
8 public import docgen.misc.options; 8 public import docgen.misc.options;
9 public import docgen.misc.parser;
9 import tango.io.model.IConduit : OutputStream; 10 import tango.io.model.IConduit : OutputStream;
10 import tango.util.time.Date; 11 import tango.time.chrono.Gregorian;
11 import tango.util.time.Clock; 12 import tango.text.locale.Core;
13 import tango.time.WallClock;
12 import tango.text.convert.Sprint; 14 import tango.text.convert.Sprint;
13 import tango.io.stream.FileStream; 15 import tango.io.stream.FileStream;
14 import tango.io.Stdout; 16 import tango.io.Stdout;
15 import tango.io.Print: Print; 17 import tango.io.Print: Print;
16 import tango.text.convert.Layout : Layout; 18 import tango.text.convert.Layout : Layout;
17 import tango.io.FilePath; 19 import tango.io.FilePath;
18 import tango.io.FileScan; 20 import tango.io.FileScan;
19 public import docgen.misc.parser;
20 21
21 const templateDir = "docgen/templates/"; 22 const templateDir = "docgen/templates/";
22 23
23 const formatDirs = [ "latex"[], "xml"[], "html"[], "plaintext"[] ]; 24 const formatDirs = [ "latex"[], "xml"[], "html"[], "plaintext"[] ];
24 25
180 scan(templateDir~factory.options.templates.templateStyle~"/"~format~"/", ".tpl"); 181 scan(templateDir~factory.options.templates.templateStyle~"/"~format~"/", ".tpl");
181 182
182 debug Stdout(scan.files.length)(" template files loaded.\n"); 183 debug Stdout(scan.files.length)(" template files loaded.\n");
183 184
184 foreach(tpl; scan.files) { 185 foreach(tpl; scan.files) {
185 m_templates[tpl.name] = loadTemplate(tpl.toUtf8()); 186 m_templates[tpl.name] = loadTemplate(tpl.toString());
186 } 187 }
187 } 188 }
188 189
189 char[] getTemplate(char[] name) { 190 char[] getTemplate(char[] name) {
190 auto tpl = name in m_templates; 191 auto tpl = name in m_templates;
208 209
209 return content; 210 return content;
210 } 211 }
211 212
212 char[] timeNow() { 213 char[] timeNow() {
213 auto date = Clock.toDate; 214 auto n = WallClock.now;
215 auto c = Gregorian.generic;
216 auto d = c.toDate(n);
214 auto sprint = new Sprint!(char); 217 auto sprint = new Sprint!(char);
215 return sprint.format("{0} {1} {2} {3}", 218
216 date.asDay(), 219 auto culture = new Culture("en-GB");
217 date.asMonth(), 220 auto dateTimeFormat = culture.dateTimeFormat();
218 date.day, 221
219 date.year).dup; 222 return sprint.format("{} {} {} {}",
223 dateTimeFormat.getAbbreviatedDayName(c.getDayOfWeek(n)),
224 1,//d.day(),
225 //dateTimeFormat.getAbbreviatedMonthName(d.month()),
226 2,//d.month(),
227 3//d.year()) //FIXME: something is broken here (Error: function expected before (), not *(&d + 8u) of type uint)
228 ).dup;
220 } 229 }
221 } 230 }
222 } 231 }