ankidroid / ankidroid/Anki-Android

Expose 'Field filters' in 'Insert field'

未关闭
#20,533 6 条评论 0 个 reaction 已指派 1 人 已被 @david-allison 认领 在 GitHub 查看
Keep Open
主要语言
Kotlin
星标
11.8k
派生
2.9k
平均合并
2 天 3 小时
30 天内合并 PR
167

描述

## Context
https://docs.ankiweb.net/templates/fields.html lists a number of field filters, the most common of which are `{{type:Field}}` and `{{cloze:Field}}`.

Multiple filters may exist are applied right to left (inside-out/functional composition): `{{hint:text:Front}}` is applied: `hint(text(Front))`

Our UI for inserting fields:

The field filters we can apply:

* text
* cloze
* cloze-only
* hint
* type [special-cased]
* type:nc
* type:cloze
* furigana
* kana
* kanji
* tts [3 options]
* lang (required)
* voices
* speed
* tts-voices
* Not applied to a field; likely not necessary to expose

## Problem(s)
* The list of field filters is not discoverable, unless a user reads the manual
* In particular, TTS is often requested, and appears to be a feature we don't support at all
* Many combinations of field filters do not make sense. A few examples:
* `tts` and `type` are terminal fields, no fields should come after them
* `text` strips HTML, so shouldn't be applied after `hint`
* `cloze` should not be applied to a non-cloze note
* `tts` requires a `lang` option, and provides an arbitrary list of options for Anki clients to handle.

## Proposed solution

After/during AnkiDroid's 'basic' field selection
* Display the available field filters which can be applied to a field, along with a brief description
* Allow a 'chain' of filters to be built
* At each stage of the chain, display only the available filters to the user
* For the TTS filter, allow options to be set before adding it to the chain of filters. Modify the existing screen for 'tts-voices:'
* Display the rendered Field chain as text `{{text:hint:Field}}` and allow it to be inserted
* (optional) render the current chain as HTML, using the context of the field if opened from the Card Template Editor, and allowing a user to input arbitrary field text.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。