1+ from pathlib import Path
2+ from ford .settings import ProjectSettings
13from ford .pagetree import get_page_tree
24from ford ._markdown import MetaMarkdown
35
@@ -29,8 +31,9 @@ def test_footnotes_on_one_page(tmp_path):
2931 """ ))
3032
3133 md = MetaMarkdown ()
34+ settings = ProjectSettings ()
3235 result_dir = tmp_path / "result"
33- nodes = get_page_tree (tmp_path , result_dir , tmp_path / "doc" , md )
36+ nodes = get_page_tree (tmp_path , result_dir , tmp_path / "doc" , md , settings )
3437
3538 assert len (nodes .subpages ) == 2
3639 assert "This is the footnote on page A" in nodes .subpages [0 ].contents
@@ -61,8 +64,9 @@ def test_footnotes_on_one_page_parse_failure(tmp_path):
6164 """ ))
6265
6366 md = MetaMarkdown ()
67+ settings = ProjectSettings ()
6468 result_dir = tmp_path / "result"
65- nodes = get_page_tree (tmp_path , result_dir , tmp_path / "doc" , md )
69+ nodes = get_page_tree (tmp_path , result_dir , tmp_path / "doc" , md , settings )
6670
6771 assert len (nodes .subpages ) == 1
6872 assert "This is the footnote on page A" not in nodes .subpages [0 ].contents
@@ -88,7 +92,31 @@ def test_non_utf8_encoding(tmp_path):
8892 """ ).encode (encoding ))
8993
9094 md = MetaMarkdown ()
95+ settings = ProjectSettings ()
9196 result_dir = tmp_path / "result"
92- nodes = get_page_tree (tmp_path , result_dir , tmp_path / "doc" , md , encoding = encoding )
97+ nodes = get_page_tree (
98+ tmp_path , result_dir , tmp_path / "doc" , md , settings , encoding = encoding
99+ )
93100
94101 assert "本文档是" in nodes .contents
102+
103+
104+ def test_exclude_ford_dirs (tmp_path , capsys ):
105+ """Test that we exclude some user-settable directories"""
106+
107+ (tmp_path / "index.md" ).write_text ("title: Index" )
108+
109+ subdir = tmp_path / "subdir"
110+ subdir .mkdir (parents = True )
111+
112+ media_dir : Path = tmp_path / "media"
113+ media_dir .mkdir (parents = True )
114+
115+ md = MetaMarkdown ()
116+ settings = ProjectSettings (media_dir = media_dir )
117+ result_dir = tmp_path / "result"
118+ get_page_tree (tmp_path , result_dir , tmp_path / "doc" , md , settings )
119+
120+ captured = capsys .readouterr ().out .replace ("\n " , " " ).replace (" " , " " )
121+ assert str (media_dir ) not in captured
122+ assert str (subdir ) in captured
0 commit comments