mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-02 12:56:16 +08:00
@ -244,6 +244,7 @@ feature:
|
|||||||
localization:
|
localization:
|
||||||
title: Localization
|
title: Localization
|
||||||
subtitle: Allow GitJournal to be translated
|
subtitle: Allow GitJournal to be translated
|
||||||
|
inlineTags: Inline Tags
|
||||||
|
|
||||||
feature_timeline:
|
feature_timeline:
|
||||||
title: Feature Timeline
|
title: Feature Timeline
|
||||||
|
@ -7,6 +7,7 @@ import 'package:gitjournal/core/links_loader.dart';
|
|||||||
import 'package:gitjournal/core/md_yaml_doc_loader.dart';
|
import 'package:gitjournal/core/md_yaml_doc_loader.dart';
|
||||||
import 'package:gitjournal/core/note_notifier.dart';
|
import 'package:gitjournal/core/note_notifier.dart';
|
||||||
import 'package:gitjournal/core/notes_folder_fs.dart';
|
import 'package:gitjournal/core/notes_folder_fs.dart';
|
||||||
|
import 'package:gitjournal/core/processors/inline_tags.dart';
|
||||||
import 'package:gitjournal/error_reporting.dart';
|
import 'package:gitjournal/error_reporting.dart';
|
||||||
import 'package:gitjournal/settings.dart';
|
import 'package:gitjournal/settings.dart';
|
||||||
import 'package:gitjournal/utils/datetime.dart';
|
import 'package:gitjournal/utils/datetime.dart';
|
||||||
@ -62,6 +63,7 @@ class Note with NotesNotifier {
|
|||||||
// Computed from body
|
// Computed from body
|
||||||
String _summary;
|
String _summary;
|
||||||
List<Link> _links;
|
List<Link> _links;
|
||||||
|
Set<String> _inlineTags;
|
||||||
|
|
||||||
static final _mdYamlDocLoader = MdYamlDocLoader();
|
static final _mdYamlDocLoader = MdYamlDocLoader();
|
||||||
static final _linksLoader = LinksLoader();
|
static final _linksLoader = LinksLoader();
|
||||||
@ -150,6 +152,8 @@ class Note with NotesNotifier {
|
|||||||
_body = newBody;
|
_body = newBody;
|
||||||
_summary = null;
|
_summary = null;
|
||||||
_links = null;
|
_links = null;
|
||||||
|
_inlineTags = null;
|
||||||
|
|
||||||
_notifyModified();
|
_notifyModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +189,17 @@ class Note with NotesNotifier {
|
|||||||
_notifyModified();
|
_notifyModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<String> get inlineTags {
|
||||||
|
if (_loadState != NoteLoadState.Loaded) return {};
|
||||||
|
|
||||||
|
if (_inlineTags == null) {
|
||||||
|
var tagPrefixes = Settings.instance.inlineTagPrefixes;
|
||||||
|
var p = InlineTagsProcessor(tagPrefixes: tagPrefixes);
|
||||||
|
_inlineTags = p.extractTags(body);
|
||||||
|
}
|
||||||
|
return _inlineTags;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> get extraProps {
|
Map<String, dynamic> get extraProps {
|
||||||
return _extraProps;
|
return _extraProps;
|
||||||
}
|
}
|
||||||
|
@ -525,6 +525,7 @@ typedef NoteMatcherAsync = Future<bool> Function(Note n);
|
|||||||
Set<String> _fetchTags(NotesFolder folder, Set<String> tags) {
|
Set<String> _fetchTags(NotesFolder folder, Set<String> tags) {
|
||||||
for (var note in folder.notes) {
|
for (var note in folder.notes) {
|
||||||
tags.addAll(note.tags);
|
tags.addAll(note.tags);
|
||||||
|
tags.addAll(note.inlineTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var folder in folder.subFolders) {
|
for (var folder in folder.subFolders) {
|
||||||
|
@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
|
|
||||||
class Features {
|
class Features {
|
||||||
static bool perFolderConfig = false;
|
static bool perFolderConfig = false;
|
||||||
static bool inlineTags = false;
|
|
||||||
|
|
||||||
static final all = <Feature>[
|
static final all = <Feature>[
|
||||||
Feature.basicSearch,
|
Feature.basicSearch,
|
||||||
@ -37,6 +36,7 @@ class Features {
|
|||||||
Feature.yamlTagsKey,
|
Feature.yamlTagsKey,
|
||||||
Feature.customMetaData,
|
Feature.customMetaData,
|
||||||
Feature.localization,
|
Feature.localization,
|
||||||
|
Feature.inlineTags,
|
||||||
];
|
];
|
||||||
|
|
||||||
static final inProgress = <String>[
|
static final inProgress = <String>[
|
||||||
@ -319,6 +319,14 @@ class Feature {
|
|||||||
tr("feature.localization.subtitle"),
|
tr("feature.localization.subtitle"),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static final inlineTags = Feature(
|
||||||
|
"inlineTags",
|
||||||
|
DateTime(2020, 09, 02),
|
||||||
|
tr("feature.inlineTags"),
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feature Adding checklist
|
// Feature Adding checklist
|
||||||
|
@ -243,8 +243,9 @@ class SettingsListState extends State<SettingsList> {
|
|||||||
Navigator.of(context).push(route);
|
Navigator.of(context).push(route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (Features.inlineTags)
|
ProOverlay(
|
||||||
ListTile(
|
feature: Feature.inlineTags,
|
||||||
|
child: ListTile(
|
||||||
title: Text(tr("settings.tags.title")),
|
title: Text(tr("settings.tags.title")),
|
||||||
subtitle: Text(tr("settings.tags.subtitle")),
|
subtitle: Text(tr("settings.tags.subtitle")),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -255,6 +256,7 @@ class SettingsListState extends State<SettingsList> {
|
|||||||
Navigator.of(context).push(route);
|
Navigator.of(context).push(route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(tr('settings.images.title')),
|
title: Text(tr('settings.images.title')),
|
||||||
subtitle: Text(tr('settings.images.subtitle')),
|
subtitle: Text(tr('settings.images.subtitle')),
|
||||||
|
@ -57,7 +57,8 @@ class TagListingScreen extends StatelessWidget {
|
|||||||
var rootFolder = Provider.of<NotesFolderFS>(context);
|
var rootFolder = Provider.of<NotesFolderFS>(context);
|
||||||
var folder = FlattenedNotesFolder(
|
var folder = FlattenedNotesFolder(
|
||||||
rootFolder,
|
rootFolder,
|
||||||
filter: (Note n) => n.tags.contains(tag),
|
filter: (Note n) =>
|
||||||
|
n.tags.contains(tag) || n.inlineTags.contains(tag),
|
||||||
title: tag,
|
title: tag,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user