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