-$blob = readfile("t/tmp/out/del/a.html");
-ok($blob =~ /^trail=del n=del\/b p=$/m);
-$blob = readfile("t/tmp/out/del/b.html");
-ok($blob =~ /^trail=del n=del\/c p=del\/a$/m);
-$blob = readfile("t/tmp/out/del/c.html");
-ok($blob =~ /^trail=del n=del\/d p=del\/b$/m);
-$blob = readfile("t/tmp/out/del/d.html");
-ok($blob =~ /^trail=del n=del\/e p=del\/c$/m);
-$blob = readfile("t/tmp/out/del/e.html");
-ok($blob =~ /^trail=del n= p=del\/d$/m);
-
-$blob = readfile("t/tmp/out/sorting/linked.html");
-ok($blob =~ m{^trail=sorting n=sorting/a/b p=$}m);
-$blob = readfile("t/tmp/out/sorting/a/b.html");
-ok($blob =~ m{^trail=sorting n=sorting/a/c p=sorting/linked$}m);
-$blob = readfile("t/tmp/out/sorting/a/c.html");
-ok($blob =~ m{^trail=sorting n=sorting/z/a p=sorting/a/b$}m);
-$blob = readfile("t/tmp/out/sorting/z/a.html");
-ok($blob =~ m{^trail=sorting n=sorting/beginning p=sorting/a/c$}m);
-$blob = readfile("t/tmp/out/sorting/beginning.html");
-ok($blob =~ m{^trail=sorting n=sorting/middle p=sorting/z/a$}m);
-$blob = readfile("t/tmp/out/sorting/middle.html");
-ok($blob =~ m{^trail=sorting n=sorting/end p=sorting/beginning$}m);
-$blob = readfile("t/tmp/out/sorting/end.html");
-ok($blob =~ m{^trail=sorting n=sorting/new p=sorting/middle$}m);
-$blob = readfile("t/tmp/out/sorting/new.html");
-ok($blob =~ m{^trail=sorting n=sorting/old p=sorting/end$}m);
-$blob = readfile("t/tmp/out/sorting/old.html");
-ok($blob =~ m{^trail=sorting n=sorting/ancient p=sorting/new$}m);
-$blob = readfile("t/tmp/out/sorting/ancient.html");
-ok($blob =~ m{^trail=sorting n=sorting/linked2 p=sorting/old$}m);
-$blob = readfile("t/tmp/out/sorting/linked2.html");
-ok($blob =~ m{^trail=sorting n= p=sorting/ancient$}m);
+check_trail("del/a.html", "n=del/b p=");
+check_trail("del/b.html", "n=del/c p=del/a");
+check_trail("del/c.html", "n=del/d p=del/b");
+check_trail("del/d.html", "n=del/e p=del/c");
+check_trail("del/e.html", "n= p=del/d");
+
+check_trail("sorting/linked.html", "n=sorting/a/b p=");
+check_trail("sorting/a/b.html", "n=sorting/a/c p=sorting/linked");
+check_trail("sorting/a/c.html", "n=sorting/z/a p=sorting/a/b");
+check_trail("sorting/z/a.html", "n=sorting/beginning p=sorting/a/c");
+check_trail("sorting/beginning.html", "n=sorting/middle p=sorting/z/a");
+check_trail("sorting/middle.html", "n=sorting/end p=sorting/beginning");
+check_trail("sorting/end.html", "n=sorting/new p=sorting/middle");
+check_trail("sorting/new.html", "n=sorting/old p=sorting/end");
+check_trail("sorting/old.html", "n=sorting/ancient p=sorting/new");
+check_trail("sorting/ancient.html", "n=sorting/linked2 p=sorting/old");
+check_trail("sorting/linked2.html", "n= p=sorting/ancient");
+
+# If the inline has a limited number of pages, the trail still contains
+# everything.
+$blob = readfile("t/tmp/out/limited.html");
+ok($blob =~ /<a href="(\.\/)?limited\/a.html">a<\/a>/m);
+ok($blob =~ /<a href="(\.\/)?limited\/b.html">b<\/a>/m);
+ok($blob !~ /<a href="(\.\/)?limited\/c.html">/m);
+ok($blob !~ /<a href="(\.\/)?limited\/d.html">/m);
+check_trail("limited/a.html", "n=limited/b p=");
+check_trail("limited/b.html", "n=limited/c p=limited/a");
+check_trail("limited/c.html", "n=limited/d p=limited/b");
+check_trail("limited/d.html", "n= p=limited/c");
+
+check_trail("untrail/a.html", "n=untrail/b p=");
+check_trail("untrail/b.html", "n= p=untrail/a");
+
+$blob = readfile("t/tmp/out/retitled/a.html");
+ok($blob =~ /\^ the old title \^/m);