asciidoc-parser 0.19.0

Parser for AsciiDoc format
Documentation
use crate::tests::prelude::*;

track_file!("ref/asciidoc-lang/docs/modules/document/pages/author-information.adoc");

non_normative!(
    r#"
= Author Information

Adding author information to your document is optional.
A document's author information is assigned to multiple built-in attributes.
These optional attributes can be set and assigned values xref:author-line.adoc[using the author line] or xref:author-attribute-entries.adoc[using attribute entries] in a document's header.

"#
);

// See tests in parser/src/tests/document/author_line.rs named
// `sets_author_attributes_*` which cover these behaviors.

verifies!(
    r#"
== Author and email attributes

author::
The `author` attribute represents the author's full name.
The attributes `firstname`, `middlename`, `lastname`, and `authorinitials` are automatically derived from the value of the `author` attribute.
When assigned implicitly via the author line, the value includes all of the characters and words prior to the semicolon (`;`), angle bracket (`<`), or the end of the line.
Note that when using the implicit author line, the full name can have a maximum of three space-separated names.
If it has more, then the full name is assigned to the `firstname` attribute.
You can adjoin names using an underscore (`_`) character.

email::
The `email` attribute represents an email address or URL associated with the first author (`author`).
When assigned via the author line, it's enclosed in a pair of angle brackets (`< >`).
A URL can be used in place of the email address.

=== Name and initials attributes

firstname::
The `firstname` attribute represents the first, forename, or given name of the author.
The first space-separated name in the value of the `author` attribute is automatically assigned to `firstname`.

lastname::
The `lastname` attribute represents the last, surname, or family name of the author.
If `author` contains more than one space-separated name, the third name and any names after that are assigned to the `lastname` attribute.

middlename::
The `lastname` attribute represents the middle name or initial of the author.
If `author` contains more than two space-separated names, the second name is assigned to the `middlename` attribute.

authorinitials::
The first character of the `firstname`, `middlename`, and `lastname` attribute values are assigned to the `authorinitials` attribute.
The value of the `authorinitials` attribute will consist of three characters or less depending on how many parts are in the author's name.

== Multiple author attributes

author_<n>:: An `author_<n>` attribute represents each additional author's full name, where `<n>` is the 1-based index of all of the authors listed on the author line (e.g., `author_2`, `author_3`).
The attributes `firstname_<n>`, `middlename_<n>`, `lastname_<n>`, and `authorinitials_<n>` are automatically derived from `author_<n>`.
xref:multiple-authors.adoc[Additional authors can only be assigned via the author line].
Each author's full name includes all of the characters and words directly after a semicolon (`;`) but prior to the angle bracket (`<`), next semicolon (`;`), or the end of the line.
The full name can have a maximum of three space-separated names.
If it has more, then the full name is assigned to the `firstname_<n>` attribute.
You can adjoin names using an underscore (`_`) character.

email_<n>::
The `email_<n>` attribute represents an email address associated with xref:multiple-authors.adoc[each additional author] (`author_<n>`).
It's enclosed in a pair of angle brackets (`< >`) on the author line.
A URL can be used in place of the email address.

firstname_<n>::
The first space-separated name in the value of the `author_<n>` attribute is automatically assigned to `firstname_<n>`.

lastname_<n>::
If `author_<n>` contains more than one space-separated name, the third name and any names after that are assigned to the `lastname_<n>` attribute.

middlename_<n>::
If `author_<n>` contains more than two space-separated names, the second name is assigned to the `middlename_<n>` attribute.

authorinitials_<n>::
The first character of the `firstname_<n>`, `middlename_<n>`, and `lastname_<n>` attribute values.
The value of the `authorinitials_<n>` attribute will consist of three characters or less depending on how many parts are in the author's name.
"#
);