Anki card creation inside Pleco: a feature proposal and a possible bug report

Cameroon

秀才
Feature proposals:
1. When adding an Anki card in Pleco, allow to put examples into a separate field (now: can add examples or not to, but when added they are put into the same field as the definition itself, which can cause inconvenience - e.g. when making a pinyin/zhuyin translation of the example sentence, adding its audio etc).
2. If possible, colorcode entries (now only zhuyin and pinyin can be, see bug section below) via css, not the inline html (inside the field):
like that:
CSS:
.tone1 {color: #c48200;}
.tone2 {color: #009b07;}
.tone3 {color: #ba00ff;}
.tone4 {color: #ff0000;}
.tone5 {color: #858585;}

.nightMode .tone1 {color: #f6ba00;}
.nightMode .tone2 {color: #40d75e;}
.nightMode .tone3 {color: #c380ff;}
.nightMode .tone4 {color: #ff6f6f;}
.nightMode .tone5 {color: #b7b7b7;}
In the field itself it results in something like that:
HTML:
<span class="tone4">碍</span><span class="tone4">事</span>
Possible bug report:
Traditional, Simplified as well as main Hanzi field are not color coded (after creating an Anki card) even when set to inside the Pleco's options.
 
Last edited:

mikelove

皇帝
Staff member
1. When adding an Anki card in Pleco, allow to put examples into a separate field (now: can add examples or not to, but when added they are put into the same field as the definition itself, which can cause inconvenience - e.g. when making a pinyin/zhuyin translation of the example sentence, adding its audio etc).
How would we deal with multiple examples, though? And preserving the sense associations for each example? Dumping a bunch of unstructured or loosely-structured examples into a text field seems like it'd be of limited use.

2. If possible, colorcode entries (now only zhuyin and pinyin can be, see bug section below) via css, not the inline html (inside the field):
like that:
Makes sense. But since we don't currently do anything with model CSS we'd probably have to make this a setting, either we'd stick with the common tone1/2/3/4/5 or we'd let you define a specific class to assign to each tone.

Traditional, Simplified as well as main Hanzi field are not color coded (after creating an Anki card) even when set to inside the Pleco's options.
That's odd, they should be - is anything at all coming through in HTML there?
 

Cameroon

秀才
How would we deal with multiple examples, though? And preserving the sense associations for each example?
Understood. Then how about putting all the definitions to the definition field, and all the examples to the examples field, but before each example put the corresponding meaning (one of multiple definitions which relates to the given sentence). And maybe put it into square brackets or something alike to be clearly recognizable at a glance.
Thus we'll have separate fields for definition(s) and example(s) and won't lose the per-definition specifics of the given example sentences.

That's odd, they should be - is anything at all coming through in HTML there?
No, not any color related HTML in the output code ((
 

mikelove

皇帝
Staff member
Understood. Then how about putting all the definitions to the definition field, and all the examples to the examples field, but before each example put the corresponding meaning (one of multiple definitions which relates to the given sentence). And maybe put it into square brackets or something alike to be clearly recognizable at a glance.
Thus we'll have separate fields for definition(s) and example(s) and won't lose the per-definition specifics of the given example sentences.
So basically we output the definitions without examples in one field and the definitions with them in the other? Would it also work if we just added an option to wrap the examples in some sort of class that you could then mask out in CSS?
 

Cameroon

秀才
So basically we output the definitions without examples in one field and the definitions with them in the other?
Yes, exactly. That would be very neat and transparent. I guess. Some doubling of information will be there (twice putting the same definitions into two fields), but that would be quite reasonable (separating two basically very different categories and preserving their inner interconnections at the same time).
Would it also work if we just added an option to wrap the examples in some sort of class that you could then mask out in CSS?
If the examples are earmarked somehow, I think it would be possible to filter them and then move to another field manually or do with these examples anything else a user might need. Although this way would be more complicated (than just two categories initially separating into two different fields).

So maybe that could be left to a user's choice:
1. Don't add examples at all.
2. Add examples in the same fields where definitions are exported.
3. Same as (2) but also mark examples with a css class.
4. Add examples into a separate field (grouped and preceded by a 'nest' definition when there are several examples to more than one definitions which have differences in meaning).
 

mikelove

皇帝
Staff member
If the examples are earmarked somehow, I think it would be possible to filter them and then move to another field manually or do with these examples anything else a user might need. Although this way would be more complicated (than just two categories initially separating into two different fields).
You could do it all with CSS, I think; on your template you'd bring up the definition field but then in the CSS you'd either hide or show examples. If you wanted to show the definition in one place without them and one place with them you'd invoke the field twice but wrap the definition in some other class for the version that shows examples and then not hide them when they're inside of that other class.
 

Cameroon

秀才
@mikelove
makes sense ;)
Well I'd personally prefer a separate field for examples (I still think that is more straight and gives more order & operability), but I don't embody the majority of Pleco users ))
But, if this variant is worse in terms of development, then I'd be glad for any separation of examples like the CSS method etc.
 

Cameroon

秀才
Yet one thought has just come to my mind:
CSS is quite enough if you just intend to show/hide the examples (by adding 'hint' class or elsehow) but if you want to make some operations to the examples (like converting them simp/trad or to pinyin/bopomofo/ruby, or to color-coded hanzi etc) then anyway you will have to divide definitions/examples into separate fields
 

mikelove

皇帝
Staff member
CSS is quite enough if you just intend to show/hide the examples (by adding 'hint' class or elsehow) but if you want to make some operations to the examples (like converting them simp/trad or to pinyin/bopomofo/ruby, or to color-coded hanzi etc) then anyway you will have to divide definitions/examples into separate fields
Why? It's easy to filter nodes by class in JavaScript.
 

Cameroon

秀才
Why? It's easy to filter nodes by class in JavaScript.
I must admit that it's already two steps beyond my understanding ))
I just wanted to color code those examples in desktop Anki and add zhuyin (also colored) to them via the Chinese support addon. Pleco has popup dictionary so on Android I don't need that, but on desktop it's a shortage.
But hey! I could easily copy defn field to the example one. Hide examples (or even delete them, I'm sure there must be a feasible method for that) in the defn field with the 'hint' control (given that the examples are css-marked by Pleco).
And have all the examples in the appropriate field, transform them as needed.
Some batch editing will be needed but in return I'll have Pleco definitions in my desktop flashcards ))
 

Cameroon

秀才
Finally, as it often occurs, it turned out that Pleco was capable of all the above wishes initially.

If there are two fields in the target Anki notetype, Pleco can send only definition (with no examples) to the e.g. "Definition" field and send the same definition (but this time WITH the examples if there are any) to the e.g. "Examples" field.

(to reach the utmost perfection it's also possible to empty the 'Examples' field should it contain exactly the same text as 'Definition' though (when there's no examples), but ATM I've no idea on howto do this and actually no utter need either).

Maybe that's possible to add a radio-button in Anki card creation settings (beneath the existing 'Add examples' control), like 'Don't export anything if there's no examples'? So to export definitions only to a certain field and try to export definitions+examples to the other (which is already possible in Pleco) and, if no examples are found, export nothing to that second field (neither definition nor examples - which are absent anyway).
Is that possible?
 
Last edited:
Top