aboutsummaryrefslogtreecommitdiffhomepage
path: root/print.html
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2023-07-21 18:14:59 +0000
committerjohannst <johannst@users.noreply.github.com>2023-07-21 18:14:59 +0000
commitc4435063f699569dd1688966c20748f61d56683c (patch)
tree89c2710f5548b626817f00f6d8799b4ca76944d2 /print.html
parent1b251a08f8c10ff292d1ca9b1c580e88df483b94 (diff)
downloadnotes-c4435063f699569dd1688966c20748f61d56683c.tar.gz
notes-c4435063f699569dd1688966c20748f61d56683c.zip
deploy: a311d67451eb4734684f314f1b56021da86459a0
Diffstat (limited to 'print.html')
-rw-r--r--print.html33
1 files changed, 31 insertions, 2 deletions
diff --git a/print.html b/print.html
index 3af14e1..dbef297 100644
--- a/print.html
+++ b/print.html
@@ -89,11 +89,33 @@
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
+ <!-- Track and set sidebar scroll position -->
+ <script>
+ var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
+ sidebarScrollbox.addEventListener('click', function(e) {
+ if (e.target.tagName === 'A') {
+ sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
+ }
+ }, { passive: true });
+ var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
+ sessionStorage.removeItem('sidebar-scroll');
+ if (sidebarScrollTop) {
+ // preserve sidebar scroll position when navigating via links within sidebar
+ sidebarScrollbox.scrollTop = sidebarScrollTop;
+ } else {
+ // scroll sidebar to current active section when navigating via "next/previous chapter" buttons
+ var activeSection = document.querySelector('#sidebar .active');
+ if (activeSection) {
+ activeSection.scrollIntoView({ block: 'center' });
+ }
+ }
+ </script>
+
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky bordered">
+ <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
@@ -712,7 +734,7 @@ echo $$foo # outputs 1337
# file.h file.cc
echo {a,b}{1,2}
-# a1 b1 b2
+# a1 b1 a2 b2
</code></pre>
<h3 id="special-variables-lists"><a class="header" href="#special-variables-lists">Special Variables (Lists)</a></h3>
<pre><code class="language-text">$status # exit code of last command
@@ -3453,6 +3475,13 @@ VAR=123
out := $(in:.o=.c)
# =&gt; out = a.c l.a c.c
</code></pre>
+<h3 id="patsubst-ref"><a class="header" href="#patsubst-ref"><code>patsubst</code> (<a href="https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#index-patsubst-1">ref</a>)</a></h3>
+<pre><code class="language-make">in := a.c b.c
+out := $(patsubst %.c, build/%.o, $(in))
+# =&gt; out = build/a.o build/b.o
+
+# This is actually equivalent to $(in:%.c=build/%.o)
+</code></pre>
<h3 id="filter"><a class="header" href="#filter"><code>filter</code></a></h3>
<p>Keep strings matching a pattern in a list.</p>
<pre><code class="language-make">in := a.a b.b c.c d.d