summaryrefslogtreecommitdiff
path: root/library/src/meta/mod.rs
blob: 0cbbafffb4e6a3317184a07800da275e2fcada8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Interaction between document parts.

mod bibliography;
mod context;
mod counter;
mod document;
mod figure;
mod footnote;
mod heading;
mod link;
mod numbering;
mod outline;
mod query;
mod reference;
mod state;

pub use self::bibliography::*;
pub use self::context::*;
pub use self::counter::*;
pub use self::document::*;
pub use self::figure::*;
pub use self::footnote::*;
pub use self::heading::*;
pub use self::link::*;
pub use self::numbering::*;
pub use self::outline::*;
pub use self::query::*;
pub use self::reference::*;
pub use self::state::*;

use crate::prelude::*;

/// Hook up all meta definitions.
pub(super) fn define(global: &mut Scope) {
    global.define("document", DocumentElem::func());
    global.define("ref", RefElem::func());
    global.define("link", LinkElem::func());
    global.define("outline", OutlineElem::func());
    global.define("heading", HeadingElem::func());
    global.define("figure", FigureElem::func());
    global.define("footnote", FootnoteElem::func());
    global.define("cite", CiteElem::func());
    global.define("bibliography", BibliographyElem::func());
    global.define("locate", locate);
    global.define("style", style);
    global.define("layout", layout);
    global.define("counter", counter);
    global.define("numbering", numbering);
    global.define("state", state);
    global.define("query", query);
    global.define("selector", selector);
}

/// The named with which an element is referenced.
pub trait LocalName {
    /// Get the name in the given language and (optionally) region.
    fn local_name(&self, lang: Lang, region: Option<Region>) -> &'static str;
}