when symlinking foo.md, also symlink foo.html if generating .html
fixes #24 Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
@@ -52,6 +52,23 @@ def test_file_copy_symlink():
|
||||
assert os.path.islink(os.path.join(tmpdir, 'symlink-to-foo.txt'))
|
||||
|
||||
|
||||
def test_file_copy_symlink_of_markdown_also_has_html_symlink():
|
||||
"""Test the ability to sync source and generated symlinks to the output dir."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
src_dir = os.path.join(HERE, 'instance')
|
||||
generator = ssg.StaticSiteGenerator(src_dir, tmpdir)
|
||||
os.chdir(os.path.join(instance_dir, 'pages'))
|
||||
generator.build_file_in_destination(os.path.join(instance_dir, 'pages'), '', 'symlink-to-no-title.md', tmpdir,
|
||||
True)
|
||||
# need to copy the destination for os.path.exists to be happy with this
|
||||
generator.build_file_in_destination(os.path.join(instance_dir, 'pages'), '', 'no-title.md', tmpdir, True)
|
||||
assert os.path.exists(os.path.join(tmpdir, 'symlink-to-no-title.md'))
|
||||
assert os.path.islink(os.path.join(tmpdir, 'symlink-to-no-title.md'))
|
||||
# a .md symlink should also create the .html symlink (see issue #24)
|
||||
assert os.path.exists(os.path.join(tmpdir, 'symlink-to-no-title.html'))
|
||||
assert os.path.islink(os.path.join(tmpdir, 'symlink-to-no-title.html'))
|
||||
|
||||
|
||||
def test_dir_copy():
|
||||
"""Test the ability to sync a directory to the output dir."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
|
||||
Reference in New Issue
Block a user