/[debian]/libjpf-java/trunk/jdocs/build.jxp
ViewVC logotype

Contents of /libjpf-java/trunk/jdocs/build.jxp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1601 - (show annotations)
Sat Feb 28 23:28:19 2009 UTC (12 years, 5 months ago) by gregoa
File size: 2103 byte(s)
[svn-inject] Forking libjpf-java source to Trunk
1 <%
2 // Java Plug-in Framework (JPF)
3 // Copyright (C) 2004 - 2005 Dmitry Olshansky
4 // $Id$
5 %>
6 <%
7 import org.onemind.jxp.*;
8 import java.io.*;
9
10 // Functions
11
12 function void processFile(JxpProcessor processor, File baseFolder, File file,
13 File outFolder) {
14 println("Processing " + file + " to the folder " + outFolder);
15 if (file.isDirectory()) {
16 File newOutFolder = new File(outFolder, file.getName());
17 File[] files = file.listFiles();
18 for (int i = 0; i < files.length; i++) {
19 String name = files[i].getName();
20 if (!name.endsWith(".jxp") || name.endsWith(".ijxp")) {
21 continue;
22 }
23 processFile(processor, baseFolder, files[i], newOutFolder);
24 }
25 return;
26 }
27 if (!outFolder.exists()) {
28 outFolder.mkdirs();
29 }
30 String fileName = file.getName();
31 fileName = fileName.substring(0, fileName.lastIndexOf('.')) + ".html";
32 Writer out = new OutputStreamWriter(new BufferedOutputStream(
33 new FileOutputStream(new File(outFolder, fileName), false)), "UTF-8");
34 try {
35 processor.process(file.getCanonicalPath().substring(
36 baseFolder.getCanonicalPath().length()),
37 new JxpProcessingContext(out, new HashMap()));
38 } finally {
39 out.close();
40 }
41 }
42
43 // Main control flow
44
45 JxpProcessor processor = new JxpProcessor(
46 jxp_context.getCurrentPage().getSource());
47 File inFolder =
48 new File(jxp_context.getCurrentPage().getSource().getPathPrefix());
49 File outFolder = new File(System.getProperty("jdocs.outputFolder"));
50 if (!outFolder.isDirectory()) {
51 println("Output directory not found: " + outFolder.getCanonicalFile());
52 exit;
53 }
54 println("Processing files in folder: " + inFolder.getCanonicalFile());
55 println("Generating result to: " + outFolder.getCanonicalFile());
56
57 File[] files = inFolder.listFiles();
58 for (int i = 0; i < files.length; i++) {
59 if (files[i].equals(outFolder)) {
60 continue;
61 }
62 String name = files[i].getName();
63 if ((!name.endsWith(".jxp") || name.equals(jxp_script_name)
64 || name.endsWith(".ijxp")) && !files[i].isDirectory()) {
65 continue;
66 }
67 processFile(processor, inFolder, files[i], outFolder);
68 }
69 %>

  ViewVC Help
Powered by ViewVC 1.1.26