-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix behavior of
Pages
in @bibliography
blocks
The `Pages` field now behaves exactly as `Pages` in `@contents` and `@index` blocks: all files are relative to the directory containing the current file. Also, by popular demand, `@__FILE__` is supported to refer to the current file (even though `@contents` and `@index` does not support this feature.
- Loading branch information
Showing
19 changed files
with
726 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Wrapper around the content of a text file, for testing. | ||
```julia | ||
file = FileContent(name) | ||
``` | ||
can be used as | ||
```julia | ||
@test file.exists | ||
@test "string" in file | ||
@test contains(file, "string") | ||
``` | ||
Apart from providing the convenient `in`, when the test fails, this produces | ||
more useful output than the equivalent | ||
``` | ||
file = read(name, String) | ||
@test contains(file, "string") | ||
``` | ||
in that it doesn't dump the entire content of the file to the screen. | ||
""" | ||
struct FileContent | ||
name::String | ||
exists::Bool | ||
content::String | ||
function FileContent(filename) | ||
if isfile(filename) | ||
new(abspath(filename), true, read(filename, String)) | ||
else | ||
new(abspath(filename), false, "") | ||
end | ||
end | ||
end | ||
|
||
Base.show(io::IO, f::FileContent) = print(io, "<Content of $(f.name)>") | ||
|
||
Base.in(str, file::FileContent) = contains(file.content, str) | ||
|
||
Base.contains(file::FileContent, str) = contains(file.content, str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.