Skip to content

Commit 844ad2a

Browse files
committed
removing build folder
1 parent 4e1b353 commit 844ad2a

15 files changed

+161
-43
lines changed

sphinx_proof/nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class unenumerable_node(nodes.Admonition, nodes.Element):
3131

3232
def visit_enumerable_node(self, node: Node) -> None:
3333
if isinstance(self, LaTeXTranslator):
34+
docname = find_parent(self.builder.env, node, "section")
35+
self.body.append("\\label{" + f"{docname}:{node.attributes['label']}" + "}")
3436
self.body.append(latex_admonition_start)
3537
else:
3638
self.body.append(self.starttag(node, "div", CLASS="admonition"))
@@ -53,6 +55,8 @@ def depart_enumerable_node(self, node: Node) -> None:
5355

5456
def visit_unenumerable_node(self, node: Node) -> None:
5557
if isinstance(self, LaTeXTranslator):
58+
docname = find_parent(self.builder.env, node, "section")
59+
self.body.append("\\label{" + f"{docname}:{node.attributes['label']}" + "}")
5660
self.body.append(latex_admonition_start)
5761
else:
5862
self.body.append(self.starttag(node, "div", CLASS="admonition"))

tests/test_build.py

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
import pytest
33

44

5+
@pytest.mark.sphinx("html", testroot="missingref")
6+
def test_missing_ref(app, warnings):
7+
# Clean build
8+
app.build()
9+
assert "WARNING: label 'foo' not found" in warnings(app)
10+
11+
12+
# Tests for algorithms
513
@pytest.mark.sphinx("html", testroot="mybook")
614
@pytest.mark.parametrize(
715
"idir", ["_algo_labeled_titled_with_classname.html", "_algo_nonumber.html"]
@@ -38,3 +46,28 @@ def test_reference(app, idir, file_regression):
3846
def test_duplicate_label(app, warnings):
3947
app.build()
4048
assert "WARNING: duplicate algorithm label" in warnings(app)
49+
50+
51+
# Tests for Proofs
52+
@pytest.mark.sphinx("html", testroot="mybook")
53+
@pytest.mark.parametrize(
54+
"idir",
55+
[
56+
"_proof_with_classname.html",
57+
"_proof_no_classname.html",
58+
"_proof_with_argument_content.html",
59+
"_proof_with_labeled_math.html",
60+
"_proof_with_unlabeled_math.html",
61+
],
62+
)
63+
def test_proof(app, idir, file_regression):
64+
"""Test proof directive markup."""
65+
app.build()
66+
path_proof_directive = app.outdir / "proof" / idir
67+
assert path_proof_directive.exists()
68+
69+
# get content markup
70+
soup = BeautifulSoup(path_proof_directive.read_text(encoding="utf8"), "html.parser")
71+
72+
proof = soup.select("div.proof")[0]
73+
file_regression.check(str(proof), basename=idir.split(".")[0], extension=".html")

tests/test_algorithm/_algo_labeled_titled_with_classname.html renamed to tests/test_html/_algo_labeled_titled_with_classname.html

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)