Skip to content

Allow to set an alternative source directory (for editing)#625

Merged
kwin merged 2 commits intomasterfrom
feature/overwrite-source-directory
Mar 28, 2026
Merged

Allow to set an alternative source directory (for editing)#625
kwin merged 2 commits intomasterfrom
feature/overwrite-source-directory

Conversation

@kwin
Copy link
Copy Markdown
Member

@kwin kwin commented Mar 11, 2026

Always check if a file is existing before returning true for isEditable and non-null for getDoxiaSourcePath()/getDoxiaSourcePath(String)

This closes #277

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@kwin
Copy link
Copy Markdown
Member Author

kwin commented Mar 11, 2026

Usage in m-site-p in apache/maven-site-plugin#1239.

@kwin kwin force-pushed the feature/overwrite-source-directory branch 3 times, most recently from 43adea5 to 3a6151e Compare March 16, 2026 16:51
@michael-o
Copy link
Copy Markdown
Member

This is quite some change. Will take a bit to review.

Always check if a file is existing before returning true for isEditable
and non-null for getDoxiaSourcePath()/getDoxiaSourcePath(String)

This closes #277
@kwin kwin force-pushed the feature/overwrite-source-directory branch from 3a6151e to b4e6c73 Compare March 16, 2026 17:08
assertEquals("path/file.html", docRenderingContext.getOutputPath());
assertEquals("..", docRenderingContext.getRelativePath());
}
}
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.

This should have been a "git mv" instead of deletion and addtion, no?

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.

*
* @param path
* @param editable
* @param path absolute path to the site directory containing doxia sources files, expected to have a Doxia Site layout, i.e. one directory per Doxia parser module
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.

Doxia source files

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.

Fixed in 1efd3e8.

*
* @param path
* @param editable
* @param path absolute path to the site directory containing doxia sources files, expected to have a Doxia Site layout, i.e. one directory per Doxia parser module
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.

You say absolute path, but we don't enforce it...?

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.

Yes, removed "absolute" in 1efd3e8.

if (editableSourceDirectories.isEmpty()) {
return Collections.singleton(path);
} else {
return editableSourceDirectories;
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.

This should return only a view, no?

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.

Yes, fixed in 1efd3e8.

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.

/** The project's build directory, may be {@code null} rendered from a Doxia source) */
private final File rootDirectory;

/** The site's root directory (never null), must be within below {@link #rootDirectory}, may be {@code null} rendered from a Doxia source */
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.

Contradiction. It first says never null, then it maybe null

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.

Right, may in fact be null. Fixed in 1efd3e8.


/**
* Get the relative path to site root.
* Get the relative path of the parent folder to site root.
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.

parent 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.

Fixed in 1efd3e8.

@kwin kwin requested a review from michael-o March 27, 2026 17:11
Copy link
Copy Markdown
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

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

No objections...

@kwin kwin force-pushed the feature/overwrite-source-directory branch from 1efd3e8 to 66067af Compare March 28, 2026 09:21
@kwin kwin merged commit 081a0e8 into master Mar 28, 2026
15 checks passed
@kwin kwin deleted the feature/overwrite-source-directory branch March 28, 2026 09:25
@github-actions
Copy link
Copy Markdown

@kwin Please assign appropriate label to PR according to the type of change.

@github-actions github-actions bot added this to the 2.1.0 milestone Mar 28, 2026
@kwin kwin added the enhancement New feature or request label Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOXIASITETOOLS-328] Allow to overwrite the edit source link with an alternative folder

2 participants