summaryrefslogtreecommitdiff
path: root/tests/typ/meta
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-29 13:37:25 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-29 14:18:13 +0100
commit0efe669278a5e1c3f2985eba2f3360e91159c54a (patch)
tree502712857c48f0decb5e698257c0a96d358a436e /tests/typ/meta
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/meta')
-rw-r--r--tests/typ/meta/document.typ30
-rw-r--r--tests/typ/meta/link.typ46
2 files changed, 76 insertions, 0 deletions
diff --git a/tests/typ/meta/document.typ b/tests/typ/meta/document.typ
new file mode 100644
index 00000000..1fcb8109
--- /dev/null
+++ b/tests/typ/meta/document.typ
@@ -0,0 +1,30 @@
+// Test document and page-level styles.
+
+---
+// This is okay.
+// Ref: false
+#set document(title: "Hello")
+
+---
+Hello
+
+// Error: 1-30 must appear before any content
+#set document(title: "Hello")
+
+---
+#box[
+ // Error: 3-32 not allowed here
+ #set document(title: "Hello")
+]
+
+---
+#box[
+ // Error: 3-18 not allowed here
+ #set page("a4")
+]
+
+---
+#box[
+ // Error: 3-15 not allowed here
+ #pagebreak()
+]
diff --git a/tests/typ/meta/link.typ b/tests/typ/meta/link.typ
new file mode 100644
index 00000000..8c3e6ddd
--- /dev/null
+++ b/tests/typ/meta/link.typ
@@ -0,0 +1,46 @@
+// Test hyperlinking.
+
+---
+// Link syntax.
+https://example.com/
+
+// Link with body.
+#link("https://typst.org/")[Some text text text]
+
+// With line break.
+This link appears #link("https://google.com/")[in the middle of] a paragraph.
+
+// Certain prefixes are trimmed when using the `link` function.
+Contact #link("mailto:hi@typst.app") or
+call #link("tel:123") for more information.
+
+---
+// Test that the period is trimmed.
+#show link: underline
+https://a.b.?q=%10#. \
+Wahttp://link \
+Nohttps:\//link \
+Nohttp\://comment
+
+---
+// Styled with underline and color.
+#show link: it => underline(text(fill: rgb("283663"), it))
+You could also make the
+#link("https://html5zombo.com/")[link look way more typical.]
+
+---
+// Transformed link.
+#set page(height: 60pt)
+#let mylink = link("https://typst.org/")[LINK]
+My cool #move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink)))
+
+---
+// Link containing a block.
+#link("https://example.com/", block[
+ My cool rhino
+ #move(dx: 10pt, image("/res/rhino.png", width: 1cm))
+])
+
+---
+// Link to page one.
+#link((page: 1, x: 10pt, y: 20pt))[Back to the start]