mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +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));
|
assert(l.filePath.startsWith(rootFolder.folderPath));
|
||||||
var spec = l.filePath.substring(rootFolder.folderPath.length + 1);
|
var spec = l.filePath.substring(rootFolder.folderPath.length + 1);
|
||||||
|
|
||||||
return rootFolder.getNoteWithSpec(spec);
|
return _getNoteWithSpec(rootFolder, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
Note resolve(String link) {
|
Note resolve(String link) {
|
||||||
|
@ -168,6 +168,19 @@ void main() {
|
|||||||
expect(resolvedNote.filePath, expectedNote.filePath);
|
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', () {
|
test('Should resolve Wiki Link object', () {
|
||||||
var note = rootFolder.getNoteWithSpec('Folder/Water.md');
|
var note = rootFolder.getNoteWithSpec('Folder/Water.md');
|
||||||
var linkResolver = LinkResolver(note);
|
var linkResolver = LinkResolver(note);
|
||||||
|
Reference in New Issue
Block a user