Skip to content

Commit

Permalink
Add changes to page-styling to download EPub from Nav bar
Browse files Browse the repository at this point in the history
- The patch adds an item to the 'More' dropdown
- A modal is also included that is triggered from the dropdown
- The Ebook link assumes the file `RakuDocumentation.epub` is in the root of the website
- The script copying the HTML build to container with the Caddy file needs to be modified to transfer `EBook/RakuDocumentation.epub` to `usr/share/caddy/`
  • Loading branch information
finanalyst committed Apr 28, 2024
1 parent bcdcb6c commit 4f29f8a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Website/plugins/page-styling/config.raku
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:name<page-styling>,
:render<move-images.raku>,
:template-raku<page-styling.raku>,
:version<0.3.1>,
:version<0.3.3>,
:add-css<
css/page-styling-main.css
css/page-styling-dark.css css/page-styling-light.css
Expand Down
30 changes: 29 additions & 1 deletion Website/plugins/page-styling/page-styling.raku
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ use v6.d;
More
</a>
<div class="navbar-dropdown is-right is-rounded">
{ %tml<ebook>.( {}, {} ) }
<hr class="navbar-divider">
<a class="navbar-item" href="/about">
About
Expand All @@ -134,6 +135,7 @@ use v6.d;
</div>
{ %tml<head-search>.( %prm, %tml) }
</div>
{ %tml<ebook-modal>({},{}) }
BLOCK
},
'head-search' => sub (%prm, %tml) {q:to/BLOCK/
Expand Down Expand Up @@ -349,7 +351,33 @@ use v6.d;
</ul>
]
},

'ebook' => sub (%prm, %tml ) {
q[
<hr class="navbar-divider">
<a class="navbar-item js-modal-trigger" data-target="download-ebook">
Download E-Book (epub)
</a>
]
},
'ebook-modal' => sub (%prm, %tml ) {
q[ <div id="download-ebook" class="modal">
<div class="modal-background"></div>
<div class="modal-content">
<div class="box">
<p><a href="/RakuDocumentation.epub" download>RakuDocumentation.epub</a> is a work in
progress e-book. It targets the <a href="https://www.w3.org/publishing/epub3/">EPUB v3 specification</a>.
It needs testing on a variety of ereaders (some of which may still implicitly expect
compliance with EPUB v2). The CSS definitely needs enhancing (especially for code snippets).
The Ebook opens in a Calibre reader, which is available on all operating systems.</p>
<p>Suggestions are welcome and should be addressed by opening an issue on
the Raku/doc-website repository</p>
<p>Exit this popup by pressing &lt;Escape&gt;, or clicking on X or on the background.</p>
</div>
</div>
<button class="modal-close is-large" aria-label="close"></button>
</div>
]
},

'format-b' => sub (%prm, %tml) {
my $beg = '<strong>';
Expand Down

0 comments on commit 4f29f8a

Please sign in to comment.