-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.xml
executable file
·988 lines (866 loc) · 29.9 KB
/
doc.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
<!--
This is an ant build file for building Dynamator documentation.
To build Dynamator documentation
ant -f doc.xml
Requirements:
- Ant 1.5
Classpath Requirements:
- dynamator.jar
$ANT_HOME/lib must contain:
- jakarta-oro-2.0.8.jar
(http://jakarta.apache.org/oro)
- antcontrib-0.5.jar
(http://ant-contrib.sourceforge.net)
-->
<project name="dynamator" default="all">
<!-- user-defined configuration -->
<property name="configuration.file" value="build.properties"/>
<property file="${user.home}/dynamator.build.properties" />
<property file="${user.home}/build.properties" />
<property file="${basedir}/${configuration.file}" />
<!-- destination directories -->
<property name="dir.build" location="${basedir}/build"/>
<property name="dir.classes" location="${dir.build}/classes"/>
<property name="dir.doc-gen" location="${dir.build}/doc"/>
<property name="dir.site" location="${dir.build}/site"/>
<property name="dir.doc-work" location="${dir.build}/doc-work"/>
<!-- note: news file is not in CVS -->
<property name="file.news" location="${basedir}/news.txt"/>
<!-- source directories -->
<property name="dir.doc-src" location="${basedir}/doc-src"/>
<property name="dir.tutorial" location="${dir.doc-src}/tutorial"/>
<property name="dir.examples" location="${basedir}/examples"/>
<path id="classpath.project">
<pathelement location="${dir.classes}"/>
<pathelement location="${basedir}/dynamator.jar"/>
<fileset dir="${basedir}">
<include name="lib/**/*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<taskdef name="dynamate"
classname="dynamator.ant.DynamateTask"
classpathref="classpath.project"
/>
<taskdef name="if"
classname="net.sf.antcontrib.logic.IfTask"/>
<taskdef name="foreach"
classname="net.sf.antcontrib.logic.ForEach"/>
<taskdef name="propertyregexp"
classname="net.sf.antcontrib.property.RegexTask"/>
<path id="path.doc-src">
<pathelement path="${dir.doc-src}"/>
</path>
<target name="all"
depends="
validate,
sitedocs
"
description="Build all documentation."
/>
<target name="init">
<tstamp>
<format property="last-update"
timezone="GMT"
pattern="dd MMMMMMMMM yyyy"/>
<format property="last-update-year"
timezone="GMT"
pattern="yyyy"/>
</tstamp>
<mkdir dir="${dir.doc-gen}"/>
<copy todir="${dir.doc-gen}">
<fileset dir="${dir.doc-src}/html"
includes="images/**, *.css"/>
<fileset dir="${dir.doc-src}/html"
includes="manual/*.pdf"/>
</copy>
<mkdir dir="${dir.doc-work}"/>
<!--
Create main xsl template.
doc-src/html/template.html
* doc-src/dynxsl/template.dyn
==> doc-src/work/template.xsl
-->
<dynamate
srcdir="${dir.doc-src}/html"
matchdir="${dir.doc-src}/dynxsl"
destdir="${dir.doc-work}"
destsuffix="xsl"
includes="template.html"
xml="true"
indent="false"
/>
<!--
Copy any xsl files from dynxsl to work directory.
-->
<copy todir="${dir.doc-work}">
<fileset dir="${dir.doc-src}/dynxsl">
<include name="*.xsl"/>
</fileset>
</copy>
<!--
Each HTML subdirectory (except FAQ) has its own submenu.
For each subdirectory, modify the main template to include
the submenu.
doc-src/dynhtml/{manual|i18n}/template.dyn
* doc-src/html/template.html
==> doc-src/work/{manual|i18n}/template.html
-->
<antcall target="sub-template">
<param name="sub-template.dir" value="manual"/>
</antcall>
<antcall target="sub-template">
<param name="sub-template.dir" value="i18n"/>
</antcall>
<mkdir dir="${dir.doc-src}/html/tutorial"/>
<antcall target="sub-template">
<param name="sub-template.dir" value="tutorial"/>
</antcall>
</target>
<target name="check-sub-template-uptodate">
<uptodate property="sub-template.uptodate"
targetfile="${dir.doc-work}/${sub-template.dir}/template.xsl">
<srcfiles dir="${dir.doc-src}">
<include name="work/${sub-template.dir}/template.html"/>
<include name="dynxsl/${sub-template.dir}/template.dyn"/>
<include name="dynxsl/${sub-template.dir}/*.dyncopy*"/>
<include name="dyn/template.dyn"/>
</srcfiles>
</uptodate>
</target>
<target name="sub-template"
depends="check-sub-template-uptodate"
unless="sub-template.uptodate">
<mkdir dir="${dir.doc-work}/${sub-template.dir}"/>
<!--
Create subordinate html templates.
doc-src/dynhtml/manual/template.dyn
* doc-src/html/template.html (.dyn references ../template)
==> doc-src/work/manual/template.html
-->
<dynamate
srcdir="${dir.doc-src}/dynhtml/${sub-template.dir}"
matchdir="${dir.doc-src}/html/${sub-template.dir}"
destdir="${dir.doc-work}/${sub-template.dir}"
destsuffix="html"
includes="**/template.dyn"
xml="true"
indent="false"
/>
<if>
<available file="${dir.doc-src}/dynxsl/${sub-template.dir}"/>
<then>
<!--
Create subordinate xsl templates.
doc-src/work/tutorial/template.html
* doc-src/dynxsl/tutorial/template.dyn
==> doc-src/work/tutorial/template.xsl
-->
<dynamate
srcdir="${dir.doc-work}/${sub-template.dir}"
matchdir="${dir.doc-src}/dynxsl/${sub-template.dir}"
destdir="${dir.doc-work}/${sub-template.dir}"
destsuffix="xsl"
includes="template.html"
includeds="**/extra*.dyncopy"
xml="true"
indent="false"
/>
<!--
Copy any xsl files from dynxsl to work directory.
-->
<copy todir="${dir.doc-work}/${sub-template.dir}">
<fileset dir="${dir.doc-src}/dynxsl/${sub-template.dir}">
<include name="*.xsl"/>
</fileset>
</copy>
</then>
<else>
<!--
Create subordinate xsl templates.
doc-src/work/manual/template.html
* doc-src/dynxsl/template.dyn
==> doc-src/work/manual/template.xsl
-->
<dynamate
srcdir="${dir.doc-work}/${sub-template.dir}"
matchdir="${dir.doc-src}/dynxsl"
destdir="${dir.doc-work}/${sub-template.dir}"
destsuffix="xsl"
includes="template.html"
includeds="**/extra*.dyncopy"
xml="true"
indent="false"
/>
<!--
Copy any xsl files from dynxsl to work directory.
-->
<copy todir="${dir.doc-work}/${sub-template.dir}">
<fileset dir="${dir.doc-src}/dynxsl">
<include name="*.xsl"/>
</fileset>
</copy>
</else>
</if>
</target>
<target name="faq"
depends="init">
<mkdir dir="${dir.doc-work}/faq"/>
<dynamate
srcdir="${dir.doc-src}/html/faq"
matchdir="${dir.doc-src}/dynxsl/faq"
destdir="${dir.doc-work}/faq"
destsuffix="xsl"
includes="faq_template.html"
xml="true"
indent="false"
/>
<xslt
in="${dir.doc-src}/html/faq/faq.xml"
out="${dir.doc-src}/html/faq.html"
style="${dir.doc-work}/faq/faq_template.xsl"
/>
<!-- I can't get xsl to remove the xmlns from the output file.
Instead, use brute force. -->
<replace file="${dir.doc-src}/html/faq.html"
token=' xmlns="http://www.w3.org/1999/xhtml"'
value=""
/>
</target>
<target name="sitedocs"
depends="init, faq, taskdef-doc, tutorial, examples"
>
<!--
XSL doesn't have a way to determine the document filename,
which is needed to adapt the menu.
The XSLT task could provide this as a value-add, but doesn't.
To work-around this limitation, the XSLT task is called
once for each file, and the filename is passed as a param.
This is a performance drag because the XSLT task doesn't cache
stylesheets across task invocations, even thought it easily
could. Fortunately the site is small.
I used to use Dynamator for this, which was very fast, but
this way I don't need a second file for each HTML file.
-->
<foreach target="sitedoc" param="sitedoc.filename">
<path>
<fileset dir="${dir.doc-src}/html"
includes="**/*.html"
excludes="**/*template.html"
/>
</path>
<param name="last-update" value="${last-update}"/>
<param name="last-update-year" value="${last-update-year}"/>
</foreach>
<!--
Clean up anything generated by XSL that isn't right.
I add these as I find them based on validation results.
Ideally, I'd like to figure out how to prevent these problems
in the first place.
- Remove all the default attributes that XSL inserts.
- Collapse empty elements that are rendered incorrectly in
one browser or another.
- Remove xmlns attributes.
All of these could be done with replace if it supported
a nested fileset. Since it doesn't, they use replaceregexp.
-->
<replaceregexp flags="g"
match='<br( clear="none")?></br>'
replace='<br />'
>
<fileset dir="${dir.doc-gen}"
includes="**/*.html"
/>
</replaceregexp>
<replaceregexp flags="g"
match=' (row|col)span="1"'
replace=''
>
<fileset dir="${dir.doc-gen}"
includes="**/*.html"
/>
</replaceregexp>
<replaceregexp flags="g"
match=' shape="rect"'
replace=''
>
<fileset dir="${dir.doc-gen}"
includes="**/*.html"
/>
</replaceregexp>
<replaceregexp flags="g"
match=' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"'
replace=''
>
<fileset dir="${dir.doc-gen}"
includes="**/*.html"
/>
</replaceregexp>
<replaceregexp flags="g"
match=' xmlns:xhtml="http://www.w3.org/1999/xhtml"'
replace=""
>
<fileset dir="${dir.doc-gen}"
includes="**/*.html"
/>
</replaceregexp>
<!--
Adjust any files that aren't right.
Specifically, the tutorial index, which was built using
a template designed for one directory lower.
-->
<replaceregexp
match='id="thispage"'
replace=''
file="${dir.doc-gen}/tutorial/index.html"
/>
<replaceregexp flags="g"
match='../../'
replace='../'
file="${dir.doc-gen}/tutorial/index.html"
/>
<replaceregexp flags="g"
match='../example([0-9])'
replace='example\1'
file="${dir.doc-gen}/tutorial/index.html"
/>
<replaceregexp flags="gs"
match='<div class="tutorial-nav">.*?</div>'
replace=''
file="${dir.doc-gen}/tutorial/index.html"
/>
<!-- validate generated docs -->
<antcall target="validate-gen"/>
</target>
<target name="sitedoc">
<!-- normalize the base directory name -->
<pathconvert property="dir.doc-src.normalized"
refid="path.doc-src"
dirsep="/"
/>
<!-- normalize the file name -->
<propertyregexp property="sitedoc.filename"
input="${sitedoc.filename}"
defaultValue="${sitedoc.filename}"
override="true"
regexp="\\"
replace="/"
/>
<!-- derive the relative path to the file -->
<propertyregexp property="sitedoc.relativefilename"
input="${sitedoc.filename}"
defaultValue="${sitedoc.filename}"
override="true"
regexp="${dir.doc-src.normalized}/html/"
replace=""
/>
<!-- derive the relative path to the template -->
<propertyregexp property="sitedoc.relativefilepath"
input="${sitedoc.relativefilename}"
defaultValue=""
override="true"
regexp="/[^/]*.html$"
replace=""
/>
<property name="sitedoc.xsltemplatepath"
value="${sitedoc.relativefilepath}"/>
<!-- derive the href value for the template -->
<propertyregexp property="sitedoc.selfhref"
input="${sitedoc.relativefilename}"
defaultValue=""
override="true"
regexp="${sitedoc.relativefilepath}/(.*)$"
select="\1"
/>
<if>
<available file="${dir.doc-work}/${sitedoc.xsltemplatepath}/template.xsl"/>
<else>
<!-- derive the relative path to the template -->
<propertyregexp property="sitedoc.xsltemplatepath"
input="${sitedoc.xsltemplatepath}"
defaultValue="${sitedoc.xsltemplatepath}"
override="true"
regexp="/[^/]+$"
replace=""
/>
<!-- derive the href value for the template -->
<propertyregexp property="sitedoc.selfhref"
input="${sitedoc.relativefilename}"
defaultValue=""
override="true"
regexp="${sitedoc.xsltemplatepath}/(.*)$"
select="../\1"
/>
</else>
</if>
<!-- there's probably a more elegant way to do this -->
<if>
<equals
arg1="${sitedoc.relativefilename}"
arg2="tutorial/index.html"/>
<then>
<!-- derive the href value for the template -->
<propertyregexp property="sitedoc.selfhref"
input="${sitedoc.relativefilename}"
defaultValue=""
override="true"
regexp="index.html"
select="../index.html"
/>
</then>
</if>
<xslt
in="${sitedoc.filename}"
out="${dir.doc-gen}/${sitedoc.relativefilename}"
style="${dir.doc-work}/${sitedoc.xsltemplatepath}/template.xsl"
>
<param name="last-update" expression="${last-update}"/>
<param name="last-update-year" expression="${last-update-year}"/>
<param name="nav-file-name" expression="${sitedoc.selfhref}"/>
<!-- following are only used by tutorial -->
<param name="nav-dir-name"
expression="${sitedoc.relativefilepath}"/>
<param name="insert-from-dir"
expression="${dir.doc-work}/${sitedoc.relativefilepath}"/>
<param name="nav-index-document"
expression="${dir.doc-work}/tutorial/dirs.xml"/>
<xmlcatalog>
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml1-transitional.dtd"/>
<entity publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml-lat1.ent"/>
<entity publicId="-//W3C//ENTITIES Symbols for XHTML//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml-symbol.ent"/>
<entity publicId="-//W3C//ENTITIES Special for XHTML//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml-special.ent"/>
</xmlcatalog>
</xslt>
</target>
<!--
============================================================
Ant Task Documentation
============================================================
-->
<target name="check-taskdef-doc">
<uptodate property="taskdef-doc.uptodate"
srcfile="${basedir}/tools/dynamator/ant/DynamateTask.java"
targetfile="${dir.doc-src}/html/manual/DynamateTask.html"
>
</uptodate>
</target>
<target name="taskdef-doc"
depends="check-taskdef-doc"
unless="taskdef-doc.uptodate"
>
<!--
Extract the first block of javadoc comments from the
ant task source file.
-->
<loadfile property="taskdoc"
srcFile="${basedir}/tools/dynamator/ant/DynamateTask.java"/>
<propertyregexp property="taskdoc"
input="${taskdoc}"
defaultValue="${taskdoc}"
global="true"
override="true"
regexp="(\r\n|\n\r)"
replace="✏"
/>
<propertyregexp property="taskdoc"
input="${taskdoc}"
defaultValue="${taskdoc}"
global="true"
override="true"
regexp="(\r|\n)"
replace="✏"
/>
<!-- extract the first javadoc comment -->
<propertyregexp property="taskdoc"
input="${taskdoc}"
defaultValue="${taskdoc}"
override="true"
regexp="^.*/\*\*"
replace=""
/>
<propertyregexp property="taskdoc"
input="${taskdoc}"
defaultValue="${taskdoc}"
override="true"
regexp="\*\*/.*$"
replace=""
/>
<!-- document heading -->
<property name="taskdoc.heading"
value="<h1>dynamator.ant.DynamateTask</h1>"/>
<!--
Use dynamate.html as a template...
-->
<loadfile property="template"
srcFile="${dir.doc-src}/html/manual/dynamate.html"/>
<propertyregexp property="template"
input="${template}"
defaultValue="${template}"
global="true"
override="true"
regexp="(\r\n|\n\r)"
replace="✏"
/>
<propertyregexp property="template"
input="${template}"
defaultValue="${template}"
global="true"
override="true"
regexp="(\r|\n)"
replace="✏"
/>
<!-- replace the title -->
<propertyregexp property="template"
input="${template}"
defaultValue="${template}"
override="true"
regexp="<title>.*?</title>"
replace="<title>dynamate task</title>"
/>
<!-- replace the body -->
<propertyregexp property="template"
input="${template}"
defaultValue="${template}"
override="true"
regexp="<body>.*?</body>"
replace="<body> ${taskdoc.heading} ${taskdoc}</body>"
/>
<propertyregexp property="template"
input="${template}"
defaultValue="${template}"
global="true"
override="true"
regexp="✏"
replace=" "
/>
<!-- output to the manual directory -->
<echo file="${dir.doc-src}/html/manual/DynamateTask.html"
message="${template}"
/>
</target>
<!--
============================================================
Examples
============================================================
-->
<target name="examples">
<!-- Build the examples -->
<ant antfile="${dir.examples}/build.xml" inheritAll="false"/>
<!--
For documentation, examples will be copied
into their own subdirectory
-->
<property name="examples.dir"
location="${dir.doc-gen}/examples"/>
<mkdir dir="${examples.dir}"/>
<!--
Copy example HTML and PHP
(SourceForge site uses PHP)
-->
<copy todir="${examples.dir}">
<fileset dir="${dir.examples}">
<include name="*.html"/>
</fileset>
</copy>
<copy todir="${examples.dir}/php">
<fileset dir="${dir.examples}/php/generated">
<include name="*.php"/>
</fileset>
</copy>
<!--
Copy HTML, .dyn, and output, appending .txt to name
so files can be viewed as-is in browser
-->
<copy todir="${examples.dir}">
<fileset dir="${dir.examples}">
<include name="*.html"/>
<include name="**/*.dyn"/>
<exclude name="jsp/more/**"/>
<exclude name="i18n/**"/>
<exclude name="perl/**"/>
<exclude name="velocity/**"/>
<exclude name="webmacro/**"/>
<exclude name="**/*.bak"/>
<exclude name="**/*.%"/>
</fileset>
<mapper type="glob"
from="*" to="*.txt"/>
</copy>
<copy todir="${examples.dir}">
<fileset dir="${dir.examples}">
<include name="**/generated/*.*"/>
<exclude name="jsp/more/**"/>
<exclude name="i18n/**"/>
<exclude name="perl/**"/>
<exclude name="velocity/**"/>
<exclude name="webmacro/**"/>
</fileset>
<mapper type="regexp"
from="^(.*)[/\\]generated[/\\](.*)$$" to="\1/\2.txt"/>
</copy>
</target>
<!--
============================================================
Tutorial
============================================================
-->
<target name="dynamate-tutorial"
description="Dynamate tutorial examples."
>
<dynamate
srcdir="${dir.tutorial}"
matchdir="${dir.tutorial}"
destdir="${dir.tutorial}"
destsuffix="jsp"
includes="**/*.html"
/>
<dynamate
srcdir="${dir.tutorial}"
matchdir="${dir.tutorial}"
destdir="${dir.tutorial}"
destsuffix="jsp"
includes="**/*.xml"
/>
</target>
<target name="tutorial"
depends="init, dynamate-tutorial"
>
<!-- normalize tutorial directory property -->
<propertyregexp property="dir.tutorial"
input="${dir.tutorial}"
global="true"
override="true"
regexp="\\"
replace="/"
/>
<!--
Create XML tutorial directory index.
<tutorial>
<dir name="tutorial-directory-name">
...
</tutorial>
-->
<pathconvert property="xml.tutorial.dirs"
pathsep="'/> <dir name='"
dirsep="/"
>
<path id="path.tutorial.dirs">
<dirset dir="${dir.tutorial}">
<include name="example*-*"/>
</dirset>
</path>
</pathconvert>
<mkdir dir="${dir.doc-work}/tutorial"/>
<echo file="${dir.doc-work}/tutorial/dirs.xml"
message="<tutorial> <dir name='${xml.tutorial.dirs}'/> </tutorial>"/>
<replace file="${dir.doc-work}/tutorial/dirs.xml"
token="${dir.tutorial}/"
value="tutorial/"
/>
<!--
Copy all index.html files to the source directory tree
for selection.
-->
<copy todir="${dir.doc-src}/html/tutorial">
<fileset dir="${dir.tutorial}">
<include name="**/index.html"/>
</fileset>
</copy>
<!--
Copy all files other than index.html to the destination
directory tree.
-->
<mkdir dir="${dir.doc-gen}/tutorial"/>
<copy todir="${dir.doc-gen}/tutorial">
<fileset dir="${dir.tutorial}">
<exclude name="**/index.html"/>
<exclude name="**/*.asxml"/>
<exclude name="**/*.bak"/>
<exclude name="**/*.%"/>
</fileset>
</copy>
<!--
Copy all inserted files to the work directory tree,
preparing them for insertion.
-->
<copy todir="${dir.doc-work}/tutorial"
overwrite="true">
<fileset dir="${dir.tutorial}">
<exclude name="*"/>
<exclude name="**/index.html"/>
<exclude name="**/*.bak"/>
<exclude name="**/*.%"/>
</fileset>
<mapper type="glob" from="*" to="*.insert"/>
</copy>
<!--
Replace HTML special characters in copied files,
and add formatting.
-->
<replace dir="${dir.doc-work}/tutorial"
token="&"
value="&amp;">
<include name="example*/*.insert"/>
</replace>
<replace dir="${dir.doc-work}/tutorial"
token="<" value="&lt;">
<include name="example*/*.insert"/>
</replace>
<replace dir="${dir.doc-work}/tutorial"
token=">" value="&gt;">
<include name="example*/*.insert"/>
</replace>
<replace dir="${dir.doc-work}/tutorial"
token="&lt;%"
value="<span class='dyn-inline'>&lt;%">
<include name="example*/*.jsp.insert"/>
</replace>
<replace dir="${dir.doc-work}/tutorial"
token="%&gt;" value="%&gt;</span>">
<include name="example*/*.jsp.insert"/>
</replace>
<replace dir="${dir.doc-work}/tutorial"
token="&lt;jsp:useBean"
value="<span class='dyn-inline'>&lt;jsp:useBean">
<include name="example*/*.jsp.insert"/>
</replace>
<replace file="${dir.doc-work}/tutorial/example01b-HelloWorld_Bean/HelloWorld2.jsp.insert"
token="/jsp:useBean&gt;"
value="/jsp:useBean&gt;</span>">
<include name="example*/*.jsp.insert"/>
</replace>
<replaceregexp file="${dir.doc-work}/tutorial/example01b-HelloWorld_Bean/HelloWorld2.jsp.insert"
match="(&lt;jsp:getProperty[^/]*/&gt;)"
replace="<span class='dyn-inline'>\1</span>">
</replaceregexp>
<!--
Wrap contents of each copied file in a <pre> element.
This makes them XML documents.
-->
<replaceregexp flags="s"
match="^(.*)$"
replace='<pre>\1</pre>'
>
<fileset dir="${dir.doc-work}/tutorial">
<include name="example*/*.insert"/>
</fileset>
</replaceregexp>
<!--
Copy all JSP files to the output directory tree.
These are not directly inserted because some are too
wide for the current page design. Instead they are
inserted using an iframe.
-->
<copy todir="${dir.doc-gen}/tutorial"
overwrite="true">
<fileset dir="${dir.doc-work}/tutorial">
<include name="**/*.jsp.insert"/>
</fileset>
<mapper type="glob" from="*.jsp.insert" to="*_jsp.html"/>
</copy>
<!--
Wrap contents of each JSP file in HTML.
-->
<replaceregexp flags="s"
match="^(.*)$"
replace='<html><head><link rel="stylesheet" type="text/css" href="../../style.css"></head><body class="out">\1</body></html>'
>
<fileset dir="${dir.doc-gen}/tutorial">
<include name="example*/*_jsp.html"/>
</fileset>
</replaceregexp>
</target>
<target name="site"
depends="all">
<mkdir dir="${dir.site}"/>
<copy todir="${dir.site}">
<fileset dir="${dir.doc-gen}">
<include name="**/*.*"/>
</fileset>
</copy>
<replaceregexp
match='"[\./]*images/sflogo.png"'
replace='"http://sourceforge.net/sflogo.php?group_id=28448"'
>
<fileset dir="${dir.site}"
includes="**/*.html"
/>
</replaceregexp>
<available property="news.available"
file="${file.news}"
/>
<antcall target="show-news"/>
</target>
<target name="show-news"
if="news.available"
>
<loadfile property="news"
failonerror="false"
srcFile="${file.news}"/>
<replace file="${dir.site}/index.html"
token='<div id="right-column"></div>'
value='<div id="news">${news}</div>'/>
</target>
<target name="validate">
<antcall target="validate_">
<param name="validate.dir" location="${dir.doc-src}/html"/>
<param name="validate.pattern" value="**/*.html"/>
</antcall>
<antcall target="validate_">
<param name="validate.dir" location="${dir.doc-src}/html"/>
<param name="validate.pattern" value="**/index.html"/>
</antcall>
</target>
<target name="validate-gen">
<antcall target="validate_">
<param name="validate.dir" location="${dir.doc-gen}"/>
<param name="validate.pattern" value="*.html"/>
</antcall>
<antcall target="validate_">
<param name="validate.dir" location="${dir.doc-gen}/manual"/>
<param name="validate.pattern" value="*.html"/>
</antcall>
</target>
<target name="validate_">
<xmlvalidate warn="true" failonerror="true">
<fileset dir="${validate.dir}">
<include name="${validate.pattern}"/>
</fileset>
<xmlcatalog>
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml1-transitional.dtd"/>
<entity publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml-lat1.ent"/>
<entity publicId="-//W3C//ENTITIES Symbols for XHTML//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml-symbol.ent"/>
<entity publicId="-//W3C//ENTITIES Special for XHTML//EN"
location="${dir.doc-src}/xmlcatalog/xhtml/xhtml-special.ent"/>
</xmlcatalog>
</xmlvalidate>
</target>
<target name="clean"
description="Delete all program-generated files."
depends="clean-doc, clean-site"
/>
<target name="clean-doc">
<delete dir="${dir.doc-gen}"/>
<delete dir="${dir.doc-work}"/>
<delete file="${dir.doc-src}/html/faq.html"/>
<delete dir="${dir.doc-src}/html/tutorial"/>
<delete>
<fileset dir="${dir.doc-src}/tutorial">
<include name="**/*.jsp"/>
</fileset>
<fileset dir="${dir.doc-src}">
<include name="**/*.asxml"/>
</fileset>
</delete>
</target>
<target name="clean-site">
<delete dir="${dir.site}"/>
</target>
</project>