summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-20 21:36:24 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-20 21:36:24 +0200
commit1321862cd54eb4abefb5d435285e3de9e0848c4c (patch)
tree904d04546da0a17dbf0fe96790c0a9c2f6393141 /tests
parent35b883cfd9e6acfcaee1a98bf2bdd4f6c5de5fbf (diff)
Footnotes
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/meta/cite-footnote.pngbin0 -> 58253 bytes
-rw-r--r--tests/ref/meta/footnote-break.pngbin0 -> 90355 bytes
-rw-r--r--tests/ref/meta/footnote-container.pngbin0 -> 45934 bytes
-rw-r--r--tests/ref/meta/footnote-invariant.pngbin0 -> 28671 bytes
-rw-r--r--tests/ref/meta/footnote.pngbin0 -> 18782 bytes
-rw-r--r--tests/typ/meta/cite-footnote.typ5
-rw-r--r--tests/typ/meta/footnote-break.typ16
-rw-r--r--tests/typ/meta/footnote-container.typ32
-rw-r--r--tests/typ/meta/footnote-invariant.typ9
-rw-r--r--tests/typ/meta/footnote.typ34
10 files changed, 96 insertions, 0 deletions
diff --git a/tests/ref/meta/cite-footnote.png b/tests/ref/meta/cite-footnote.png
new file mode 100644
index 00000000..067d2c2e
--- /dev/null
+++ b/tests/ref/meta/cite-footnote.png
Binary files differ
diff --git a/tests/ref/meta/footnote-break.png b/tests/ref/meta/footnote-break.png
new file mode 100644
index 00000000..625305c8
--- /dev/null
+++ b/tests/ref/meta/footnote-break.png
Binary files differ
diff --git a/tests/ref/meta/footnote-container.png b/tests/ref/meta/footnote-container.png
new file mode 100644
index 00000000..9327e7ee
--- /dev/null
+++ b/tests/ref/meta/footnote-container.png
Binary files differ
diff --git a/tests/ref/meta/footnote-invariant.png b/tests/ref/meta/footnote-invariant.png
new file mode 100644
index 00000000..66b41182
--- /dev/null
+++ b/tests/ref/meta/footnote-invariant.png
Binary files differ
diff --git a/tests/ref/meta/footnote.png b/tests/ref/meta/footnote.png
new file mode 100644
index 00000000..4c67bbd7
--- /dev/null
+++ b/tests/ref/meta/footnote.png
Binary files differ
diff --git a/tests/typ/meta/cite-footnote.typ b/tests/typ/meta/cite-footnote.typ
new file mode 100644
index 00000000..03984752
--- /dev/null
+++ b/tests/typ/meta/cite-footnote.typ
@@ -0,0 +1,5 @@
+Hello @netwok
+And again: @netwok
+
+#pagebreak()
+#bibliography("/works.bib", style: "chicago-notes")
diff --git a/tests/typ/meta/footnote-break.typ b/tests/typ/meta/footnote-break.typ
new file mode 100644
index 00000000..9e213aeb
--- /dev/null
+++ b/tests/typ/meta/footnote-break.typ
@@ -0,0 +1,16 @@
+// Test footnotes that break across pages.
+
+---
+#set page(height: 200pt)
+
+#lorem(5)
+#footnote[ // 1
+ A simple footnote.
+ #footnote[Well, not that simple ...] // 2
+]
+#lorem(15)
+#footnote[Another footnote: #lorem(30)] // 3
+#lorem(15)
+#footnote[My fourth footnote: #lorem(50)] // 4
+#lorem(15)
+#footnote[And a final footnote.] // 5
diff --git a/tests/typ/meta/footnote-container.typ b/tests/typ/meta/footnote-container.typ
new file mode 100644
index 00000000..fa246162
--- /dev/null
+++ b/tests/typ/meta/footnote-container.typ
@@ -0,0 +1,32 @@
+// Test footnotes in containers.
+
+---
+// Test footnote in caption.
+Read the docs #footnote[https://typst.app/docs]!
+#figure(
+ image("/graph.png", width: 70%),
+ caption: [
+ A graph #footnote[A _graph_ is a structure with nodes and edges.]
+ ]
+)
+More #footnote[just for ...] footnotes #footnote[... testing. :)]
+
+---
+// Test duplicate footnotes.
+#let lang = footnote[Languages.]
+#let nums = footnote[Numbers.]
+
+/ "Hello": A word #lang
+/ "123": A number #nums
+
+- "Hello" #lang
+- "123" #nums
+
++ "Hello" #lang
++ "123" #nums
+
+#table(
+ columns: 2,
+ [Hello], [A word #lang],
+ [123], [A number #nums],
+)
diff --git a/tests/typ/meta/footnote-invariant.typ b/tests/typ/meta/footnote-invariant.typ
new file mode 100644
index 00000000..e4d6ded1
--- /dev/null
+++ b/tests/typ/meta/footnote-invariant.typ
@@ -0,0 +1,9 @@
+// Ensure that a footnote and the first line of its entry
+// always end up on the same page.
+
+---
+#set page(height: 120pt)
+
+#lorem(13)
+
+There #footnote(lorem(20))
diff --git a/tests/typ/meta/footnote.typ b/tests/typ/meta/footnote.typ
new file mode 100644
index 00000000..8f56fea2
--- /dev/null
+++ b/tests/typ/meta/footnote.typ
@@ -0,0 +1,34 @@
+// Test footnotes.
+
+---
+#footnote[Hi]
+
+---
+// Test space collapsing before footnote.
+A#footnote[A] \
+A #footnote[A]
+
+---
+// Test nested footnotes.
+First \
+Second #footnote[A, #footnote[B, #footnote[C]]] \
+Third #footnote[D, #footnote[E]] \
+Fourth
+
+---
+// Currently, numbers a bit out of order if a nested footnote ends up in the
+// same frame as another one. :(
+#footnote[A, #footnote[B]], #footnote[C]
+
+---
+// Test customization.
+#show footnote: set text(red)
+#show footnote.entry: set text(8pt, style: "italic")
+#set footnote.entry(
+ indent: 0pt,
+ gap: 0.6em,
+ clearance: 0.3em,
+ separator: repeat[.],
+)
+
+Beautiful footnotes. #footnote[Wonderful, aren't they?]