summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/files/works.bib11
-rw-r--r--crates/typst/src/model/cite.rs9
-rw-r--r--tests/ref/meta/bibliography-full.pngbin149965 -> 148897 bytes
-rw-r--r--tests/typ/meta/bibliography-full.typ2
-rw-r--r--tests/typ/meta/bibliography.typ2
5 files changed, 22 insertions, 2 deletions
diff --git a/assets/files/works.bib b/assets/files/works.bib
index 391661ca..d3bd14cd 100644
--- a/assets/files/works.bib
+++ b/assets/files/works.bib
@@ -52,6 +52,17 @@
volume = {1},
}
+@book{DBLP:books/lib/Knuth86a,
+ author = {Donald Ervin Knuth},
+ title = {Computer modern typefaces},
+ publisher = {Addison-Wesley},
+ year = {1986},
+ url = {https://www.worldcat.org/oclc/13157596},
+ isbn = {0201134462},
+ timestamp = {Fri, 17 Jul 2020 16:12:40 +0200},
+ biburl = {https://dblp.org/rec/books/lib/Knuth86a.bib},
+ bibsource = {dblp computer science bibliography, https://dblp.org}
+}
@article{sharing,
title = {Do sharing people behave differently? An empirical evaluation of the distinctive mobility patterns of free-floating car-sharing members},
diff --git a/crates/typst/src/model/cite.rs b/crates/typst/src/model/cite.rs
index 0e38b1bd..e61056e8 100644
--- a/crates/typst/src/model/cite.rs
+++ b/crates/typst/src/model/cite.rs
@@ -27,6 +27,15 @@ use crate::text::{Lang, Region, TextElem};
/// #bibliography("works.bib")
/// ```
///
+/// If your source name contains certain characters such as slashes, which are
+/// not recognized by the `<>` syntax, you can explicitly call `label` instead.
+///
+/// ```typ
+/// Computer Modern is an example of a modernist serif typeface.
+/// #cite(label("DBLP:books/lib/Knuth86a")).
+/// >>> #bibliography("works.bib")
+/// ```
+///
/// # Syntax
/// This function indirectly has dedicated syntax. [References]($ref) can be
/// used to cite works from the bibliography. The label then corresponds to the
diff --git a/tests/ref/meta/bibliography-full.png b/tests/ref/meta/bibliography-full.png
index 2ccccf54..4d324152 100644
--- a/tests/ref/meta/bibliography-full.png
+++ b/tests/ref/meta/bibliography-full.png
Binary files differ
diff --git a/tests/typ/meta/bibliography-full.typ b/tests/typ/meta/bibliography-full.typ
index f67909b4..cebe7e0d 100644
--- a/tests/typ/meta/bibliography-full.typ
+++ b/tests/typ/meta/bibliography-full.typ
@@ -1,5 +1,5 @@
// Test the full bibliography.
---
-#set page(paper: "a6", height: 160mm)
+#set page(paper: "a6", height: 170mm)
#bibliography("/files/works.bib", full: true)
diff --git a/tests/typ/meta/bibliography.typ b/tests/typ/meta/bibliography.typ
index ec90a96a..0ce4b7f7 100644
--- a/tests/typ/meta/bibliography.typ
+++ b/tests/typ/meta/bibliography.typ
@@ -40,5 +40,5 @@ Now we have multiple bibliographies containing @glacier-melt @keshav2007read
#bibliography("/files/works.bib")
---
-// Error: 15-55 duplicate bibliography keys: netwok, issue201, arrgh, quark, distress, glacier-melt, tolkien54, sharing, restful, mcintosh_anxiety, psychology25
+// Error: 15-55 duplicate bibliography keys: netwok, issue201, arrgh, quark, distress, glacier-melt, tolkien54, DBLP:books/lib/Knuth86a, sharing, restful, mcintosh_anxiety, psychology25
#bibliography(("/files/works.bib", "/files/works.bib"))