-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate zhuyin (bopomofo) #5
Conversation
- Correct 'posibilities' to 'possibilities' - Correct 'tradicional' to 'traditional' - Add additional element classes to allow show/hide styling - Add fallback fonts to CSS
Hi @ribbanya, I like a lot what you have done, correcting misspellings and improving the CSS. I only have two small comments: I like to type annotate all functions, so that mypy is able to show me errors before running code (if you don't know mypy, I recommend you to check it out); and, I would like to replace the I am inclined for option 2 too. Preferably, everything should be packed in a single file and the user should be able to tweak as they please. Adding a few KB to your phone/PC for support on both pinyin and bomopofo shouldn't be a restriction. I don't understand completely what you mean with option 4, but go for it. I'll let you know once you have the code whether I accept it or not XD. Once, you are done with it I'll be happy to integrate everything and upload it to ankiweb. Now that I think about it, I'll add a list of collaborators in the description. It's bunkers that people actually use this and like it. Thanks for your effort. |
No problem; I'm used to typed languages anyway so I prefer to as well. I was a bit lazy with this implementation.
I actually only did this because I saw it in the original codebase. I can change them all to
Yeah. CSS isn't very user-friendly, but as far as I know there's not a better way to do it without writing an entire extension.
Sorry for the weird wording. I just meant pinyin and zhuyin being presented together by default. That's how the deck looks in the current pull request. I'll take a look at how |
- Add type hints - Replace exits with Exceptions - Remove commented code - Rename functions to have spaces where appropriate - 'repinyin' -> 'py_re' to match 'zy_re'
- Separate words in CSS selectors with hyphens - Delete commented code - 'writting' -> 'writing'
- Consolidate all CSS into one stylesheet - Correct underscores in selectors to hyphens - Move Persistence code to its own file - Move common functions to their own file - Wrap checking for Persistence in a common function - Generate requirements.txt using pip-tools (requirements.in)
Okay, I did some code cleanup as well as some restructuring. JS and CSS now live in their own files, and are inlined into the HTML templates at generation time. Please let me know if you don't like it. |
@helq Could you explain this? It obviously works but I do not understand it at all. Anki's handlebars swaps in the field, which looks something like
so the final Javascript (I guess?) looks something like posibilities = getElems( function EOL() {/*EOL [sound:fen1_1.mp3] MOS fen1 MOS ㄈㄣˉ MOS [fən] EOL
[sound:sheng1_1.mp3] MOS sheng1 MOS ㄕㄥˉ MOS [ʂəŋ] EOL
[sound:ga1_3.mp3] MOS ga1 MOS ㄍㄚˉ MOS [kɑ] EOL
[sound:an1_1.mp3] MOS an1 MOS ㄢˉ MOS [an] EOL
[sound:lao1_6.mp3] MOS lao1 MOS ㄌㄠˉ MOS [lɑʊ̯] EOL
[sound:xie1_5.mp3] MOS xie1 MOS ㄒㄧㄝˉ MOS [ɕiɛ] EOL EOL*/} ); ... and then |
- Change '#the-card' to '#root' - Always use Persistence.getItem(key) instead of just getItem() - Fix broken getElems references - Merge most front-side code into one common function - Clean up other front-side code
Turns out For now the code should be in a mergeable state. Some of the styling could use some work, though. |
Wow! Thanks a lot for all your effort.
Lol. Yeah, I'm not that consistent. I mostly wrote this as a script for myself. I never thought anybody would care to look at it. I was so wrong. I'll check whether everything works on my end, in Anki desktop and in AnkiDroid. I'll accept it afterwards. You'll have to give me a week though. I am at the of the end of the semester and I have a lot of projects to finish. Thanks again for all the amazing work! I hope those improvements help the deck to reach even more people. Chinese is hard, coding is hard, finding free tools is hard. Fortunately there is kind people like you. Best, |
No problem. I have more ideas for improvements (that I want to have in the deck for myself anyway) but I'm also pretty busy this week. I'll put them in a new pull request when I get around to them, but this one and #7 are ready to be reviewed. |
Hey @ribbanya, I finally got to it. Sorry for the very long wait. I tested it in Anki desktop and it worked like charm. I hope it does too in AnkiDroid and iOS. (Grad school is very time consuming :S.) I also updated the README. Thanks a lot |
Hello. I think this deck is amazing, but I don't like pinyin very much so I added zhuyin to it.
Currently, input checking of
{{type:Zhuyin}}
is not supported, but I would like to implement it. First, however, I wanted to discuss how to integrate these changes, as there are many ways.Possibilities include:
display
CSS propertiesapkg
Personally, I would prefer something closer to (2) or (4), but I am of course open to discussion.