View_Size_Adjust and Incremental_Reading_Extension addons
103 posts by 27 authors
Frank
3/11/13
As suggested, I am adding a topic for a couple of related addons that I've contributed:  The View_Size_Adjust addon and the Incremental_Reading_Extension addon. They are related in that the Incremental Reading Extension is much more useful with the View Size Adjust addon, which provides several functionalities that while generally useful in Anki, are critical to an effective Incremental Reading capability:

  • Adjusting the size of the text when reading longer articles (Ctrl++ or Ctrl+-)
  • Navigation keys for arrow up/down, page up and page down
  • Ability to save the position in an article to support coming back at a later point in time and picking up where you left off (hence the term 'incremental')
  • Ability to highlight text to indicate where cards have already been extracted, or simply to highlight the text if you plan to keep the longer article and read it with highlighted portions.
  • Ability to add custom shortcuts for extracting and adding cards to Anki using specific card models and decks
Most of these capabilities are useful independent of the Incremental Reading concept, so I have View Size Adjust as a separate addon. Arguably, it is poorly named at this point since the majority of functionality is really about navigation and shortcuts, but in order to avoid littering the Anki addon landscape with previously named versions, I kept it the same. 

Latest update added some more customization options to the custom shortcuts:

  • Added ability to specify shortcuts with any combination of Ctrl + Alt + Shift + Key. This includes the ability to set single key shortcuts. This allows the ability to override the default behavior of the 'x' and 'c' shortcuts.
  • Added the 'showEditCurrent' dialog option when creating a new shortcut. This is unchecked by default. It mirrors the original 'x' and 'c' shortcut operation and opens the 'Edit Current' window to allow you to edit the current card while you are also adding another card in the separate 'Add Cards' dialog.
I will try to monitor this thread, but please understand that this is a purely voluntary effort as time permits. Hope that you can get some use out these plugins.

--Frank

2 messages have been deleted.
Frank
3/19/13
New Incremental Reading Extension update includes a NEW Queue-Based Scheduler (independent of SRS scheduling) and Organizer.

Full rewritten explanation of the Incremental Reading Extension below (formatting works better in the forum than in the Anki Addons site). Search for the Scheduler to see what's new. 

Incremental Reading Extension

Incremental Reading is a way to read many articles concurrently and efficiently add spaced repetition cards to Anki in the process. In essence, you add reading material to an Incremental Reading deck in Anki and read it as time permits. As you read, you can highlight important passages and extract them into separate cards in Anki, either for further refinement, or as final SRS cards in another Anki deck. When you have finished reading an article, you will have incorporated all the important knowledge into your Anki deck(s) and can delete it, confident that the knowledge will be continually reinforced by Anki’s core SRS function.

Example using Add Cards Shortcut defined to create a new card in Incremental Reading 2 deck with IRead2 model and using yellow highlight to mark the extracted text in the original article.


The Incremental Reading Extension addon relies on the View Size Adjust addon for several important navigation and keyboard shortcut capabilities. Be sure to add both addons before you begin.

NOTE on UPGRADING:  This version changes the IRead2 model. Changing the model will require you to modify your existing IRead2 cards (removing little used Model and Deck fields, adding Title) or delete the IRead2 model and all associated cards before installing the upgrade.

NOTE on the original Incremental Reading addon:   The Incremental Reading Extension addon is a fork (an alternative) of the original Incremental Reading addon. Do not attempt to install both concurrently.


Features 

The Incremental Reading Extension, along with the View Size Adjust addon, supports incremental reading in Anki with the following features:

·      Keyboard navigation

o   PgUp, PgDn, ArrowUp, ArrowDown

o   Also available from the Edit menu

·      Keeping track of where you left off in each article

o   Scroll to last viewed text when the card is loaded

o   Uses same ‘zoom factor’ you last used for the same card

·      Adjust the size of the text as needed

o   Ctrl-- to increase text size

o   Ctrl-- to decrease text size

o   Saves selected size with each card and reapplies when shown

o   Also available from the Edit menu

·      Highlighting of text

o   Select and hit ‘h’

o   Custom colors (Hit Alt-2 to open a dialog. Also available from Edit menu)

o   Anti-highlighting option (color text, rather than background)

·      Custom keyboard shortcuts for adding cards efficiently

o   Alt-1 to create a custom shortcut

o   Choose deck, card model, shortcut key combination, highlighting, field into which to paste selected text, and to whether or not you want to see the add/edit dialogs.

o   Automatically copies Tags from source Incremental Reading card to the new card created using the keyboard shortcut.

o   Automatically copies Source field from Incremental Reading card to the new card created using the keyboard shortcut (if new card model has a Source field).

o   Shortcuts are added to the Edit menu as they are created.

o   Removing a shortcut is done by disabling it using the same dialog. Hit Alt-1, choose the same key combination and uncheck ‘Enabled’ checkbox.

·      (NEW) Independent scheduling algorithm more suitable to Incremental Reading

o   Queue depth based, rather than time-based

o   Configurable ‘Soon’ and ‘Later’ scheduling buttons. Dialog for editing these options is available in the Tools menu (‘Incremental Reading Scheduler Options’). Options include:

§  Push a card to a specific depth (count or position) in the queue

§  Push a card to a percentage depth into the queue

§  Apply randomness to either approach

o   Custom organizer dialog.

§  Move any card to any position in the queue

§  Bulk moves

§  Opened from Tools menu (‘Incremental Reading Organizer’).

§  Also opened from ‘custom’ answer button when working with Incremental Reading cards in the Anki Reviewer.

 

To Show Editor or Not to Show Editor

A couple of options on the Add Shortcut dialog (Alt-1) require explanation:

Show Add Cards dialog – This checkbox is checked by default. When you invoke the keyboard shortcut, the Add Cards dialog will be opened as it normally is when you add cards in Anki. It will be prepopulated with the Deck and Card Model you’ve chosen. If this checkbox is unchecked, the shortcut will add the card automatically without opening the Add Cards dialog. This is a convenience for incremental reading where a frequent activity is creating smaller, but still large, extracts from a source article and feeding those back into the Incremental Reading deck. The shortcut takes care of populating all fields with reasonable values in that case, making opening the dialog inconvenient (because you then have to close it).

Show Edit Current dialog – The original Incremental Reading addon opened two dialogs every time you attempted to add a new card. First it opened the Edit Current dialog, which contains the same card you were just looking at, but in editing mode. Second it opened the Add Cards dialog that you would normally expect. The advantage to this option is that you can delete the text from the original article as you do extracts, rather than highlighting. Personally, I prefer highlighting and deleting the entire original article at the end when I’m done with it.


Scheduling Algorithm for Incremental Reading

Anki’s normal scheduling algorithm is designed to support Spaced Repetition and address the “forgetting curve.” It makes very little sense to try to schedule reading material using the “forgetting curve” and its increasing intervals. Instead, incremental reading is really a matter of prioritizing a large number of articles based on your interest level and the importance you place on each article. Accordingly, a different scheduling algorithm is required.

For incremental reading, the goal is to manage a queue of articles and to be able to reprioritize each article every time you read it. It should also be possible to find an article you want to see, no matter where it is in the queue, and bring it forward. And periodically, you may want to review the entire queue and organize it in a specific way.

The scheduling algorithm attempts to meet the above goals without interfering with Anki’s normal scheduler or dramatically changing the Anki interface. To do so, it effectively removes the Incremental Reading cards from the Anki scheduler and keeps all the incremental reading cards permanently in the NEW queue. This keeps all Incremental Reading cards available all the time (not hidden away in a REVIEW queue to be shown again in a few days, weeks or months).

An incremental reading card will always have three buttons labeled ‘Soon’, ‘Later’ and ‘Custom’.  The meaning of ‘Soon’ and ‘Later’ is configurable, but essentially means ‘This is important and I want to see it again Soon’ or ‘This is less important, don’t show it to me again until Later.’  If, despite configuration, you don’t get the behavior you want, or if you want to handle a card specially, there is the ‘Custom’ button, which opens the Organizer dialog to let you put that card wherever you want in the queue.

Configuration of the ‘Soon’ and ‘Later’ scheduling options is available from the Tools -> Incremental Reading Scheduler Options menu item. Options include:

·      Position – Treat the configured value as a simple position number.

·      Percent – Treat the configured value as a percentage value

·      Random – Apply some randomness to the placement of the item using the configured count or percentage value.

·      Value – The numeric value. It represents either a count or a percentage.

Position vs Percent

If you choose Position and don’t apply Random, then hitting the button in question will directly place the card at the position you indicated. If you apply Random, it will place the card at a random position between 1 and the Position you indicated.

If you choose Percent and don’t apply Random, then hitting the button in question will calculate the position as a percentage of the queue depth and place the card at that position. If you apply Random, it will place the card at a random position between 1 and the calculated position by percentage.

The above explanations apply for the ‘Soon’ button. The ‘Later’ button differs only in that the placement of the card will be between the Position or Percentage given for ‘Soon’ and the Position or Percentage given for ‘Later’. Thus, if you specify 10 Percent for ‘Soon’ and 50 Percent for ‘Later’, the ‘Later’ button will place the card at a position between 10 and 50 percent into the queue.

Organizer 

The Organizer is a dialog that shows a list of all the cards in the Incremental Reading deck. It can be accessed from the Tools menu. 

There is a checkbox next to each card that can be used to select an individual card or many cards and move them up or down in the queue.  To move a card up, check the box next to that card and click the ‘Up’ button. To move a card down, click the ‘Down’ button. If multiple cards are checked, they move up or down together.

If a selected card cannot be moved up because it has hit the top of the queue or because the card above it is also selected, it will not be moved. Cards selected below it can move up until all selected cards make a contiguous block. The same applies for moving cards down alone or in bulk.

The ‘Pin Top/Bottom’ checkbox at the top locks the top-most (or bottom-most) item in place while ‘Up’ or ‘Down’ are clicked to move other selected items, allowing you to ‘anchor’ a block of selected items anywhere in the queue.

The Card Position field at the top of the Organizer allows you to specify a position to directly move the top-most selected item to. If multiple items are selected, they move up or down together.

 

Compatibility and Upgrading

Update your View Size Adjust addon. You need the most recent of both the Incremental Reading Extension addon and the View Size Adjust addon.

IRead2 Card Model has changed.

·      Removed Model and Deck fields.  The original IRead2 card has Model and Deck fields that were needed by the predecessor Incremental Reading addon. With the custom shortcuts approach used by Incremental Reading Extension, they are no longer needed. Accordingly, they have been removed.

·      Added ‘Title’ field. Using the Organizer requires you to be able to identify each card sufficiently to be able to prioritize it in the queue. Adding a ‘Title’ field makes that possible.

Changing the IRead2 model means that for those of you who are upgrading, there is a little work. Here are the options for doing the upgrade.

Option 1 – Delete the IRead2 card model before applying the new addons. This will delete all IRead2 cards in your collections. The addons will create the new IRead2 card model when installed.

Option 2 – Modify the IRead2 model before updating the addon.

·      Delete the Anki Deck field and the Model field. Anki will warn you that it will be modifying your collection in a way that makes it incompatible with the copy in the cloud or on other devices. You will need to do a full sync afterwards.

·      Add the Title field and position it as the first field in the model. Also check the radio button that says to use that field for sorting in the Browser. 

- show quoted text -
tmbb
3/19/13
This "extension" of yours is getting pretty serious... Do you want to "take over" the name "incremental Reading"?
I'll not be developping it anymore, and since your version is much better than mine, there is no reason for mine to continue to exist.

Should I erase my addon so that you can upload the code under that name?
- show quoted text -
Frank
3/19/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
Tiago? 

Yes, it has gotten pretty involved, but hopefully not a lot more is needed. A different way to schedule material was the big gap for me. 

To your offer to consolidate under one title, I think it would save confusion. I worry slightly that some folks might be annoyed, because there are apparently quite a few downloads of the original still happening. However, I believe I have made it possible to replicate exactly the behavior of the original if that's what they want, so it probably isn't really a problem.

Just FYI -- I would never have started this or gotten as far without your original. This is my first Python project (though I've been programming for many years). Thanks for the leg up. 

- show quoted text -
- show quoted text -
- show quoted text -
--
You received this message because you are subscribed to a topic in the Google Groups "Anki Add-ons" group.
Visit this group at http://groups.google.com/group/anki-addons?hl=en.
 
 

This message has been deleted.
Frank
3/21/13
Yes. It examines the currently selected deck to determine if it contains IRead2 cards, since Incremental Reading scheduling and organization should not be applied to regular SRS. That would really mess with SRS behaviors and statistics. 

On Tuesday, March 19, 2013, Jay Dugger wrote:
Frank:

Thank you for reworking the scheduler. 

An error message appears when I try to open the Incremental Reading Organizer: "Please select an Incremental Reading deck." I've a deck open with cards of type other than IRead2. I assume that's the source of the error. Does that seem right to you?

--
You received this message because you are subscribed to a topic in the Google Groups "Anki Add-ons" group.
Visit this group at http://groups.google.com/group/anki-addons?hl=en.
 
 
Aleksej
3/29/13
I've installed the add-ons yesterday.  Bugs (#3 is dataloss):

1. The Alt+1 window's values are not retained.
2. The Alt+1 window's "Paste Text to Field" drop-down shows fields of
the last note type in the alphabetical list of note types.  That's not
IRead2.
3. I've created an IRead2 card yesterday, but deleted it.  Today, at
some point, shutting Anki down started to crash it, so the reviews are
lost every time.  Creating an IRead2 card didn't help.

$ anki
Traceback (most recent call last):
  File "/usr/share/anki/aqt/main.py", line 607, in closeEvent
    self.onClose()
  File "/usr/share/anki/aqt/main.py", line 613, in onClose
    self.unloadProfile(browser=False)
  File "/usr/share/anki/aqt/main.py", line 234, in unloadProfile
    runHook("unloadProfile")
  File "/usr/share/anki/anki/hooks.py", line 26, in runHook
    func(*args)
  File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
104, in savePluginData
    self.ir2data =
{'zoomAndScroll':self.zoomAndScroll,'highlightColor':self.highlightColor,'doHighlightFont':self.doHighlightFont,'schedIROptions':self.schedIROptions}
AttributeError: 'IRead2' object has no attribute 'doHighlightFont'

Arthur Chen
4/3/13
I'm getting errors with switching profiles.
When switching profiles:
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.main", line 234, in unloadProfile
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/anki.hooks", line 26, in runHook
  File "C:\Users\Art\Documents\Anki\addons\Incremental_Reading_Extension.py", line 104, in savePluginData
    self.ir2data = {'zoomAndScroll':self.zoomAndScroll,'highlightColor':self.highlightColor,'doHighlightFont':self.doHighlightFont,'schedIROptions':self.schedIROptions}
AttributeError: 'IRead2' object has no attribute 'doHighlightFont'

When using Check Database:
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.main", line 843, in onCheckDB
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.main", line 376, in reset
  File "C:\cygwin\home\dae\win\build\pyi.win32\anki\outPYZ1.pyz/aqt.main", line 329, in moveToState
AttributeError: 'AnkiQt' object has no attribute '_profileManagerState'
- show quoted text -
Frank
4/3/13
Sorry you are having issues. 

1. Yes, the previously selected values are not retained. It's a convenience I intended eventually to address, but it was not as critical as other things since creating shortcuts should be a fairly infrequent activity and selecting new values on those few occasions shouldn't be too much trouble. However, I will look to address that.
2. The 'Paste Text to Field' drop down shows the fields of the model indicated in the model drop down. Per your point No. 1, when the dialog loads, it will most likely not be showing IRead2 as the selected Model, even if that was the last one you used. However, when you select IRead2, it should update the 'Paste to' dropdown values to reflect the fields of the IRead2 model. 
3.  I will post a fix for the error you mentioned momentarily.  
- show quoted text -
Frank
4/3/13
This is similar to the error reported by Aleksej. I will post a fix momentarily. 
- show quoted text -
Aleksej
4/3/13
2. It does not update, and here is what appears in the console when the
window opens:

JS error on line 126: SyntaxError: Parse error
JS error on line 0: ReferenceError: Can't find variable: setFieldsForModel


Also, because of this it is not really clear what the deck is target
for; I had thought that you could define multiple Alt+n shortcuts for
different target decks, to make final cards, which are not IRead anymore.


A smaller issue with the window:
The drop-down lists are not easy to use with a very big number of
entries (subdecks in my case).  I can only click them, and while
holding, press the first letter of an entry, which scrolls the list so
that the first entry with that first letter is at the bottom.  The list
cannot be overviewed using only keyboard or without holding the click.


3. Thanks, it didn't crash right away.
- show quoted text -
> --
> You received this message because you are subscribed to the Google
- show quoted text -
Frank
4/3/13
You are correct that the idea is you can create multiple shortcuts to target different decks and models. 

I have seen that behavior with the window not remaining open unless you hold the click. It is not consistent, though, and only happens rarely for me. That is probably something to do with the Qt web kit and there might be little I can do about it. I will look into adding keyboard navigation of the list, which might have the side effect of keeping that drop down open. 

Regarding the error that is keeping it from updating the 'Paste To' drop down, I'm guessing that it must have something to do with the values it is trying to populate (ie. your model or field names), since I don't have the same error. I tested with a few special characters in the field names (e.g. @&<>!#%*^~') and found that the use of the single quote (or apostrophe) causes this same error. It may not be the only character that could cause the issue. I will see if I can escape it, but in the meantime you might take a look for the use of quotes or other special characters in field names and rename the field. 
- show quoted text -
Aleksej
4/3/13
I couldn't identify any model names with characters "worse" than /?(чá.
 So maybe a field.  I have over 90 models...
- show quoted text -
>     <http://groups.google.com/group/anki-addons?hl=en>.
- show quoted text -
Aleksej
4/3/13
Found the field with an apostrophe ("Y'all" for a verb note type).  Now
it should work.  Thanks.
- show quoted text -
Frank
4/4/13
I uploaded a new version of View Size Adjust addon that escapes the special characters in the field names of the Add Cards Shortcut dialog (Alt + 1). Also added persistence of the selected drop down values for decks, models and fields, and the various checkboxes and radio buttons. 
- show quoted text -
Aleksej
4/4/13
Now Alt+1 leads to an error:

Traceback (most recent call last):
  File "/home/fca/Anki/addons/View_Size_Adjust.py", line 321, in
showAddCardQuickKeysDialog
    javascript += "var pasteToFieldValue = '" +
self.lastDialogQuickKey.get('fieldName', '') + "';\n";
TypeError: cannot concatenate 'str' and 'NoneType' objects
- show quoted text -
Aleksej
4/4/13
Wrapping the self.lastDialogQuickKey.get('fieldName', '') in "str()"
seems to fix it.

Accessibility: the window's width and height are about 55% of what it
needs, at least with my font (DejaVu Sans size 15, Bold in qtconfit-qt4,
Book in GTK).
- show quoted text -
Aleksej
4/5/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
I want to start IR with the manual for the add-ons.  I've added the
images from it, and encountered a problem: when IRE adds yellow
highlighting to a card, the "+" signs in the image names become %-escaped.

I am looking for good ways to make cards from web pages.  The biggest
question with most of them is whether and how to copy formatting.  The
manual is one of those pages.
Did you use MS Office to write the manual?  The HTML code contains some
uses of CSS (non-semantic and thus seemingly bigger than needed) with
mentions of it.  That doesn't affect the resulting view, but maybe the
code will be more readable if you use something like Markdown or
ReStructuredText.
Frank
4/5/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
If by "the manual", you mean the first entry in this forum post, then yes, I used MS Word. It never occurred to me that anyone would attempt to paste that content into Anki, but I can see why it could cause issues. MS HTML is awful. In my experience, most content added to Anki from web pages is entered smoothly and there are no issues.
- show quoted text -
Aleksej
4/5/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
Sorry, I was writing that at night and without good thinking.

1. Yes, that manual.

2. The issue of MS HTML is that the code is not readable.

3. By "Markdown or ReStructuredText" I meant to say "an editor that uses
a simpler markup language".
* The editor I took the language names from (but haven't used before) is
ReText <http://sourceforge.net/p/retext/>; a screenshot
<http://sourceforge.net/p/retext/screenshot/retext-kde.png> — on the
left is the editor, on the right is the auto-updated preview; there is
no information on whether it works on Windows.
* Another editor, which is WYSIWYG and according to the FAQ runs also on
Windows, is a desktop wiki called Zim (the site says it was written in
it): http://www.zim-wiki.org/

4. The real issue is what happens to the image names (%-encoding).  It
doesn't happen with manual editing.


5. Yes, entering HTML code from web pages works, of course.  Only some
articles like "sleep.htm" at supermemo.com are too long to be used in
Anki without splitting.  Also, images do not get included by copying the
code.

But I would like to be able to copy links to paste into my browser.
Anki and the browser are running from different accounts, and I don't
really want to connect them.  But maybe link copying could be added to Anki.
- show quoted text -
Soren Bjornstad
4/5/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
"It is written in Python using Qt libraries, able to run on any platforms."

There doesn't appear to be a Windows installer, though, so you'd have to use the source package (no compiling necessary, though).


- show quoted text -
- show quoted text -
- show quoted text -
--
You received this message because you are subscribed to the Google Groups "Anki Add-ons" group.
Visit this group at http://groups.google.com/group/anki-addons?hl=en.



Aleksej
4/7/13
Thanks, that's better.

"Incremental Reading Scheduler Options" also suffers this.
- show quoted text -
Aleksej
4/7/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
1. I've renamed the files to use %, and then the %s were encoded.

2. IR Organizer does not open if a title contains non-ASCII text:

Traceback (most recent call last):
  File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
375, in callIRSchedulerDialog
    self.showIRSchedulerDialog(None);
  File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
389, in showIRSchedulerDialog
    cardDataList = self.getCardDataList(deckID, cardID);
  File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
683, in getCardDataList
    if(note.model()['name'] == 'IRead2'): cardData['title'] =
str(note['Title'])[:64].encode('string_escape');
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0430' in
position 25: ordinal not in range(128)
- show quoted text -
Aleksej
4/15/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
This seems to fix it.  There is still a problem that the 64 characters
include any HTML formatting.

=================================
diff --git a/Incremental_Reading_Extension.py
b/Incremental_Reading_Extension.py
index 4242ced..d7323dd 100644
--- a/Incremental_Reading_Extension.py
+++ b/Incremental_Reading_Extension.py
@@ -680,7 +680,9 @@ class IRead2(object):
                 cardData['nid'] = nid;
                 note = mw.col.getNote(nid);

-                if(note.model()['name'] == 'IRead2'): cardData['title']
= str(note['Title'])[:64].encode('string_escape');
+                if(note.model()['name'] == 'IRead2'):
+                    cardData['title'] = (note['Title'][:64].encode('ascii',
+
errors='xmlcharrefreplace')).encode('string_escape')
                 else: cardData['title'] = 'No Title';
                 #cardData['title'] = 'No Title';
================================

On 2013-04-07 00:18, Aleksej wrote:
> 2. IR Organizer does not open if a title contains non-ASCII text:
>
> Traceback (most recent call last):
>   File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
> 375, in callIRSchedulerDialog
>     self.showIRSchedulerDialog(None);
>   File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
> 389, in showIRSchedulerDialog
>     cardDataList = self.getCardDataList(deckID, cardID);
>   File "/home/fca/Anki/addons/Incremental_Reading_Extension.py", line
> 683, in getCardDataList
>     if(note.model()['name'] == 'IRead2'): cardData['title'] =
> str(note['Title'])[:64].encode('string_escape');
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u0430' in
> position 25: ordinal not in range(128)
Aleksej
4/20/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
Hi Frank.  If you have time, please add the/a fix to the official
version.  This issue complicates non-English use a lot if you need the
Organizer.
- show quoted text -
Aleksej
4/25/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
The .dat files stored in collection.media are found by Anki to be
"unused media", so Anki deletes them as such.
Aleksej
4/28/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
A workaround: add "_" prefix to the file names.
- show quoted text -
Ryan Moore
5/13/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
Sorry if this is a silly question, but I am wondering how you are adding html into the Text field. Whenever I try to add a webpage's source, the card will just show the html code and not the formatted output.

Thanks

On Friday, April 5, 2013 6:45:15 AM UTC-4, Aleksej wrote:
Sorry, I was writing that at night and without good thinking.

1. Yes, that manual.

2. The issue of MS HTML is that the code is not readable.

3. By "Markdown or ReStructuredText" I meant to say "an editor that uses
a simpler markup language".
* The editor I took the language names from (but haven't used before) is
ReText <http://sourceforge.net/p/retext/>; a screenshot
<http://sourceforge.net/p/retext/screenshot/retext-kde.png> — on the
left is the editor, on the right is the auto-updated preview; there is
no information on whether it works on Windows.
* Another editor, which is WYSIWYG and according to the FAQ runs also on
Windows, is a desktop wiki called Zim (the site says it was written in
it): http://www.zim-wiki.org/

4. The real issue is what happens to the image names (%-encoding).  It
doesn't happen with manual editing.


5. Yes, entering HTML code from web pages works, of course.  Only some
articles like "sleep.htm" at supermemo.com are too long to be used in
Anki without splitting.  Also, images do not get included by copying the
code.

But I would like to be able to copy links to paste into my browser.
Anki and the browser are running from different accounts, and I don't
really want to connect them.  But maybe link copying could be added to Anki.


On 2013-04-05 06:03, Frank wrote:
> If by "the manual", you mean the first entry in this forum post, then yes,
> I used MS Word. It never occurred to me that anyone would attempt to paste
> that content into Anki, but I can see why it could cause issues. MS HTML is
> awful. In my experience, most content added to Anki from web pages is
> entered smoothly and there are no issues.
>
> On Thursday, April 4, 2013 5:12:18 PM UTC-5, Aleksej wrote:
>>
>> I want to start IR with the manual for the add-ons.  I've added the
>> images from it, and encountered a problem: when IRE adds yellow
>> highlighting to a card, the "+" signs in the image names become %-escaped.
>>
>> I am looking for good ways to make cards from web pages.  The biggest
>> question with most of them is whether and how to copy formatting.  The
>> manual is one of those pages.
>> Did you use MS Office to write the manual?  The HTML code contains some
>> uses of CSS (non-semantic and thus seemingly bigger than needed) with
>> mentions of it.  That doesn't affect the resulting view, but maybe the
>> code will be more readable if you use something like Markdown or
>> ReStructuredText.
>>
>

Aleksej
5/13/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
Ctrl+Shift+X (or an item of the drop-down menu from the toolbar) —
<http://ankisrs.net/docs/manual.html#features>.
- show quoted text -
>     articles like "sleep.htm" at supermemo.com <http://supermemo.com>
- show quoted text -
> --
> You received this message because you are subscribed to the Google
> Groups "Anki Add-ons" group.
> Visit this group at http://groups.google.com/group/anki-addons?hl=en.
>  
>  

Ryan Moore
5/21/13
Error after adding a new card to the deck....

An error occurred in an add-on. Please contact the add-on author.

Traceback (most recent call last):
  File "/Users/ryanmoore/Documents/Anki/addons/Incremental_Reading_Extension.py", line 375, in callIRSchedulerDialog
    self.showIRSchedulerDialog(None);
  File "/Users/ryanmoore/Documents/Anki/addons/Incremental_Reading_Extension.py", line 389, in showIRSchedulerDialog
    cardDataList = self.getCardDataList(deckID, cardID);
  File "/Users/ryanmoore/Documents/Anki/addons/Incremental_Reading_Extension.py", line 683, in getCardDataList
    if(note.model()['name'] == 'IRead2'): cardData['title'] = str(note['Title'])[:64].encode('string_escape');
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 193: ordinal not in range(128)


I had a couple of papers imported into my Incremental Reading deck and when I used the keyboard shortcut to add a new card from a line in the paper and got the above error. I'm not sure how Anki does its character encoding by default, so any help would be appreciated.

Thanks.
Aleksej
5/21/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
I suppose it happens when you open the organizer.  This patch I posted
here on 2013-04-15 fixes it:


diff --git a/Incremental_Reading_Extension.py
b/Incremental_Reading_Extension.py
index 4242ced..d7323dd 100644
--- a/Incremental_Reading_Extension.py
+++ b/Incremental_Reading_Extension.py
@@ -680,7 +680,9 @@ class IRead2(object):
cardData['nid'] = nid;
note = mw.col.getNote(nid);

- if(note.model()['name'] == 'IRead2'): cardData['title'] =
str(note['Title'])[:64].encode('string_escape');
+ if(note.model()['name'] == 'IRead2'):
+ cardData['title'] = (note['Title'][:64].encode('ascii',
+ errors='xmlcharrefreplace')).encode('string_escape')
else: cardData['title'] = 'No Title';
#cardData['title'] = 'No Title';



- show quoted text -
Ryan Moore
5/21/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
I'm not sure how to use what you have here to fix the plugin. Should I just delete the add-on and redownload, or add part of it to the source?

Thanks
- show quoted text -
Aleksej
5/21/13
Re: [anki-addons] Re: View_Size_Adjust and Incremental_Reading_Extension addons
Other recipients:
The proper way to apply the patch is using the "patch" program, or
something like git (which is used for Anki).  The lines starting with
"-" show what to remove, and those starting with "+" show what to add.

Actually, the patch should look like this (I copied it from my comment
at https://ankiweb.net/shared/info/2880922486 , where it had lost
formatting...):

=================================
diff --git a/Incremental_Reading_Extension.py
b/Incremental_Reading_Extension.py
index 4242ced..d7323dd 100644
--- a/Incremental_Reading_Extension.py
+++ b/Incremental_Reading_Extension.py
@@ -680,7 +680,9 @@ class IRead2(object):
                 cardData['nid'] = nid;
                 note = mw.col.getNote(nid);

-                if(note.model()['name'] == 'IRead2'): cardData['title']
= str(note['Title'])[:64].encode('string_escape');
+                if(note.model()['name'] == 'IRead2'):
+                    cardData['title'] = (note['Title'][:64].encode('ascii',
+
errors='xmlcharrefreplace')).encode('string_escape')
                 else: cardData['title'] = 'No Title';
                 #cardData['title'] = 'No Title';
================================
- show quoted text -
- show quoted text -
Aleksej