Skip to content

Commit

Permalink
fix embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Jan 9, 2025
1 parent 2098725 commit a1badc6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/odr/html.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ struct HtmlConfig {
std::string page_output_file_name{"page{index}.html"};

// embedding
bool embed_resources{true};
bool embed_images{true};
bool embed_shipped_resources{true};

// resources
std::string external_resource_path;
Expand Down
3 changes: 2 additions & 1 deletion src/odr/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class HttpServer::Impl {

// TODO
HtmlConfig config;
config.embed_resources = false;
config.embed_images = false;
config.embed_shipped_resources = false;
std::string output_path = "/tmp/" + id;

std::filesystem::create_directories(output_path);
Expand Down
4 changes: 2 additions & 2 deletions src/odr/internal/html/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ HtmlResourceLocator html::local_resource_locator(const std::string &output_path,
if (!resource.is_relocatable()) {
return resource.path();
}

if (config.embed_resources) {
if ((config.embed_shipped_resources && resource.is_shipped()) ||
(config.embed_images && resource.type() == HtmlResourceType::image)) {
return std::nullopt;
}

Expand Down
3 changes: 2 additions & 1 deletion test/src/html_output_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ TEST_P(HtmlOutputTests, html_meta) {
OpenDocumentReader::copy_resources(resource_path);

HtmlConfig config;
config.embed_resources = false;
config.embed_images = true;
config.embed_shipped_resources = false;
config.external_resource_path = resource_path;
config.relative_resource_paths = true;
config.editable = true;
Expand Down

0 comments on commit a1badc6

Please sign in to comment.