mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-01 04:07:53 +08:00
Rename MetaLinkSyntax to WikiLinkSyntax
This commit is contained in:
@ -55,8 +55,8 @@ class LinkExtractor implements md.NodeVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'wikiLink') {
|
if (tag == 'wikiLink') {
|
||||||
var value = el.attributes['value'];
|
var term = el.attributes['term'];
|
||||||
var link = Link(term: value, filePath: null);
|
var link = Link(term: term, filePath: null);
|
||||||
links.add(link);
|
links.add(link);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -70,15 +70,15 @@ class LinkExtractor implements md.NodeVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MetaLinkSyntax extends md.InlineSyntax {
|
class WikiLinkSyntax extends md.InlineSyntax {
|
||||||
static final String _pattern = '\\[\\[([^\\[\\]]+)\\]\\]';
|
static final String _pattern = '\\[\\[([^\\[\\]]+)\\]\\]';
|
||||||
|
|
||||||
MetaLinkSyntax() : super(_pattern);
|
WikiLinkSyntax() : super(_pattern);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool onMatch(md.InlineParser parser, Match match) {
|
bool onMatch(md.InlineParser parser, Match match) {
|
||||||
md.Element el = md.Element.withTag('wikiLink');
|
md.Element el = md.Element.withTag('wikiLink');
|
||||||
el.attributes['value'] = '${match[1].trim()}';
|
el.attributes['term'] = '${match[1].trim()}';
|
||||||
parser.addNode(el);
|
parser.addNode(el);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ class Note with NotesNotifier {
|
|||||||
final doc = md.Document(
|
final doc = md.Document(
|
||||||
encodeHtml: false,
|
encodeHtml: false,
|
||||||
extensionSet: md.ExtensionSet.gitHubFlavored,
|
extensionSet: md.ExtensionSet.gitHubFlavored,
|
||||||
inlineSyntaxes: [MetaLinkSyntax()],
|
inlineSyntaxes: [WikiLinkSyntax()],
|
||||||
);
|
);
|
||||||
|
|
||||||
var lines = body.replaceAll('\r\n', '\n').split('\n');
|
var lines = body.replaceAll('\r\n', '\n').split('\n');
|
||||||
|
@ -185,7 +185,7 @@ class NoteSnippet extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<TextSpan> _extraMetaLinks(TextStyle textStyle, String line) {
|
List<TextSpan> _extraMetaLinks(TextStyle textStyle, String line) {
|
||||||
var regExp = MetaLinkSyntax().pattern;
|
var regExp = WikiLinkSyntax().pattern;
|
||||||
|
|
||||||
var spans = <TextSpan>[];
|
var spans = <TextSpan>[];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user