diff --git a/bookish/services/converter.py b/bookish/services/converter.py index 50bbc62..b9e30ae 100644 --- a/bookish/services/converter.py +++ b/bookish/services/converter.py @@ -86,8 +86,6 @@ def _convert_with_pandoc(input_path, output_path, input_format, output_format, t extra_args += ["--metadata", "title=Converted Document"] if output_format == "html": extra_args += ["--self-contained", "--mathjax"] - if input_format == "pdf": - extra_args += ["--pdf-engine=pdflatex"] pandoc_input = _to_pandoc_format(input_format) pandoc_output = _to_pandoc_format(output_format) @@ -152,19 +150,4 @@ def _convert_docx_to_pdf(input_path, output_path, task_id): def _post_process(output_path, output_format): """Post-processing opzionale sul file generato.""" - if output_format == "epub": - _fix_epub_metadata(output_path) - - -def _fix_epub_metadata(epub_path): - """Aggiunge metadati minimi all'epub se mancanti.""" - try: - import zipfile - import tempfile - - with zipfile.ZipFile(epub_path, "r") as z: - content = z.read("META-INF/container.xml") - if b"" not in content: - pass - except Exception: - pass + pass diff --git a/bookish/static/js/reader.js b/bookish/static/js/reader.js index e05ae9b..c7c4341 100644 --- a/bookish/static/js/reader.js +++ b/bookish/static/js/reader.js @@ -56,9 +56,9 @@ if (e.key === "-") changeFontSize(rendition, -2); }); - // Toolbar controls - document.getElementById("zoomIn").addEventListener("click", () => rendition.next()); - document.getElementById("zoomOut").addEventListener("click", () => rendition.prev()); + // Zoom controls + document.getElementById("zoomIn").addEventListener("click", () => changeFontSize(rendition, 2)); + document.getElementById("zoomOut").addEventListener("click", () => changeFontSize(rendition, -2)); // Store ref for theme window._rendition = rendition; @@ -151,29 +151,16 @@ const viewer = document.getElementById("textViewer"); if (!viewer) return; - // Convert text via Pandoc on backend fetch(`/reader/serve/${encodeURIComponent(file)}`) .then((r) => r.text()) - .then((content) => { - if (ext === "md" || ext === "fb2" || ext === "docx") { - // Pandoc converts these to HTML on load for reader - // But we need the HTML version. Try to get pre-converted HTML. - fetch(`/reader/serve/${encodeURIComponent(file)}`) - .then((r) => r.text()) - .then((text) => { - // For plain text (md, txt), render as HTML with simple formatting - if (ext === "md") { - viewer.innerHTML = simpleMarkdownToHtml(text); - } else { - viewer.innerHTML = `
${escapeHtml(text)}
`; - } - }); + .then((text) => { + if (ext === "md") { + viewer.innerHTML = simpleMarkdownToHtml(text); } else if (ext === "html") { - // Direct HTML content - viewer.innerHTML = content; + viewer.innerHTML = text; fixLinks(viewer); } else { - viewer.textContent = content; + viewer.innerHTML = `
${escapeHtml(text)}
`; } });