Module with the CardTemplate
class’s attribute readers, writers, and accessors.
Attributes
[R] | answer_format | The card template’s answer format |
[RW] | browser_font_size | The card template’s font size used in the browser |
[RW] | browser_font_style | The card template’s font style in the browser |
[RW] | name | The card template’s name |
[R] | note_type | The card template’s note type object |
[R] | ordinal_number | 0 for the first card template of the note type, 1 for the second, etc |
[R] | question_format | The card template’s question format |
Instance Public methods
answer_format=(format) Link
Sets the answer format of the card template
Raises an ArgumentError if the specified format attempts to use invalid fields
Source: show
# File lib/anki_record/card_template/card_template_attributes.rb, line 48 def answer_format=(format) fields_in_specified_format = format.scan(/{{.+?}}/).map do |capture| capture.chomp("}}").reverse.chomp("{{").reverse end if fields_in_specified_format.any? do |field_name| !note_type.allowed_card_template_answer_format_field_names.include?(field_name) end raise ArgumentError, "You tried to use a field that the note type does not have." end @answer_format = format end
question_format=(format) Link
Sets the question format of the card template
Raises an ArgumentError if the specified format attempts to use invalid fields
Source: show
# File lib/anki_record/card_template/card_template_attributes.rb, line 27 def question_format=(format) fields_in_specified_format = format.scan(/{{.+?}}/).map do |capture| capture.chomp("}}").reverse.chomp("{{").reverse end if fields_in_specified_format.any? do |field_name| !note_type.allowed_card_template_question_format_field_names.include?(field_name) end raise ArgumentError, "You tried to use a field that the note type does not have." end @question_format = format end