Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,11 @@ public Map<String, DocumentRenderer> locateDocumentFiles(SiteRenderingContext si

addModuleFiles(
siteRenderingContext.getRootDirectory(),
siteDirectory,
moduleBasedir,
module,
excludes,
files,
siteDirectory.isEditable(),
siteDirectory.isSkipDuplicates());
files);
}
}
}
Expand All @@ -228,32 +227,27 @@ private List<String> filterExtensionIgnoreCase(List<String> fileNames, String ex
* 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,
* taking care of duplicates if needed.
*
* @param rootDir
* @param siteRootDirectory
* @param siteDirectory
* @param moduleBasedir
* @param module
* @param excludes
* @param files
* @param editable
* @param skipDuplicates
* @throws IOException
* @throws RendererException
*/
private void addModuleFiles(
File rootDir,
File siteRootDirectory,
SiteDirectory siteDirectory,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a site root directory, why is path the absolute for site directory?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this question, but siteRootDirectory is pointing to the ${basedir} while siteDirectory is usually ${basedir}/src/site.

File moduleBasedir,
ParserModule module,
String excludes,
Map<String, DocumentRenderer> files,
boolean editable,
boolean skipDuplicates)
Map<String, DocumentRenderer> files)
throws IOException, RendererException {
if (!moduleBasedir.exists() || ArrayUtils.isEmpty(module.getExtensions())) {
return;
}

String moduleRelativePath =
PathTool.getRelativeFilePath(rootDir.getAbsolutePath(), moduleBasedir.getAbsolutePath());

List<String> allFiles = FileUtils.getFileNames(moduleBasedir, "**/*", excludes, false);

for (String extension : module.getExtensions()) {
Expand All @@ -268,14 +262,20 @@ private void addModuleFiles(

for (String doc : docs) {
DocumentRenderingContext docRenderingContext = new DocumentRenderingContext(
moduleBasedir, moduleRelativePath, doc, module.getParserId(), extension, editable);
moduleBasedir,
doc,
module.getParserId(),
extension,
siteRootDirectory,
siteDirectory.getPath(),
siteDirectory.getEditableSourceDirectories());

// TODO: DOXIA-111: we need a general filter here that knows how to alter the context
if (endsWithIgnoreCase(doc, ".vm")) {
docRenderingContext.setAttribute("velocity", "true");
}

if (!checkForDuplicate(docRenderingContext, files, skipDuplicates)) {
if (!checkForDuplicate(docRenderingContext, files, siteDirectory.isSkipDuplicates())) {
String key = docRenderingContext.getOutputName();
files.put(key, new DoxiaDocumentRenderer(docRenderingContext));
}
Expand Down
Loading