mirror of
https://github.com/ankitects/anki.git
synced 2025-12-13 06:46:55 -05:00
embed notetype messages
This commit is contained in:
parent
c4b3ab62c8
commit
037df9522b
4 changed files with 76 additions and 71 deletions
|
|
@ -356,55 +356,6 @@ message DeckConfigInner {
|
||||||
bytes other = 255;
|
bytes other = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NoteFieldConfig {
|
|
||||||
bool sticky = 1;
|
|
||||||
bool rtl = 2;
|
|
||||||
string font_name = 3;
|
|
||||||
uint32 font_size = 4;
|
|
||||||
|
|
||||||
bytes other = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CardTemplateConfig {
|
|
||||||
string q_format = 1;
|
|
||||||
string a_format = 2;
|
|
||||||
string q_format_browser = 3;
|
|
||||||
string a_format_browser = 4;
|
|
||||||
int64 target_deck_id = 5;
|
|
||||||
string browser_font_name = 6;
|
|
||||||
uint32 browser_font_size = 7;
|
|
||||||
|
|
||||||
bytes other = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
message NotetypeConfig {
|
|
||||||
enum Kind {
|
|
||||||
KIND_NORMAL = 0;
|
|
||||||
KIND_CLOZE = 1;
|
|
||||||
}
|
|
||||||
Kind kind = 1;
|
|
||||||
uint32 sort_field_idx = 2;
|
|
||||||
string css = 3;
|
|
||||||
int64 target_deck_id = 4; // moved into config var
|
|
||||||
string latex_pre = 5;
|
|
||||||
string latex_post = 6;
|
|
||||||
bool latex_svg = 7;
|
|
||||||
repeated CardRequirement reqs = 8;
|
|
||||||
|
|
||||||
bytes other = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CardRequirement {
|
|
||||||
enum Kind {
|
|
||||||
KIND_NONE = 0;
|
|
||||||
KIND_ANY = 1;
|
|
||||||
KIND_ALL = 2;
|
|
||||||
}
|
|
||||||
uint32 card_ord = 1;
|
|
||||||
Kind kind = 2;
|
|
||||||
repeated uint32 field_ords = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Containers for passing around database objects
|
// Containers for passing around database objects
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
@ -484,27 +435,73 @@ message Deck {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Notetype {
|
message Notetype {
|
||||||
|
message Config {
|
||||||
|
enum Kind {
|
||||||
|
KIND_NORMAL = 0;
|
||||||
|
KIND_CLOZE = 1;
|
||||||
|
}
|
||||||
|
message CardRequirement {
|
||||||
|
enum Kind {
|
||||||
|
KIND_NONE = 0;
|
||||||
|
KIND_ANY = 1;
|
||||||
|
KIND_ALL = 2;
|
||||||
|
}
|
||||||
|
uint32 card_ord = 1;
|
||||||
|
Kind kind = 2;
|
||||||
|
repeated uint32 field_ords = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
Kind kind = 1;
|
||||||
|
uint32 sort_field_idx = 2;
|
||||||
|
string css = 3;
|
||||||
|
int64 target_deck_id = 4; // moved into config var
|
||||||
|
string latex_pre = 5;
|
||||||
|
string latex_post = 6;
|
||||||
|
bool latex_svg = 7;
|
||||||
|
repeated CardRequirement reqs = 8;
|
||||||
|
|
||||||
|
bytes other = 255;
|
||||||
|
}
|
||||||
|
message Field {
|
||||||
|
message Config {
|
||||||
|
bool sticky = 1;
|
||||||
|
bool rtl = 2;
|
||||||
|
string font_name = 3;
|
||||||
|
uint32 font_size = 4;
|
||||||
|
|
||||||
|
bytes other = 255;
|
||||||
|
}
|
||||||
|
OptionalUInt32 ord = 1;
|
||||||
|
string name = 2;
|
||||||
|
Config config = 5;
|
||||||
|
}
|
||||||
|
message Template {
|
||||||
|
message Config {
|
||||||
|
string q_format = 1;
|
||||||
|
string a_format = 2;
|
||||||
|
string q_format_browser = 3;
|
||||||
|
string a_format_browser = 4;
|
||||||
|
int64 target_deck_id = 5;
|
||||||
|
string browser_font_name = 6;
|
||||||
|
uint32 browser_font_size = 7;
|
||||||
|
|
||||||
|
bytes other = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
OptionalUInt32 ord = 1;
|
||||||
|
string name = 2;
|
||||||
|
uint32 mtime_secs = 3;
|
||||||
|
sint32 usn = 4;
|
||||||
|
Config config = 5;
|
||||||
|
}
|
||||||
|
|
||||||
int64 id = 1;
|
int64 id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
uint32 mtime_secs = 3;
|
uint32 mtime_secs = 3;
|
||||||
sint32 usn = 4;
|
sint32 usn = 4;
|
||||||
NotetypeConfig config = 7;
|
Config config = 7;
|
||||||
repeated NoteField fields = 8;
|
repeated Field fields = 8;
|
||||||
repeated CardTemplate templates = 9;
|
repeated Template templates = 9;
|
||||||
}
|
|
||||||
|
|
||||||
message NoteField {
|
|
||||||
OptionalUInt32 ord = 1;
|
|
||||||
string name = 2;
|
|
||||||
NoteFieldConfig config = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CardTemplate {
|
|
||||||
OptionalUInt32 ord = 1;
|
|
||||||
string name = 2;
|
|
||||||
uint32 mtime_secs = 3;
|
|
||||||
sint32 usn = 4;
|
|
||||||
CardTemplateConfig config = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message Note {
|
message Note {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
use super::{NoteFieldConfig, NoteFieldProto};
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto::{NoteField as NoteFieldProto, NoteFieldConfig, OptionalUInt32},
|
backend_proto::OptionalUInt32,
|
||||||
error::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,15 @@ mod stock;
|
||||||
mod templates;
|
mod templates;
|
||||||
|
|
||||||
pub use crate::backend_proto::{
|
pub use crate::backend_proto::{
|
||||||
card_requirement::Kind as CardRequirementKind, notetype_config::Kind as NotetypeKind,
|
notetype::{
|
||||||
CardRequirement, CardTemplateConfig, NoteFieldConfig, Notetype as NotetypeProto,
|
config::card_requirement::Kind as CardRequirementKind,
|
||||||
NotetypeConfig,
|
config::CardRequirement,
|
||||||
|
config::Kind as NotetypeKind,
|
||||||
|
template::Config as CardTemplateConfig,
|
||||||
|
Config as NotetypeConfig, Template as CardTemplateProto,
|
||||||
|
{field::Config as NoteFieldConfig, Field as NoteFieldProto},
|
||||||
|
},
|
||||||
|
Notetype as NotetypeProto,
|
||||||
};
|
};
|
||||||
pub(crate) use cardgen::{AlreadyGeneratedCardInfo, CardGenContext};
|
pub(crate) use cardgen::{AlreadyGeneratedCardInfo, CardGenContext};
|
||||||
pub use fields::NoteField;
|
pub use fields::NoteField;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
use super::{CardTemplateConfig, CardTemplateProto};
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto::{CardTemplate as CardTemplateProto, CardTemplateConfig, OptionalUInt32},
|
backend_proto::OptionalUInt32,
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
error::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
template::ParsedTemplate,
|
template::ParsedTemplate,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue