Commit graph

21 commits

Author SHA1 Message Date
Damien Elmes
1077c71c2e don't throw error in half-complete field filter 2012-04-08 21:39:04 +09:00
Damien Elmes
5d3e31ca5d integrate furigana field modifiers 2012-04-07 17:31:19 +09:00
Damien Elmes
933bee43a0 use the first hint occurrence for any subsequent clozes 2012-03-22 15:51:36 +09:00
Damien Elmes
66534db987 make the cloze hint a prefix 2012-03-07 03:27:04 +09:00
Damien Elmes
bde4420fb0 don't throw an error on unclosed conditional tags 2012-02-13 12:26:07 +09:00
Kieran Clancy
1c2b6b746f add hooks for arbitrary field modifiers 2012-01-22 13:24:30 +10:30
Damien Elmes
e610eeeb42 tweak template upgrading, replace repeated spaces with non-breaking ones 2011-12-17 22:01:50 +09:00
Damien Elmes
9e35e4acf2 template and cloze changes
While writing the documentation I realized that the default templates were
somewhat overwhelming. So I've moved the default settings into the card css,
and moved the css into a separate attribute which gets combined with the
question and answer templates.

Also:
- Detect cloze references directly rather than the conditional wrapper
- Add the cloze css to the template
2011-12-17 19:42:30 +09:00
Damien Elmes
619a58216a don't require fields in cloze del model; remove extra brackets in cloze hints 2011-12-17 15:02:15 +09:00
Damien Elmes
0a279f6a26 remove clozectx, add styling to stdmodels 2011-12-11 02:33:27 +09:00
Damien Elmes
1235f8362a type answer is now a template replacement 2011-11-28 15:15:38 +09:00
Damien Elmes
c76c08069e change template replacement behaviour
Previously {{field}} wrapped the field in a span with the field's font
properties. This wasn't obvious, and caused frequent problems with people
trying to combine field and template text, or use field content in dictionary
links.

Now that AnkiWeb has a wizard for configuring the front & back layout, we can
just put the formatting in the template instead.
2011-11-18 02:50:47 +09:00
Damien Elmes
ddcf83bc7f add [] to cloze 2011-04-29 11:43:06 +09:00
Damien Elmes
f0909ebed2 if context is off, don't lose outer field styling 2011-04-28 09:24:03 +09:00
Damien Elmes
0fdb966766 wrap clozes in a classed span instead of bold 2011-04-28 09:24:03 +09:00
Damien Elmes
03d00228aa support stripping context of cloze 2011-04-28 09:24:03 +09:00
Damien Elmes
ed75e4bee2 refactor cloze deletions and text:field, add forecast
Previously cloze deletions were handled by copying the contents of one field
into another and applying transforms to it. This had a number of problems:
- after you add a card, you can't undo the cloze deletion
- if you spot a mistake, you have to edit it twice (or more if you have more
  than one cloze for a sentence)
- making multiple clozes requires copying & pasting the sentence multiple
  times
- this also lead to much bigger decks if the sentences being cloze-deleted are
  large
- related clozes can't be spaced apart as siblings

To address these issues, we introduce the idea of cloze tags in the card
template and fields. If the template has the text:

{{cloze:1:field}}

And a field has the following contents:

{{c1::hello}}

Then the template will automatically replace that part of the text with either
occluded text, or a highlighted answer. All other clozes in the field are
displayed normally.

At the same time, we add support for text: into the template library, instead
of manually creating text: fields in the dict for every field.

Finally, add a forecast routine to get the due counts for the next week, which
is used in the GUI.
2011-04-28 09:23:56 +09:00
Damien Elmes
0e08092f65 disable callable replacement which isn't supported on older pythons 2011-01-20 05:32:30 +09:00
Damien Elmes
cdcde2f2d3 fix unicode warning when invalid template message given 2011-01-13 19:43:38 +09:00
Damien Elmes
425789535f don't trim whitespace in sections 2010-12-20 00:37:16 +09:00
Damien Elmes
a5af8fb8e9 convert pystache to private library since it doesn't behave like upstream 2010-11-29 22:51:55 +09:00
Renamed from pystache/template.py (Browse further)