diff --git a/src/odr/html.hpp b/src/odr/html.hpp index 2e8088b4..ebe5e4a0 100644 --- a/src/odr/html.hpp +++ b/src/odr/html.hpp @@ -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; diff --git a/src/odr/http_server.cpp b/src/odr/http_server.cpp index 60d0ceef..b8e53d6f 100644 --- a/src/odr/http_server.cpp +++ b/src/odr/http_server.cpp @@ -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); diff --git a/src/odr/internal/html/common.cpp b/src/odr/internal/html/common.cpp index bddc1946..fff4e1c6 100644 --- a/src/odr/internal/html/common.cpp +++ b/src/odr/internal/html/common.cpp @@ -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; } diff --git a/test/src/html_output_test.cpp b/test/src/html_output_test.cpp index 61315d37..06284345 100644 --- a/test/src/html_output_test.cpp +++ b/test/src/html_output_test.cpp @@ -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;