root/trunk/src/tutorials/examples/make_all_html/make_all_html.d

Revision 6, 1.0 kB (checked in by jcc7, 3 years ago)

Made more progress in developing convertToWiki and added some files.

Line 
1 /*
2
3 File:       make_all_html.d
4 Author:     J C Calvarese
5 License:    Public Domain
6 Date:       2004-10-27
7 Purpose:    Creates an HTML file that lists all of
8             the other files in the directory.
9
10 */
11
12 import std.recls;
13 import std.file;
14
15
16 void main()
17 {  
18     Search  search  =   new Search(getcwd(), "*.html", RECLS_FLAG.RECLS_F_FILES);
19     printf(`<html>` ~ "\n" ~
20       `<body>` ~ "\n" ~
21       `<head>` ~ "\n" ~
22       `<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">` ~ "\n" ~
23       `<title>All Topics</title>` ~ "\n" ~
24       `<link rel="stylesheet" type="text/css" href="style.css" >` ~ "\n" ~
25       `</head>` ~ "\n" ~
26       `<body>` ~ "\n" ~
27       `<h1>All Files</h1><ul>`);
28
29     foreach(Entry entry; search)
30     {
31         with(entry)
32         {
33             if(File() != "all.html")
34                 printf(`<li><a href="%.*s">%.*s</a></li>` ~ "\n", File(), File());
35         }
36     }
37     printf("</ul>\n</body>\n</html>");
38 }
Note: See TracBrowser for help on using the browser.