-
Notifications
You must be signed in to change notification settings - Fork 9
/
pom.xml
405 lines (383 loc) · 17.6 KB
/
pom.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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.devonfw</groupId>
<artifactId>maven-parent</artifactId>
<version>12</version>
</parent>
<groupId>com.devonfw.tools</groupId>
<artifactId>devonfw-docgen</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>Generates documentation as PDF, ePub or HTML from AsciiDoc wiki pages.</description>
<properties>
<github.repository>devon-docgen</github.repository>
<docgen.asciidoc.page>documentation/master</docgen.asciidoc.page>
<docgen.asciidoc.source>${basedir}</docgen.asciidoc.source>
<docgen.asciidoc.target>${basedir}/target/asciidoc</docgen.asciidoc.target>
<docgen.asciidoc.extension>asciidoc</docgen.asciidoc.extension>
<docgen.generated.docs>${basedir}/target/generated-docs</docgen.generated.docs>
<docgen.docsource>${docgen.asciidoc.page}.${docgen.asciidoc.extension}</docgen.docsource>
<docgen.images.dir>images</docgen.images.dir>
<docgen.highlighter>coderay</docgen.highlighter>
<docgen.headerFooter>true</docgen.headerFooter>
<docgen.preserveDirectories>true</docgen.preserveDirectories>
<docgen.linkcss>true</docgen.linkcss>
<docgen.toc>right</docgen.toc>
<docgen.icons>font</docgen.icons>
<docgen.idseparator>-</docgen.idseparator>
<docgen.highlighter>coderay</docgen.highlighter>
<docgen.backend>pdf</docgen.backend>
<docgen.output.format>pdf</docgen.output.format>
<docgen.eruby>erb</docgen.eruby>
<buildtime>${maven.build.timestamp}</buildtime>
<maven.build.timestamp.format>yyyy-MM-dd_HH.mm.ss</maven.build.timestamp.format>
<asciidoctor.maven.plugin.version>1.6.0</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.0-alpha.18</asciidoctorj.pdf.version>
<asciidoctorj.epub.version>1.5.0-alpha.9</asciidoctorj.epub.version>
<jruby.version>9.2.6.0</jruby.version>
<asciidoctor.skip>false</asciidoctor.skip>
<flatten.mode>resolveCiFriendliesOnly</flatten.mode>
</properties>
<modules>
<module>init</module>
<module>pdf</module>
<module>html</module>
<module>all</module>
</modules>
<developers>
<developer>
<name>Malte Brunnlieb</name>
<organization>Capgemini</organization>
</developer>
<developer>
<name>Jörg Hohwiller</name>
<organization>Capgemini</organization>
</developer>
<developer>
<name>Jaime Diaz Gonzalez</name>
<organization>Capgemini</organization>
</developer>
<developer>
<name>Jorge Dacal Cantos</name>
<organization>Capgemini</organization>
</developer>
</developers>
<contributors>
<contributor>
<name>Simon Röger</name>
<organization>Capgemini</organization>
</contributor>
</contributors>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
<!-- Flatten POM -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<flattenMode>${flatten.mode}</flattenMode>
<updatePomFile>true</updatePomFile>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>prepare-package</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
<version>2.0b5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>pre-process-asciidoc</id>
<phase>process-resources</phase>
<configuration>
<skip>${asciidoctor.skip}</skip>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<for param="asciidoc-file">
<path>
<fileset dir="${docgen.asciidoc.source}" casesensitive="yes">
<exclude name="**/target/**" />
<include name="**/*.${docgen.asciidoc.extension}" />
</fileset>
</path>
<sequential>
<!-- unset variable to ensure it is properly updated in next property and dirname tasks -->
<var name="path_to_copy_to" unset="true" />
<var name="path_id_prefix" unset="true" />
<property name="path_id_prefix" value="" />
<var name="file_path" unset="true" />
<property name="path_to_copy_to" value="" />
<dirname property="file_path" file="@{asciidoc-file}" />
<!-- unset variable to ensure it is properly updated in next basename task -->
<var name="filename" unset="true" />
<basename property="filename" file="@{asciidoc-file}" />
<var name="norm_prefix" unset="true" />
<property name="norm_prefix" value="" />
<!-- Remove the path from the root directory until current sourceDirectory to obtain a relative path -->
<script language="beanshell"><![CDATA[
String path = project.getProperty("file_path").replace("\\", "/");
String source = project.getProperty("docgen.asciidoc.source").replace("\\", "/");
path = path.replace(source, "");
if(path.startsWith("/")) {
path = path.replaceFirst("/", "");
}
project.setProperty("path_to_copy_to", path);
if(!path.isEmpty()) {
project.setProperty("path_id_prefix", path + "_");
} else {
project.setProperty("path_id_prefix", "");
}
String filename = project.getProperty("filename");
String normalizedPrefix = (path + "/" + filename).replace("/", "_");
if( normalizedPrefix.startsWith("_")) normalizedPrefix=normalizedPrefix.substring(1);
project.setProperty("norm_prefix", normalizedPrefix);
]]></script>
<copy file="@{asciidoc-file}" todir="${docgen.asciidoc.target}/${path_to_copy_to}"
encoding="${project.build.sourceEncoding}" outputencoding="${project.reporting.outputEncoding}"
verbose="true">
<filterchain>
<tokenfilter>
<linetokenizer />
<!-- make anchors unique by prefixing with filename -->
<replaceregex pattern="\[\[" replace="[[${norm_prefix}_" flags="g" />
<!-- automatically generate anchors for sections -->
<replaceregex pattern="^(==+) (.*)" replace="[[${norm_prefix}_\2]]${line.separator}\1 \2" flags="g" />
<!-- fix includes to contain asciidoc suffix (what is omitted on github wiki) -->
<replaceregex pattern="include\:\:(.*/)?(?!.*\.)(.*)\[" replace="include::\1\2.asciidoc[" flags="g" />
<replaceregex
pattern="include\:\:(.*)((\.adoc)|(\.asc)|(\.asciidoc))(\.asciidoc)\["
replace="include::\1\2[" flags="g" />
<!-- fix xrefs to also include filename prefix -->
<replaceregex pattern="xref:([^#\[]+)\[" replace="xref:${norm_prefix}_\1[" flags="g" />
<!-- fix links to anchor in other file (wiki page) by converting into xref inter document ref -->
<replaceregex pattern="link:([^#:.]+)#([^\[]*)\[" replace="xref:${path_id_prefix}\1.asciidoc_\2[" flags="g" />
<!-- fix links to contain .asciidoc suffix if omitted (wiki) -->
<replaceregex pattern="link:([^#:.\[]+)(#|\[)" replace="xref:${path_id_prefix}\1.asciidoc\2" flags="g" />
<!-- transform links xref -->
<replaceregex pattern="link:([^\]]+)(#|\[)" replace="xref:${path_id_prefix}\1\2" flags="g" />
<!-- fix xrefs with default linktext to also include filename prefix -->
<replaceregex pattern="xref:([^\[]*)\[\]" replace="xref:\1[\1]" flags="g" />
<!-- fix links to entire asciidoc file (wiki page) by converting into xref inter document ref -->
<!-- Unfortunately there is no generic way, thus supporting only files in directories of depth 2 -->
<replaceregex pattern="xref:([^#:/]+)/([^#:/]+)/([^#:/]+)\[" replace="xref:\1_\2_\3[" flags="g" />
<replaceregex pattern="xref:([^#:/]+)/([^#:/]+)\[" replace="xref:\1_\2[" flags="g" />
<replaceregex pattern="xref:([^#:/]+)\[" replace="xref:\1[" flags="g" />
<!-- fix links to anchor in other file (wik page) with default linktext by converting into xref
inter document ref -->
<replaceregex pattern="xref:([^#:/]+)/([^#:/]+)/([^#:/]+)#([^\[]*)\[\]" replace="xref:\1_\2_\3_\4[\1_\2_\3#\4]" flags="g" />
<replaceregex pattern="xref:([^#:/]+)/([^#:/]+)#([^\[]*)\[\]" replace="xref:\1_\2_\3[\1_\2#\3]" flags="g" />
<replaceregex pattern="xref:([^#:/]+)#([^\[]*)\[\]" replace="xref:\1_\2[\1#\2]" flags="g" />
<scriptfilter language="beanshell" byline="true" setbeans="true"><![CDATA[
String text = self.getToken();
if (text.startsWith("[[")) {
int end = text.indexOf("]]");
if (end > 0) {
String content = text.substring(2, end).trim().toLowerCase().replaceAll("[?¿!¡':()&/“”`\"\\[\\]#]", "").replace(' ', '-');
self.setToken("[[" + content + "]]" + text.substring(end + 2));
}
}
]]></scriptfilter>
<!-- insert top-level anchor for file so links to this enire file work after being resolved as xref -->
<replaceregex pattern="^(=) " replace="[[${norm_prefix}]]${line.separator}\1 "
flags="g" />
<!-- resolve maven variables -->
<replaceregex pattern="\$\{project\.version\}" replace="${project.version}" flags="g" />
<replaceregex pattern="\$\{project\.artifactId\}" replace="${project.artifactId}" flags="g" />
<replaceregex pattern="\$\{buildtime\}" replace="${buildtime}" flags="g" />
</tokenfilter>
</filterchain>
</copy>
</sequential>
</for>
<!-- Copy images and further resources of the wiki -->
<copy todir="${docgen.asciidoc.target}" encoding="${project.build.sourceEncoding}">
<path>
<fileset dir="${docgen.asciidoc.source}">
<exclude name="**/*.${docgen.asciidoc.extension}" />
<exclude name="**/target/**" />
<exclude name="**/pom.xml" />
<exclude name="**/${docgen.images.dir}/**/*" />
<!-- exclude local m2 repository in Jenkins builds -->
<exclude name="**/.repository/**" />
</fileset>
</path>
</copy>
<!-- Check all the directories with images (list received as argument) -->
<for list="${docgen.images.dir}" param="receiveddir">
<sequential>
<!-- For each directory check its subfolders and copy them -->
<for param="imagesdir">
<path>
<dirset dir="${docgen.asciidoc.source}" casesensitive="yes">
<include name="**/@{receiveddir}/**" />
</dirset>
</path>
<sequential>
<!-- Copy the resources -->
<copy todir="${docgen.asciidoc.target}/@{receiveddir}">
<path>
<fileset dir="@{imagesdir}">
<include name="**/*" />
</fileset>
</path>
</copy>
</sequential>
</for>
</sequential>
</for>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.maven.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>${asciidoctorj.pdf.version}</version>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-epub3</artifactId>
<version>${asciidoctorj.epub.version}</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>${jruby.version}</version>
</dependency>
</dependencies>
<configuration>
<skip>${asciidoctor.skip}</skip>
<sourceDirectory>${docgen.asciidoc.target}</sourceDirectory>
<sourceDocumentName>${docgen.docsource}</sourceDocumentName>
<imagesDir>${docgen.generated.docs}</imagesDir>
<backend>${docgen.backend}</backend>
<outputDirectory>${docgen.generated.docs}</outputDirectory>
<sourceHighlighter>${docgen.highlighter}</sourceHighlighter>
<headerFooter>${docgen.headerFooter}</headerFooter>
<preserveDirectories>${docgen.preserveDirectories}</preserveDirectories>
<eruby>${docgen.eruby}</eruby>
<attributes>
<allow-uri-read />
<icons>${docgen.icons}</icons>
<pagenums />
<experimental />
<toc>${docgen.toc}</toc>
<baseDir>./</baseDir>
<linkcss>${docgen.linkcss}</linkcss>
<idprefix />
<idseparator>${docgen.idseparator}</idseparator>
</attributes>
</configuration>
<executions>
<execution>
<id>generate-doc</id>
<phase>compile</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<!-- should actually be moved to maven-parent -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>custom-style</id>
<activation>
<file>
<exists>./theme/custom-theme.yml</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<configuration>
<attributes>
<pdf-stylesdir>${basedir}/theme</pdf-stylesdir>
<pdf-style>custom</pdf-style>
</attributes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!--
<profile>
<id>documentation-folder</id>
<activation>
<file>
<exists>./documentation</exists>
</file>
</activation>
<properties>
<docgen.asciidoc.source>./documentation</docgen.asciidoc.source>
</properties>
</profile>
-->
</profiles>
</project>