drop type answer requirement special case
While it makes no sense to have the typing box on the front without another non-empty field, "the front of this card is empty" when a typing box is on the template seems to be confusing some users, so it is clearer to show them the box.
This commit is contained in:
parent
d36bd33972
commit
4e33775ed4
@ -411,7 +411,7 @@ def test_req():
|
||||
reqSize(opt)
|
||||
r = opt["req"][0]
|
||||
assert r[1] in ("any", "all")
|
||||
assert r[2] == [0]
|
||||
assert r[2] == [0, 1]
|
||||
|
||||
|
||||
# def test_updatereqs_performance():
|
||||
|
@ -285,12 +285,7 @@ fn template_is_empty<'a>(nonempty_fields: &HashSet<&str>, nodes: &[ParsedNode<'a
|
||||
match node {
|
||||
// ignore normal text
|
||||
Text(_) => (),
|
||||
Replacement { key, filters } => {
|
||||
// Anki doesn't consider a type: reference as a required field
|
||||
if filters.contains(&"type") {
|
||||
continue;
|
||||
}
|
||||
|
||||
Replacement { key, .. } => {
|
||||
if nonempty_fields.contains(*key) {
|
||||
// a single replacement is enough
|
||||
return false;
|
||||
@ -657,7 +652,7 @@ mod test {
|
||||
let fields = HashSet::from_iter(vec!["1", "3"].into_iter());
|
||||
let mut tmpl = PT::from_text("{{2}}{{1}}").unwrap();
|
||||
assert_eq!(tmpl.renders_with_fields(&fields), true);
|
||||
tmpl = PT::from_text("{{2}}{{type:cloze:1}}").unwrap();
|
||||
tmpl = PT::from_text("{{2}}").unwrap();
|
||||
assert_eq!(tmpl.renders_with_fields(&fields), false);
|
||||
tmpl = PT::from_text("{{2}}{{4}}").unwrap();
|
||||
assert_eq!(tmpl.renders_with_fields(&fields), false);
|
||||
@ -700,12 +695,6 @@ mod test {
|
||||
FieldRequirements::All(HashSet::from_iter(vec![0, 1].into_iter()))
|
||||
);
|
||||
|
||||
tmpl = PT::from_text("{{a}}{{type:b}}").unwrap();
|
||||
assert_eq!(
|
||||
tmpl.requirements(&field_map),
|
||||
FieldRequirements::Any(HashSet::from_iter(vec![0].into_iter()))
|
||||
);
|
||||
|
||||
tmpl = PT::from_text(
|
||||
r#"
|
||||
{{^a}}
|
||||
|
Loading…
Reference in New Issue
Block a user