Skip to content

Commit

Permalink
fixup! Introduce addClone to creator.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Nov 3, 2023
1 parent 830fc7f commit 76cdca2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions include/zim/writer/creator.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,26 @@ namespace zim


/**
* Add a clone of a existing entry.
*
* The existing entry pointed by `targetPath` is cloned and updated with
* `path` and `title`.
*
* The clone entry will shared the same type (redirection or item)
* and namespace than `targetPath`.
*
* If the `targetPath` is a item, the new entry will be item pointing
* to the same data than `targetPath` item. (Not a redirection to `targetPath`).
* However, the cloned entry is not counted in the media type counter
* and it is not fulltext indexed (only title indexed).
*
* Hints can be given to influence creator handling (front article, ...)
* as it is done for redirection.
*
* @param path the path of the clone
* @param title the title of the clone
* @param targetPath the path of the cloned entry.
* @param hints hints associated to the clone.
*/
void addClone(
const std::string& path,
Expand Down
2 changes: 1 addition & 1 deletion src/writer/_dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace zim
// Creator for a "redirection" dirent
Dirent(NS ns, const std::string& path, const std::string& title, NS targetNs, const std::string& targetPath);

// Creator for a "clone" dirent
// Creator for a "clone" dirent. Reuse the namespace of the targeted Dirent.
Dirent(const std::string& path, const std::string& title, const Dirent& target);

// Creator for "temporary" dirent, used to search for dirent in container.
Expand Down
2 changes: 1 addition & 1 deletion src/writer/creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ namespace zim

if (existing_dirent_it == data->dirents.end()) {
std::ostringstream ss;
ss << "Impossible to clone C/" << targetPath << " to " << path << std::endl;
ss << "Impossible to clone C/" << targetPath << " to C/" << path << std::endl;
ss << "C/" << targetPath << " doesn't exist." << std::endl;
throw InvalidEntry(ss.str());
}
Expand Down

0 comments on commit 76cdca2

Please sign in to comment.