Skip to content

Commit

Permalink
[HTML] Add download button (#235)
Browse files Browse the repository at this point in the history
This adds a download button to the HTML version of the book, which enables
downloading the html, pdf and epub version of the book.
  • Loading branch information
kbeyls authored Apr 27, 2024
1 parent 5d80fb9 commit 67d2e1e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ COMMONFILTERS = \
--citeproc

.PHONY: all clean pdf html
all: pdf html default_pandoc_html_template default_pandoc_latex_template native epub
all: pdf html default_pandoc_html_template default_pandoc_latex_template native epub \
downloads
pdf: build/book.pdf
html: build/book.html build/default.css build/index.html
native: build/book.native
epub: build/book.epub
downloads: build/LLSoftSecBook.pdf build/LLSoftSecBook.html build/LLSoftSecBook.epub

# The source of images are in SVG format.
# The below lines define to convert the SVG source images to PDF images such
Expand Down Expand Up @@ -69,6 +71,15 @@ build/book.epub: book.md book.bib Makefile build
build/index.html: build/book.html build
cp build/book.html build/index.html

build/LLSoftSecBook.pdf: build/book.pdf build
cp build/book.pdf build/LLSoftSecBook.pdf

build/LLSoftSecBook.html: build/book.html build
cp build/book.html build/LLSoftSecBook.html

build/LLSoftSecBook.epub: build/book.epub build
cp build/book.epub build/LLSoftSecBook.epub

build/book.tex: book.md book.bib Makefile build theme/tex/pandoc_template.tex \
theme/html/markup_issue.lua \
theme/html/markup_todo.lua \
Expand Down
14 changes: 14 additions & 0 deletions theme/html/pandoc_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@
data-bs-placement="bottom">
<span class="navbar-toggler-icon"></span>
</a>
<span class="dropdown" id="download-dropdown">
<button
class="btn btn-outline-primary btn-sm dropdown-toggle"
id="download-button"
type="button" id="downloadDropdownMenuButton"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
>
<i class="bi bi-download"></i></button>
<div class="dropdown-menu" aria-labelledby="downloadDropdownMenuButton">
<a id="html-download-link" class="dropdown-item" href="LLSoftSecBook.html" target="_blank">HTML</a>
<a id="pdf-download-link" class="dropdown-item" href="LLSoftSecBook.pdf" target="_blank">PDF</a>
<a id="epub-download-link" class="dropdown-item" href="LLSoftSecBook.epub" target="_blank">EPub</a>
</div>
</span>
<a id="view-source-button"
class="btn btn-sm btn-outline-primary" role="button"
data-bs-placement="bottom"
Expand Down

0 comments on commit 67d2e1e

Please sign in to comment.