use crate::tests::prelude::*;
track_file!("ref/asciidoc-lang/docs/modules/sections/pages/glossary.adoc");
non_normative!(
r#"
= Glossary
"#
);
#[test]
fn intro() {
verifies!(
r#"
You can include a glossary in an article, book, and book part by setting the `glossary` style on a section.
"#
);
let doc = Parser::default().parse("[glossary]\n== Terminology\n");
let section = doc.nested_blocks().next().unwrap();
assert_eq!(section.declared_style(), Some("glossary"));
}
#[test]
fn glossary_section_syntax() {
verifies!(
r#"
== Glossary section syntax
"#
);
let doc = Parser::default().parse("[glossary]\n== Terminology\n");
let section = doc.nested_blocks().next().unwrap();
assert_eq!(section.declared_style(), Some("glossary"));
assert_eq!(section.raw_context().as_ref(), "section");
non_normative!(
r#"
The glossary section is defined as a level 1 section (`==`) when:
* the doctype is `article`
* the doctype is `book` and the book doesn't contain any parts
* the glossary is for a book part
"#
);
verifies!(
r#"
[source]
----
[glossary]
== Terminology
----
"#
);
let doc = Parser::default().parse("[glossary]\n== Terminology\n");
let section = doc.nested_blocks().next().unwrap();
assert_eq!(section.declared_style(), Some("glossary"));
assert_eq!(section.raw_context().as_ref(), "section");
non_normative!(
r#"
If the book has parts, and the glossary is for the whole book, the section is defined as a level 0 section (`=`).
[source]
----
[glossary]
= Glossary
----
"#
);
}
#[test]
fn glossary_description_list_style_syntax() {
verifies!(
r#"
== Glossary description list style syntax
In addition to setting `glossary` on the section, the block style `glossary` must be set on the description list in the section.
"#
);
verifies!(
r#"
[source]
----
[glossary]
== Glossary
[glossary]
mud:: wet, cold dirt
rain::
water falling from the sky
----
"#
);
let doc = Parser::default().parse(
"[glossary]\n== Glossary\n\n[glossary]\nmud:: wet, cold dirt\nrain::\n\twater falling from the sky\n",
);
let section = doc.nested_blocks().next().unwrap();
assert_eq!(section.declared_style(), Some("glossary"));
let dlist = section.nested_blocks().next().unwrap();
assert_eq!(dlist.declared_style(), Some("glossary"));
assert_css(&doc, ".dlist.glossary", 1);
assert_css(&doc, ".dlist dt:not([class])", 2);
}