Semantic paragraph tests

This commit is contained in:
Laurenz 2025-01-23 17:59:38 +01:00
parent e36266c0a0
commit 3a5ee3e730
9 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h2>Heading is no paragraph</h2>
<p>I'm a paragraph.</p>
<div>I'm not.</div>
<div>
<p>We are two.</p>
<p>So we are paragraphs.</p>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

BIN
tests/ref/par-semantic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
tests/ref/par-show.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

View File

@ -19,6 +19,105 @@ heaven Would through the airy region stream so bright That birds would sing and
think it were not night. See, how she leans her cheek upon her hand! O, that I
were a glove upon that hand, That I might touch that cheek!
--- par-semantic ---
#show par: highlight
I'm a paragraph.
#align(center, table(
columns: 3,
// No paragraphs.
[A],
block[B],
block[C *D*],
// Paragraphs.
par[E],
[
F
],
[
G
],
// Paragraphs.
parbreak() + [H],
[I] + parbreak(),
parbreak() + [J] + parbreak(),
// Paragraphs.
[K #v(10pt)],
[#v(10pt) L],
[#place[] M],
// Paragraphs.
[
N
O
],
[#par[P]#par[Q]],
// No paragraphs.
[#block[R]#block[S]],
))
--- par-semantic-html html ---
= Heading is no paragraph
I'm a paragraph.
#html.elem("div")[I'm not.]
#html.elem("div")[
We are two.
So we are paragraphs.
]
--- par-semantic-tag ---
#show par: highlight
#block[
#metadata(none) <hi1>
A
#metadata(none) <hi2>
]
#block(width: 100%, metadata(none) + align(center)[A])
#block(width: 100%, align(center)[A] + metadata(none))
--- par-semantic-align ---
#show par: highlight
#show bibliography: none
#set block(width: 100%, stroke: 1pt, inset: 5pt)
#bibliography("/assets/bib/works.bib")
#block[
#set align(right)
Hello
]
#block[
#set align(right)
Hello
@netwok
]
#block[
Hello
#align(right)[World]
You
]
#block[
Hello
#align(right)[@netwok]
You
]
--- par-leading-and-spacing ---
// Test changing leading and spacing.
#set par(spacing: 1em, leading: 2pt)
@ -69,6 +168,12 @@ Why would anybody ever ...
#set par(hanging-indent: 15pt, justify: true)
#lorem(10)
--- par-hanging-indent-semantic ---
#set par(hanging-indent: 15pt)
= I am not affected
I am affected by hanging indent.
--- par-hanging-indent-manual-linebreak ---
#set par(hanging-indent: 1em)
Welcome \ here. Does this work well?
@ -83,6 +188,22 @@ Welcome \ here. Does this work well?
// Ensure that trailing whitespace layouts as intended.
#box(fill: aqua, " ")
--- par-contains-parbreak ---
#par[
Hello
// Warning: 4-14 parbreak may not occur inside of a paragraph and was ignored
#parbreak()
World
]
--- par-contains-block ---
#par[
Hello
// Warning: 4-11 block may not occur inside of a paragraph and was ignored
#block[]
World
]
--- par-empty-metadata ---
// Check that metadata still works in a zero length paragraph.
#block(height: 0pt)[#""#metadata(false)<hi>]
@ -94,6 +215,26 @@ Welcome \ here. Does this work well?
#set text(hyphenate: false)
Lorem ipsum dolor #metadata(none) nonumy eirmod tempor.
--- par-show ---
// This is only slightly cursed.
#let revoke = metadata("revoke")
#show par: it => {
if bibliography.title == revoke { return it }
set bibliography(title: revoke)
let p = counter("p")
par[#p.step() §#context p.display() #it.body]
}
= A
B
C #parbreak() D
#block[E]
#block[F #parbreak() G]
--- issue-4278-par-trim-before-equation ---
#set par(justify: true)
#lorem(6) aa $a = c + b$