Comments (2)
Thanks! I hadn't realized this would be useful, but since you do it's likely others will as well. I'll add this later this week when I catch up on some addon maintenance.
- Cayenne
On Dec 19, 2012, at 6:16 AM, shufps [email protected] wrote:
Hi,
I'm not learning kanji alone but only in vocabulary context. For my learning strategy it's a problem to ristrict the kanji colorizer on a single kanji character.
Here is a small patch which removes the restriction:
kanji_colorizer.py:
102c107
< def kanjiToAdd(note, currentFieldIndex=None):
def addKanji(note, flag=False, currentFieldIndex=None):
104,105c109
< Determines whether and what kanji to add a diagram for, given a note< and possibly the index of a field that was edited
Checks to see if a kanji should be added, and adds it if so.
108c112,113
< return None
return flag
112,113c117,118
< return None< # check that srcField contains a single character
return None
115,119d119
< if not srcTxt:
< return None
< if not len(srcTxt) == 1:
< return None
< return srcTxt
121,133c121,133
< def addKanji(note, flag=False, currentFieldIndex=None):
< '''
< Checks to see if a kanji should be added, and adds it if so.
< '''
< character = kanjiToAdd(note, currentFieldIndex)
< if character == None:
< return flag
< # write to file; anki works in the media directory by default
< filename = kc.get_character_filename(character)
< with open(filename,'w') as file:
< file.write(kc.get_colored_svg(character))
< mw.col.media.addFile(os.path.abspath(filename))< note[dstField] = '
' % filename
dst='' for character in unicode(srcTxt): # if ord(ch) < 19968: # only add kanjis # continue # write to file; anki works in the media directory by default filename = kc.get_character_filename(character) with open(filename,'w') as file: file.write(kc.get_colored_svg(character)) mw.col.media.addFile(os.path.abspath(filename)) dst+='<img src="%s">' % filename note[dstField] = dst
�
Reply to this email directly or view it on GitHub.
from kanji-colorize.
Pull request merged a while ago
from kanji-colorize.
Related Issues (20)
- test fails with missing 0041b.svg
- clean up test setup
- general code cleanup
- investigate bug with generate all new HOT 5
- get the standard library dependencies that aren't included in anki out of the addon
- reorganize for easier development and building
- Hi there, HOT 1
- Note: If you don't have a github account you can also email me at [email protected] HOT 1
- Error with Anki 2.1.28 HOT 2
- configuration option for what characters to diagram in anki
- TypeError when generating new notes
- Option to prevent changing field if something is in it. HOT 2
- Create add-on file for manual installation HOT 3
- Direct SVG inside the Diagram Field HOT 3
- Diagram for 備
- FYI: Generated for two katakana words and got "divdivdiv(correctkatakana)divdiv"
- Stroke Order not working HOT 2
- Request: Bulk-add only to selected cards from browser or manually colorize from card editor (not on tab)
- Request: Update colorized-kanji-contrast.tgz & colorized-kanji-spectrum.tgz based on newest kanjivg data
- Readme Typo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kanji-colorize.