You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow to set an alternative source directory (for editing)
Always check if a file is existing before returning true for isEditable
and non-null for getDoxiaSourcePath()/getDoxiaSourcePath(String)
This closes#277
Copy file name to clipboardExpand all lines: doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -198,12 +198,11 @@ public Map<String, DocumentRenderer> locateDocumentFiles(SiteRenderingContext si
198
198
199
199
addModuleFiles(
200
200
siteRenderingContext.getRootDirectory(),
201
+
siteDirectory,
201
202
moduleBasedir,
202
203
module,
203
204
excludes,
204
-
files,
205
-
siteDirectory.isEditable(),
206
-
siteDirectory.isSkipDuplicates());
205
+
files);
207
206
}
208
207
}
209
208
}
@@ -228,32 +227,27 @@ private List<String> filterExtensionIgnoreCase(List<String> fileNames, String ex
228
227
* Populates the files map with {@link DocumentRenderer}s per output name in parameter {@code files} for all files in the moduleBasedir matching the module extensions,
229
228
* taking care of duplicates if needed.
230
229
*
231
-
* @param rootDir
230
+
* @param siteRootDirectory
231
+
* @param siteDirectory
232
232
* @param moduleBasedir
233
233
* @param module
234
234
* @param excludes
235
235
* @param files
236
-
* @param editable
237
-
* @param skipDuplicates
238
236
* @throws IOException
239
237
* @throws RendererException
240
238
*/
241
239
privatevoidaddModuleFiles(
242
-
FilerootDir,
240
+
FilesiteRootDirectory,
241
+
SiteDirectorysiteDirectory,
243
242
FilemoduleBasedir,
244
243
ParserModulemodule,
245
244
Stringexcludes,
246
-
Map<String, DocumentRenderer> files,
247
-
booleaneditable,
248
-
booleanskipDuplicates)
245
+
Map<String, DocumentRenderer> files)
249
246
throwsIOException, RendererException {
250
247
if (!moduleBasedir.exists() || ArrayUtils.isEmpty(module.getExtensions())) {
* @since 1.5 (was since 1.1 in o.a.m.d.sink.render)
33
36
*/
34
37
publicclassDocumentRenderingContext {
35
-
privatefinalFilebasedir;
36
38
37
-
privatefinalStringbasedirRelativePath;
39
+
/** absolute path to the source base directory (not null, pseudo value when not a Doxia source), this is parser format specific. Must start with {@link #siteRootDirectory}. */
40
+
privatefinalFilebasedir;
38
41
42
+
/** {@link #basedir} relative path to the document's source including {@link #extension}. May be {@code null} if not rendered from a Doxia source */
39
43
privatefinalStringinputPath;
40
44
45
+
/** same as {@link #inputPath} but with extension replaced with {@code .html}, this is parser format specific */
41
46
privatefinalStringoutputPath;
42
47
48
+
/** the Doxia module parser id associated to this document, may be null if document not rendered from a Doxia source. */
43
49
privatefinalStringparserId;
44
50
45
-
privatefinalStringrelativePath;
46
-
51
+
/** the source document filename extension, may be null if document not rendered from a Doxia source. */
47
52
privatefinalStringextension;
48
53
49
54
privateMap<String, String> attributes;
50
55
51
-
privatefinalbooleaneditable;
56
+
/**
57
+
* The absolute paths of directories which may contain the original editable source.
58
+
* If empty document is not editable.
59
+
*/
60
+
privatefinalCollection<File> sourceDirectories;
52
61
62
+
/** The project's build directory, may be {@code null} rendered from a Doxia source) */
63
+
privatefinalFilerootDirectory;
64
+
65
+
/** The site's root directory (never null), must be within below {@link #rootDirectory}, may be {@code null} rendered from a Doxia source */
66
+
privatefinalFilesiteRootDirectory;
67
+
68
+
/** optional descriptive text of the plugin which generated the output (usually Maven coordinates). Only set when document is not based on a Doxia source. */
* @param basedir the source base directory (not null, pseudo value when not a Doxia source).
185
+
* @param basedirRelativePath the relative path from root (null if not Doxia source)
186
+
* @param document the source document path.
187
+
* @param parserId the Doxia module parser id associated to this document, may be null if document not rendered from
188
+
* a Doxia source.
189
+
* @param extension the source document filename extension, may be null if document not rendered from
190
+
* a Doxia source.
191
+
* @param rootDirectory the absolute project's root directory (not null), usually {@code project.basedir}, must be an ancestor of {@code siteRootDirectory}
192
+
* @param siteRootDirectory the absolute site's root directory (not null), must start with {@code rootDirectory}, often ends with {@code /src/site}
193
+
* @param sourceDirectories the absolute paths of directories which may contain the original editable source.
194
+
* @param editable is the document editable as source, i.e. not generated?
195
+
* @param generator the generator (in general a reporting goal: <code>groupId:artifactId:version:goal</code>)
196
+
* @since 2.1
197
+
*/
198
+
@SuppressWarnings("checkstyle:parameternumber")
199
+
publicDocumentRenderingContext(
200
+
Filebasedir,
201
+
Stringdocument,
202
+
StringparserId,
203
+
Stringextension,
204
+
FilerootDirectory,
205
+
FilesiteRootDirectory,
206
+
Collection<File> sourceDirectories,
207
+
Stringgenerator) {
104
208
this.basedir = basedir;
105
209
this.parserId = parserId;
106
210
this.extension = extension;
@@ -110,10 +214,23 @@ public DocumentRenderingContext(
110
214
document = document.replace('\\', '/');
111
215
this.inputPath = document;
112
216
217
+
if (rootDirectory == null) {
218
+
if (siteRootDirectory != null) {
219
+
thrownewIllegalArgumentException("Root directory must not be null when site root directory is set");
220
+
}
221
+
} else {
222
+
Objects.requireNonNull(
223
+
siteRootDirectory, "Site root directory must not be null when root directory is set");
224
+
if (!siteRootDirectory.getPath().startsWith(rootDirectory.getPath())) {
0 commit comments