use crate::{blocks::BreakType, tests::prelude::*};
track_file!("ref/asciidoc-lang/docs/modules/blocks/partials/page-breaks.adoc");
#[test]
fn page_break_syntax() {
verifies!(
r#"
== Page breaks
A line with three less-than characters (i.e., `<<<`), shown in <<ex-page-break>>, is a special macro that serves as a hint to the converter to insert a page break.
Like other block forms, the line must be offset by a preceding paragraph by at least one empty line.
.Page break syntax
[#ex-page-break]
----
<<<
----
A page break is only relevant for page-oriented / printable output formats such as DocBook, PDF, and HTML in print mode.
"#
);
let doc = Parser::default().parse("<<<");
assert_eq!(first_break(&doc).type_(), BreakType::Page);
}
#[test]
fn forced_page_break() {
verifies!(
r#"
If the page break macro falls at the top of an empty page, it will be ignored.
This behavior can be overridden by setting the `always` option on the macro as shown in <<ex-forced-page-break>>.
.Forced page break
[#ex-forced-page-break]
----
[%always]
<<<
----
"#
);
let doc = Parser::default().parse("[%always]\n<<<");
let brk = first_break(&doc);
assert_eq!(brk.type_(), BreakType::Page);
assert!(brk.has_option("always"));
non_normative!(
r#"
Some converters support additional options on the page break macro.
For example, Asciidoctor PDF allows the page layout of the new page to be specified.
.With page layout
[#ex-page-layout]
----
[page-layout=landscape]
<<<
----
If a converter supports columns, the page break can be converted into a column break by the addition of the `column` role.
.Column break
[#ex-column-break]
----
left column
[.column]
<<<
right column
----
When columns are not enabled or supported, the column break is expected to act as a page break.
"#
);
}