mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
Resolve "normal links" without a file extension
This is against the markdown spec, but the foam documentaiton seem to have this in a number of places.
This commit is contained in:
@ -18,7 +18,7 @@ class LinkResolver {
|
||||
assert(l.filePath.startsWith(rootFolder.folderPath));
|
||||
var spec = l.filePath.substring(rootFolder.folderPath.length + 1);
|
||||
|
||||
return rootFolder.getNoteWithSpec(spec);
|
||||
return _getNoteWithSpec(rootFolder, spec);
|
||||
}
|
||||
|
||||
Note resolve(String link) {
|
||||
|
@ -168,6 +168,19 @@ void main() {
|
||||
expect(resolvedNote.filePath, expectedNote.filePath);
|
||||
});
|
||||
|
||||
test('Should resolve Link object without extension', () {
|
||||
var note = rootFolder.getNoteWithSpec('Folder/Water.md');
|
||||
var linkResolver = LinkResolver(note);
|
||||
|
||||
var expectedNote = rootFolder.getNoteWithSpec('Fire.md');
|
||||
var filePath = expectedNote.filePath;
|
||||
filePath = filePath.substring(0, filePath.length - 3);
|
||||
var link = Link(filePath: filePath, publicTerm: 'foo');
|
||||
|
||||
var resolvedNote = linkResolver.resolveLink(link);
|
||||
expect(resolvedNote.filePath, expectedNote.filePath);
|
||||
});
|
||||
|
||||
test('Should resolve Wiki Link object', () {
|
||||
var note = rootFolder.getNoteWithSpec('Folder/Water.md');
|
||||
var linkResolver = LinkResolver(note);
|
||||
|
Reference in New Issue
Block a user