mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
Add FileName option in Note title settings
This doesn't do anything right now. It just shows the option.
This commit is contained in:
@ -64,6 +64,7 @@ settings:
|
|||||||
title: Title
|
title: Title
|
||||||
fromH1: Text Header 1
|
fromH1: Text Header 1
|
||||||
fromYaml: From YAML 'title'
|
fromYaml: From YAML 'title'
|
||||||
|
filename: FileName
|
||||||
exampleTitle: Pigeons
|
exampleTitle: Pigeons
|
||||||
exampleBody: I think they might be evil. Even more evil than penguins.
|
exampleBody: I think they might be evil. Even more evil than penguins.
|
||||||
exampleTag1: Birds
|
exampleTag1: Birds
|
||||||
|
@ -4,6 +4,7 @@ import 'package:flutter_emoji/flutter_emoji.dart';
|
|||||||
import 'package:yaml/yaml.dart';
|
import 'package:yaml/yaml.dart';
|
||||||
|
|
||||||
import 'package:gitjournal/core/notes_folder.dart';
|
import 'package:gitjournal/core/notes_folder.dart';
|
||||||
|
import 'package:gitjournal/settings.dart';
|
||||||
import 'package:gitjournal/utils/datetime.dart';
|
import 'package:gitjournal/utils/datetime.dart';
|
||||||
import 'package:gitjournal/utils/logger.dart';
|
import 'package:gitjournal/utils/logger.dart';
|
||||||
import 'md_yaml_doc.dart';
|
import 'md_yaml_doc.dart';
|
||||||
@ -26,7 +27,7 @@ class NoteSerializationSettings {
|
|||||||
bool tagsInString = false;
|
bool tagsInString = false;
|
||||||
bool tagsHaveHash = false;
|
bool tagsHaveHash = false;
|
||||||
|
|
||||||
bool saveTitleAsH1 = true;
|
SettingsTitle titleSettings = SettingsTitle.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoteSerializer implements NoteSerializerInterface {
|
class NoteSerializer implements NoteSerializerInterface {
|
||||||
@ -36,7 +37,7 @@ class NoteSerializer implements NoteSerializerInterface {
|
|||||||
settings.modifiedKey = config.yamlModifiedKey;
|
settings.modifiedKey = config.yamlModifiedKey;
|
||||||
settings.createdKey = config.yamlCreatedKey;
|
settings.createdKey = config.yamlCreatedKey;
|
||||||
settings.tagsKey = config.yamlTagsKey;
|
settings.tagsKey = config.yamlTagsKey;
|
||||||
settings.saveTitleAsH1 = config.saveTitleInH1;
|
settings.titleSettings = config.titleSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteSerializer.raw();
|
NoteSerializer.raw();
|
||||||
@ -59,7 +60,7 @@ class NoteSerializer implements NoteSerializerInterface {
|
|||||||
|
|
||||||
if (note.title != null) {
|
if (note.title != null) {
|
||||||
var title = emojiParser.unemojify(note.title.trim());
|
var title = emojiParser.unemojify(note.title.trim());
|
||||||
if (settings.saveTitleAsH1) {
|
if (settings.titleSettings == SettingsTitle.InH1) {
|
||||||
if (title.isNotEmpty) {
|
if (title.isNotEmpty) {
|
||||||
data.body = '# $title\n\n${data.body}';
|
data.body = '# $title\n\n${data.body}';
|
||||||
data.props.remove(settings.titleKey);
|
data.props.remove(settings.titleKey);
|
||||||
@ -148,7 +149,7 @@ class NoteSerializer implements NoteSerializerInterface {
|
|||||||
note.title = emojiParser.emojify(title);
|
note.title = emojiParser.emojify(title);
|
||||||
|
|
||||||
propsUsed.add(settings.titleKey);
|
propsUsed.add(settings.titleKey);
|
||||||
settings.saveTitleAsH1 = false;
|
settings.titleSettings = SettingsTitle.InYaml;
|
||||||
} else {
|
} else {
|
||||||
var startsWithH1 = false;
|
var startsWithH1 = false;
|
||||||
for (var line in LineSplitter.split(note.body)) {
|
for (var line in LineSplitter.split(note.body)) {
|
||||||
|
@ -33,7 +33,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
final String yamlModifiedKey;
|
final String yamlModifiedKey;
|
||||||
final String yamlCreatedKey;
|
final String yamlCreatedKey;
|
||||||
final String yamlTagsKey;
|
final String yamlTagsKey;
|
||||||
final bool saveTitleInH1;
|
final SettingsTitle titleSettings;
|
||||||
|
|
||||||
final Set<String> inlineTagPrefixes;
|
final Set<String> inlineTagPrefixes;
|
||||||
final String imageLocationSpec;
|
final String imageLocationSpec;
|
||||||
@ -51,7 +51,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
@required this.yamlModifiedKey,
|
@required this.yamlModifiedKey,
|
||||||
@required this.yamlCreatedKey,
|
@required this.yamlCreatedKey,
|
||||||
@required this.yamlTagsKey,
|
@required this.yamlTagsKey,
|
||||||
@required this.saveTitleInH1,
|
@required this.titleSettings,
|
||||||
@required this.inlineTagPrefixes,
|
@required this.inlineTagPrefixes,
|
||||||
@required this.imageLocationSpec,
|
@required this.imageLocationSpec,
|
||||||
});
|
});
|
||||||
@ -69,7 +69,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
yamlModifiedKey,
|
yamlModifiedKey,
|
||||||
yamlCreatedKey,
|
yamlCreatedKey,
|
||||||
yamlTagsKey,
|
yamlTagsKey,
|
||||||
saveTitleInH1,
|
titleSettings,
|
||||||
inlineTagPrefixes,
|
inlineTagPrefixes,
|
||||||
imageLocationSpec,
|
imageLocationSpec,
|
||||||
];
|
];
|
||||||
@ -102,7 +102,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
yamlCreatedKey: settings.yamlCreatedKey,
|
yamlCreatedKey: settings.yamlCreatedKey,
|
||||||
yamlModifiedKey: settings.yamlModifiedKey,
|
yamlModifiedKey: settings.yamlModifiedKey,
|
||||||
yamlTagsKey: settings.yamlTagsKey,
|
yamlTagsKey: settings.yamlTagsKey,
|
||||||
saveTitleInH1: settings.saveTitleInH1,
|
titleSettings: settings.titleSettings,
|
||||||
inlineTagPrefixes: settings.inlineTagPrefixes,
|
inlineTagPrefixes: settings.inlineTagPrefixes,
|
||||||
imageLocationSpec: settings.imageLocationSpec,
|
imageLocationSpec: settings.imageLocationSpec,
|
||||||
);
|
);
|
||||||
@ -135,7 +135,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
settings.yamlCreatedKey = yamlCreatedKey;
|
settings.yamlCreatedKey = yamlCreatedKey;
|
||||||
settings.yamlModifiedKey = yamlModifiedKey;
|
settings.yamlModifiedKey = yamlModifiedKey;
|
||||||
settings.yamlTagsKey = yamlTagsKey;
|
settings.yamlTagsKey = yamlTagsKey;
|
||||||
settings.saveTitleInH1 = saveTitleInH1;
|
settings.titleSettings = titleSettings;
|
||||||
settings.inlineTagPrefixes = inlineTagPrefixes;
|
settings.inlineTagPrefixes = inlineTagPrefixes;
|
||||||
settings.imageLocationSpec = imageLocationSpec;
|
settings.imageLocationSpec = imageLocationSpec;
|
||||||
settings.save();
|
settings.save();
|
||||||
@ -154,7 +154,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
String yamlCreatedKey,
|
String yamlCreatedKey,
|
||||||
String yamlModifiedKey,
|
String yamlModifiedKey,
|
||||||
String yamlTagsKey,
|
String yamlTagsKey,
|
||||||
bool saveTitleInH1,
|
SettingsTitle titleSettings,
|
||||||
Set<String> inlineTagPrefixes,
|
Set<String> inlineTagPrefixes,
|
||||||
String imageLocationSpec,
|
String imageLocationSpec,
|
||||||
}) {
|
}) {
|
||||||
@ -172,7 +172,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
yamlCreatedKey: yamlCreatedKey ?? this.yamlCreatedKey,
|
yamlCreatedKey: yamlCreatedKey ?? this.yamlCreatedKey,
|
||||||
yamlModifiedKey: yamlModifiedKey ?? this.yamlModifiedKey,
|
yamlModifiedKey: yamlModifiedKey ?? this.yamlModifiedKey,
|
||||||
yamlTagsKey: yamlTagsKey ?? this.yamlTagsKey,
|
yamlTagsKey: yamlTagsKey ?? this.yamlTagsKey,
|
||||||
saveTitleInH1: saveTitleInH1 ?? this.saveTitleInH1,
|
titleSettings: titleSettings ?? this.titleSettings,
|
||||||
inlineTagPrefixes: inlineTagPrefixes ?? this.inlineTagPrefixes,
|
inlineTagPrefixes: inlineTagPrefixes ?? this.inlineTagPrefixes,
|
||||||
imageLocationSpec: imageLocationSpec ?? this.imageLocationSpec,
|
imageLocationSpec: imageLocationSpec ?? this.imageLocationSpec,
|
||||||
);
|
);
|
||||||
@ -229,7 +229,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
var yamlCreatedKey = map['yamlCreatedKey']?.toString();
|
var yamlCreatedKey = map['yamlCreatedKey']?.toString();
|
||||||
var yamlModifiedKey = map['yamlModifiedKey']?.toString();
|
var yamlModifiedKey = map['yamlModifiedKey']?.toString();
|
||||||
var yamlTagsKey = map['yamlTagsKey']?.toString();
|
var yamlTagsKey = map['yamlTagsKey']?.toString();
|
||||||
var saveTitleInH1 = map['saveTitleInH1']?.toString() != "false";
|
var titleSettings = map['titleSettings']?.toString();
|
||||||
|
|
||||||
// FIXME: What about inlineTagPrefixes?
|
// FIXME: What about inlineTagPrefixes?
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
yamlCreatedKey: yamlCreatedKey,
|
yamlCreatedKey: yamlCreatedKey,
|
||||||
yamlModifiedKey: yamlModifiedKey,
|
yamlModifiedKey: yamlModifiedKey,
|
||||||
yamlTagsKey: yamlTagsKey,
|
yamlTagsKey: yamlTagsKey,
|
||||||
saveTitleInH1: saveTitleInH1,
|
titleSettings: SettingsTitle.fromInternalString(titleSettings),
|
||||||
inlineTagPrefixes: {},
|
inlineTagPrefixes: {},
|
||||||
imageLocationSpec: "",
|
imageLocationSpec: "",
|
||||||
);
|
);
|
||||||
@ -282,7 +282,7 @@ class NotesFolderConfig extends Equatable {
|
|||||||
'yamlModifiedKey': yamlModifiedKey,
|
'yamlModifiedKey': yamlModifiedKey,
|
||||||
'yamlCreatedKey': yamlCreatedKey,
|
'yamlCreatedKey': yamlCreatedKey,
|
||||||
'yamlTagsKey': yamlTagsKey,
|
'yamlTagsKey': yamlTagsKey,
|
||||||
'saveTitleInH1': saveTitleInH1,
|
'titleSettings': titleSettings.toInternalString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
var yaml = toYAML(map);
|
var yaml = toYAML(map);
|
||||||
|
@ -66,7 +66,7 @@ class Repository with ChangeNotifier {
|
|||||||
@required SharedPreferences pref,
|
@required SharedPreferences pref,
|
||||||
@required String id,
|
@required String id,
|
||||||
}) async {
|
}) async {
|
||||||
await migrateSettings(pref, gitBaseDir);
|
await migrateSettings(id, pref, gitBaseDir);
|
||||||
|
|
||||||
var settings = Settings(id);
|
var settings = Settings(id);
|
||||||
settings.load(pref);
|
settings.load(pref);
|
||||||
|
@ -82,8 +82,9 @@ class _NoteMetadataSettingsScreenState
|
|||||||
onChanged: (bool newVal) {
|
onChanged: (bool newVal) {
|
||||||
setState(() {
|
setState(() {
|
||||||
settings.yamlHeaderEnabled = newVal;
|
settings.yamlHeaderEnabled = newVal;
|
||||||
if (newVal == false) {
|
var titleInYaml = settings.titleSettings == SettingsTitle.InYaml;
|
||||||
settings.saveTitleInH1 = true;
|
if (newVal == false && titleInYaml) {
|
||||||
|
settings.titleSettings = SettingsTitle.Default;
|
||||||
}
|
}
|
||||||
settings.save();
|
settings.save();
|
||||||
});
|
});
|
||||||
@ -138,20 +139,14 @@ class _NoteMetadataSettingsScreenState
|
|||||||
),
|
),
|
||||||
ListPreference(
|
ListPreference(
|
||||||
title: tr("settings.noteMetaData.titleMetaData.title"),
|
title: tr("settings.noteMetaData.titleMetaData.title"),
|
||||||
options: [
|
options:
|
||||||
tr("settings.noteMetaData.titleMetaData.fromH1"),
|
SettingsTitle.options.map((f) => f.toPublicString()).toList(),
|
||||||
if (settings.yamlHeaderEnabled)
|
currentOption: settings.titleSettings.toPublicString(),
|
||||||
tr("settings.noteMetaData.titleMetaData.fromYaml"),
|
onChange: (String publicStr) {
|
||||||
],
|
var format = SettingsTitle.fromPublicString(publicStr);
|
||||||
currentOption: settings.saveTitleInH1
|
settings.titleSettings = format;
|
||||||
? tr("settings.noteMetaData.titleMetaData.fromH1")
|
settings.save();
|
||||||
: tr("settings.noteMetaData.titleMetaData.fromYaml"),
|
setState(() {});
|
||||||
onChange: (String newVal) {
|
|
||||||
setState(() {
|
|
||||||
settings.saveTitleInH1 =
|
|
||||||
newVal == tr("settings.noteMetaData.titleMetaData.fromH1");
|
|
||||||
settings.save();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ProOverlay(
|
ProOverlay(
|
||||||
|
@ -32,6 +32,7 @@ class Settings extends ChangeNotifier {
|
|||||||
String yamlCreatedKey = "created";
|
String yamlCreatedKey = "created";
|
||||||
String yamlTagsKey = "tags";
|
String yamlTagsKey = "tags";
|
||||||
String customMetaData = "";
|
String customMetaData = "";
|
||||||
|
SettingsTitle titleSettings = SettingsTitle.Default;
|
||||||
|
|
||||||
bool yamlHeaderEnabled = true;
|
bool yamlHeaderEnabled = true;
|
||||||
String defaultNewNoteFolderSpec = "";
|
String defaultNewNoteFolderSpec = "";
|
||||||
@ -45,7 +46,7 @@ class Settings extends ChangeNotifier {
|
|||||||
SettingsFolderViewType defaultView = SettingsFolderViewType.Default;
|
SettingsFolderViewType defaultView = SettingsFolderViewType.Default;
|
||||||
bool showNoteSummary = true;
|
bool showNoteSummary = true;
|
||||||
String folderViewHeaderType = "TitleGenerated";
|
String folderViewHeaderType = "TitleGenerated";
|
||||||
int version = 2;
|
int version = 3;
|
||||||
|
|
||||||
SettingsHomeScreen homeScreen = SettingsHomeScreen.Default;
|
SettingsHomeScreen homeScreen = SettingsHomeScreen.Default;
|
||||||
SettingsTheme theme = SettingsTheme.Default;
|
SettingsTheme theme = SettingsTheme.Default;
|
||||||
@ -58,7 +59,6 @@ class Settings extends ChangeNotifier {
|
|||||||
String imageLocationSpec = "."; // . means the same folder
|
String imageLocationSpec = "."; // . means the same folder
|
||||||
|
|
||||||
bool zenMode = false;
|
bool zenMode = false;
|
||||||
bool saveTitleInH1 = true;
|
|
||||||
|
|
||||||
bool swipeToDelete = true;
|
bool swipeToDelete = true;
|
||||||
bool emojiParser = true;
|
bool emojiParser = true;
|
||||||
@ -134,7 +134,8 @@ class Settings extends ChangeNotifier {
|
|||||||
_getString(pref, "imageLocationSpec") ?? imageLocationSpec;
|
_getString(pref, "imageLocationSpec") ?? imageLocationSpec;
|
||||||
|
|
||||||
zenMode = _getBool(pref, "zenMode") ?? zenMode;
|
zenMode = _getBool(pref, "zenMode") ?? zenMode;
|
||||||
saveTitleInH1 = _getBool(pref, "saveTitleInH1") ?? saveTitleInH1;
|
titleSettings =
|
||||||
|
SettingsTitle.fromInternalString(_getString(pref, "titleSettings"));
|
||||||
swipeToDelete = _getBool(pref, "swipeToDelete") ?? swipeToDelete;
|
swipeToDelete = _getBool(pref, "swipeToDelete") ?? swipeToDelete;
|
||||||
|
|
||||||
inlineTagPrefixes =
|
inlineTagPrefixes =
|
||||||
@ -239,8 +240,8 @@ class Settings extends ChangeNotifier {
|
|||||||
await _setString(pref, "imageLocationSpec", imageLocationSpec,
|
await _setString(pref, "imageLocationSpec", imageLocationSpec,
|
||||||
defaultSet.imageLocationSpec);
|
defaultSet.imageLocationSpec);
|
||||||
await _setBool(pref, "zenMode", zenMode, defaultSet.zenMode);
|
await _setBool(pref, "zenMode", zenMode, defaultSet.zenMode);
|
||||||
await _setBool(
|
await _setString(pref, "titleSettings", titleSettings.toInternalString(),
|
||||||
pref, "saveTitleInH1", saveTitleInH1, defaultSet.saveTitleInH1);
|
defaultSet.titleSettings.toInternalString());
|
||||||
await _setBool(
|
await _setBool(
|
||||||
pref, "swipeToDelete", swipeToDelete, defaultSet.swipeToDelete);
|
pref, "swipeToDelete", swipeToDelete, defaultSet.swipeToDelete);
|
||||||
await _setStringSet(pref, "inlineTagPrefixes", inlineTagPrefixes,
|
await _setStringSet(pref, "inlineTagPrefixes", inlineTagPrefixes,
|
||||||
@ -356,7 +357,7 @@ class Settings extends ChangeNotifier {
|
|||||||
'theme': theme.toInternalString(),
|
'theme': theme.toInternalString(),
|
||||||
'imageLocationSpec': imageLocationSpec,
|
'imageLocationSpec': imageLocationSpec,
|
||||||
'zenMode': zenMode.toString(),
|
'zenMode': zenMode.toString(),
|
||||||
'saveTitleInH1': saveTitleInH1.toString(),
|
'titleSettings': titleSettings.toInternalString(),
|
||||||
'swipeToDelete': swipeToDelete.toString(),
|
'swipeToDelete': swipeToDelete.toString(),
|
||||||
'inlineTagPrefixes': inlineTagPrefixes.join(' '),
|
'inlineTagPrefixes': inlineTagPrefixes.join(' '),
|
||||||
'emojiParser': emojiParser.toString(),
|
'emojiParser': emojiParser.toString(),
|
||||||
@ -849,3 +850,56 @@ class SettingsTheme {
|
|||||||
return ThemeMode.dark;
|
return ThemeMode.dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SettingsTitle {
|
||||||
|
static const InYaml =
|
||||||
|
SettingsTitle("settings.noteMetaData.titleMetaData.fromYaml", "yaml");
|
||||||
|
static const InH1 =
|
||||||
|
SettingsTitle("settings.noteMetaData.titleMetaData.fromH1", "h1");
|
||||||
|
static const InFileName =
|
||||||
|
SettingsTitle("settings.noteMetaData.titleMetaData.filename", "filename");
|
||||||
|
|
||||||
|
static const Default = InH1;
|
||||||
|
|
||||||
|
final String _str;
|
||||||
|
final String _publicString;
|
||||||
|
const SettingsTitle(this._publicString, this._str);
|
||||||
|
|
||||||
|
String toInternalString() {
|
||||||
|
return _str;
|
||||||
|
}
|
||||||
|
|
||||||
|
String toPublicString() {
|
||||||
|
return tr(_publicString);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const options = <SettingsTitle>[
|
||||||
|
InH1,
|
||||||
|
InYaml,
|
||||||
|
InFileName,
|
||||||
|
];
|
||||||
|
|
||||||
|
static SettingsTitle fromInternalString(String str) {
|
||||||
|
for (var opt in options) {
|
||||||
|
if (opt.toInternalString() == str) {
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SettingsTitle fromPublicString(String str) {
|
||||||
|
for (var opt in options) {
|
||||||
|
if (opt.toPublicString() == str) {
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
assert(false, "SettingsTitle toString should never be called");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@ import 'package:gitjournal/settings.dart';
|
|||||||
import 'package:gitjournal/utils/logger.dart';
|
import 'package:gitjournal/utils/logger.dart';
|
||||||
|
|
||||||
Future<void> migrateSettings(
|
Future<void> migrateSettings(
|
||||||
|
String id,
|
||||||
SharedPreferences pref,
|
SharedPreferences pref,
|
||||||
String gitBaseDir,
|
String gitBaseDir,
|
||||||
) async {
|
) async {
|
||||||
@ -139,6 +140,16 @@ Future<void> migrateSettings(
|
|||||||
await pref.remove("settingsVersion");
|
await pref.remove("settingsVersion");
|
||||||
await pref.setInt(prefix + "settingsVersion", version);
|
await pref.setInt(prefix + "settingsVersion", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version == 2) {
|
||||||
|
var saveTitleInH1 = pref.getBool(id + '_' + "saveTitleInH1");
|
||||||
|
if (saveTitleInH1 == false) {
|
||||||
|
var key = id + "_" + "titleSettings";
|
||||||
|
await pref.setString(key, "yaml");
|
||||||
|
}
|
||||||
|
|
||||||
|
version = 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> migrateSshKeys(
|
Future<void> migrateSshKeys(
|
||||||
|
@ -18,7 +18,7 @@ void main() {
|
|||||||
var doc = MdYamlDoc(body: "I :heart: you", props: props);
|
var doc = MdYamlDoc(body: "I :heart: you", props: props);
|
||||||
|
|
||||||
var serializer = NoteSerializer.raw();
|
var serializer = NoteSerializer.raw();
|
||||||
serializer.settings.saveTitleAsH1 = false;
|
serializer.settings.titleSettings = SettingsTitle.InYaml;
|
||||||
|
|
||||||
var note = Note(parent, "file-path-not-important");
|
var note = Note(parent, "file-path-not-important");
|
||||||
serializer.decode(doc, note);
|
serializer.decode(doc, note);
|
||||||
@ -40,7 +40,7 @@ void main() {
|
|||||||
MdYamlDoc(body: "# Why not :coffee:?\n\nI :heart: you", props: props);
|
MdYamlDoc(body: "# Why not :coffee:?\n\nI :heart: you", props: props);
|
||||||
|
|
||||||
var serializer = NoteSerializer.raw();
|
var serializer = NoteSerializer.raw();
|
||||||
serializer.settings.saveTitleAsH1 = true;
|
serializer.settings.titleSettings = SettingsTitle.InH1;
|
||||||
|
|
||||||
var note = Note(parent, "file-path-not-important");
|
var note = Note(parent, "file-path-not-important");
|
||||||
serializer.decode(doc, note);
|
serializer.decode(doc, note);
|
||||||
@ -89,7 +89,7 @@ void main() {
|
|||||||
var doc = MdYamlDoc(body: "I :heart: you", props: props);
|
var doc = MdYamlDoc(body: "I :heart: you", props: props);
|
||||||
|
|
||||||
var serializer = NoteSerializer.raw();
|
var serializer = NoteSerializer.raw();
|
||||||
serializer.settings.saveTitleAsH1 = true;
|
serializer.settings.titleSettings = SettingsTitle.InH1;
|
||||||
|
|
||||||
var note = Note(parent, "file-path-not-important");
|
var note = Note(parent, "file-path-not-important");
|
||||||
serializer.decode(doc, note);
|
serializer.decode(doc, note);
|
||||||
@ -111,7 +111,7 @@ void main() {
|
|||||||
var doc = MdYamlDoc(body: "body", props: props);
|
var doc = MdYamlDoc(body: "body", props: props);
|
||||||
|
|
||||||
var serializer = NoteSerializer.raw();
|
var serializer = NoteSerializer.raw();
|
||||||
serializer.settings.saveTitleAsH1 = false;
|
serializer.settings.titleSettings = SettingsTitle.InYaml;
|
||||||
|
|
||||||
var note = Note(parent, "file-path-not-important");
|
var note = Note(parent, "file-path-not-important");
|
||||||
serializer.decode(doc, note);
|
serializer.decode(doc, note);
|
||||||
@ -136,7 +136,7 @@ void main() {
|
|||||||
var doc = MdYamlDoc(body: "body", props: props);
|
var doc = MdYamlDoc(body: "body", props: props);
|
||||||
|
|
||||||
var serializer = NoteSerializer.raw();
|
var serializer = NoteSerializer.raw();
|
||||||
serializer.settings.saveTitleAsH1 = false;
|
serializer.settings.titleSettings = SettingsTitle.InYaml;
|
||||||
|
|
||||||
var note = Note(parent, "file-path-not-important");
|
var note = Note(parent, "file-path-not-important");
|
||||||
serializer.decode(doc, note);
|
serializer.decode(doc, note);
|
||||||
|
@ -39,7 +39,7 @@ void main() {
|
|||||||
yamlCreatedKey: 'created',
|
yamlCreatedKey: 'created',
|
||||||
yamlModifiedKey: 'modified',
|
yamlModifiedKey: 'modified',
|
||||||
yamlTagsKey: 'tags',
|
yamlTagsKey: 'tags',
|
||||||
saveTitleInH1: true,
|
titleSettings: SettingsTitle.InFileName,
|
||||||
inlineTagPrefixes: {},
|
inlineTagPrefixes: {},
|
||||||
imageLocationSpec: "",
|
imageLocationSpec: "",
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user