Skip to content

Commit

Permalink
Remove Typing dependency, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chris360KS committed Jan 8, 2020
1 parent 9b4cf24 commit b655fa7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 87 deletions.
96 changes: 34 additions & 62 deletions README.html
Original file line number Diff line number Diff line change
@@ -1,89 +1,61 @@
<!--readme file for the AnkiWeb page-->
<b>AnkiWikiPopup</b>

<p>Anki 2.1 addon to display Wikipedia page previews inside of <a href="https://apps.ankiweb.net/">Anki</a>.</p>
Anki 2.1 addon to display Wikipedia page previews inside of <a href="https://apps.ankiweb.net/">Anki</a>.

<p>Shows a popup of the Mobile Wikipedia page / Extract for the selected text. In order to avoid conflicts with the
Popup-Dictionary addon, this addon only supports keyboard shortcuts (Control-Shift-W) for now. </p>
Shows a popup of the Mobile Wikipedia page / Extract for the selected text. In order to avoid conflicts with the
Popup-Dictionary addon, this addon only supports keyboard shortcuts <b>(Control-Shift-W)</b> for now.

<b>Modes:</b>
Mobile (default)
<img src="https://raw.githubusercontent.com/cfculhane/AnkiPopupWikipedia/master/docs/content_mobile.png" alt=""/>

<p>| Mobile (default) | Extract (shorter, faster to load) |
<img src="docs/content_mobile.png" alt="docs/content_extract.png"/> | <img src="docs/content_extract.png"
alt="docs/content_extract.png"/>
</p>
Extract (shorter, faster to load)
<img src="https://raw.githubusercontent.com/cfculhane/AnkiPopupWikipedia/master/docs/content_extract.png" alt=""/>

<b> Features </b>

<ul>
<li>Popup of either full mobile pages, or shorter extracts</li>

<li>page caching to speed up repeated searches</li>

<li>Full HTML popups with</li>
- Popup of either full mobile pages, or shorter extracts
- page caching to speed up repeated searches
- Full HTML popups with images
</ul>

<p>This is currently in beta stage - things will almost certainly break! Please submit a bug report if it does.</p>

<h3 id="installation">Installation</h3>

<h4 id="ankiweb">AnkiWeb</h4>

<p>The easiest way to install Pop-up Dictionary is through <a href="https://ankiweb.net/shared/info/">AnkiWeb</a>.</p>

<h4 id="manualinstallation">Manual installation</h4>
This is currently in beta stage - things will almost certainly break! Please submit a bug report if it does.

<ol>
<li>Make sure you have the <a href="https://apps.ankiweb.net/#download">latest version</a> of Anki 2.1 installed.
Earlier releases (e.g. found in various Linux distros) do not support <code>.ankiaddon</code> packages.
</li>
<b>Installation</b>

<li>Download the latest <code>.ankiaddon</code> package from the <a
href="https://github.com/glutanimate/popup-dictionary/releases">releases tab</a> (you might need to click on
<em>Assets</em> below the description to reveal the download links)
</li>
The easiest way to install Pop-up Dictionary is through <a href="https://ankiweb.net/shared/info/">AnkiWeb</a>.

<li>From Anki's main window, head to <em>Tools</em><em>Add-ons</em></li>
<b>License and Credits</b>

<li>Drag-and-drop the <code>.ankiaddon</code> package onto the add-ons list</li>
Significant portions of the code (as marked in the source files)
were based on the Anki add-on <a href="https://github.com/glutanimate/popup-dictionary/">Pop-up Dictionary</a> by
Glutanimate. <a href="https://glutanimate.com/support-my-work/">Click here to support Glutanimate's work</a>.

<li>Restart Anki</li>
</ol>
I would also like to thank the team at <a href="https://www.amboss.com/">AMBOSS</a> for their encouragment and
inspiration for this work. Some css and js code was taken from their <a
href="https://www.amboss.com/us/anki-amboss?hp=header">extremely good Anki Addon</a>.

<h3 id="licenseandcredits">License and Credits</h3>

<p>Significant portions of the code (as marked in the source files)
were based on the Anki add-on <a href="https://github.com/glutanimate/popup-dictionary/">Pop-up Dictionary</a> by
Glutanimate. <a href="https://glutanimate.com/support-my-work/">Click here to support Glutanimate's work</a>.</p>

<p>I would also like to thank the team at <a href="https://www.amboss.com/">AMBOSS</a> for their encouragment and
insipration for this work. Some css and js code was taken from their <a
href="https://www.amboss.com/us/anki-amboss?hp=header">extremely good Anki Addon</a>.</p>

<p>Ships with the following javascript libraries:</p>
Ships with the following javascript libraries:

<ul>
<li>jQuery (v1.12.4), (c) jQuery Foundation, licensed under the MIT license</li>

<li>qTip2 (v2.1.1), (c) 2011-2018 Craig Michael Thompson, licensed under the MIT license</li>

<li>imagesLoaded (v4.1.4) (c) David DeSandro, licensed under the MIT license</li>
- jQuery (v1.12.4), (c) jQuery Foundation, licensed under the MIT license
- qTip2 (v2.1.1), (c) 2011-2018 Craig Michael Thompson, licensed under the MIT license
- imagesLoaded (v4.1.4) (c) David DeSandro, licensed under the MIT license
</ul>

<p>PopupWikipedia is free and open-source software. The add-on code that runs within Anki is released under the GNU
AGPLv3 license. For more information please see the <a
href="https://github.com/cfculhane/AnkiPopupWikipedia/blob/master/LICENSE">LICENSE</a> file that accompanied
this program.</p>
PopupWikipedia is free and open-source software. The add-on code that runs within Anki is released under the GNU
AGPLv3 license. For more information please see the <a
href="https://github.com/cfculhane/AnkiPopupWikipedia/blob/master/LICENSE">LICENSE</a> file that accompanied
this program.

<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.</p>
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.

<h3 id="knownissues">Known issues</h3>
<b> Known issues</b>

<ul>
<li>Clicking on links inside the popup opens the browser, but with the wrong URL</li>

<li>Disambiguation pages are not handled well</li>

<li>Does not work with NightMode due to the way Night-Mode monkeypatches Reviewer.revHtml, see <a
href="https://github.com/krassowski/Anki-Night-Mode/issues/53">this github issue here</a></li>
- Clicking on links inside the popup opens the browser, but with the wrong URL
- Disambiguation pages are not handled well
- Does not work with NightMode due to the way Night-Mode monkeypatches Reviewer.revHtml, see <a
href="https://github.com/krassowski/Anki-Night-Mode/issues/53">this github issue here</a>
</ul>
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ This is currently in beta stage - things will almost certainly break! Please sub

#### AnkiWeb

The easiest way to install Pop-up Dictionary is through [AnkiWeb](https://ankiweb.net/shared/info/).
The easiest way to install Pop-up Dictionary is through [AnkiWeb](https://ankiweb.net/shared/info/395343016).

#### Manual installation

1. Make sure you have the [latest version](https://apps.ankiweb.net/#download) of Anki 2.1 installed. Earlier releases (e.g. found in various Linux distros) do not support `.ankiaddon` packages.
2. Download the latest `.ankiaddon` package from the [releases tab](https://github.com/glutanimate/popup-dictionary/releases) (you might need to click on *Assets* below the description to reveal the download links)
2. Download the latest `.ankiaddon` package from the [releases tab](https://github.com/cfculhane/AnkiPopupWikipedia/releases) (you might need to click on *Assets* below the description to reveal the download links)
3. From Anki's main window, head to *Tools**Add-ons*
4. Drag-and-drop the `.ankiaddon` package onto the add-ons list
5. Restart Anki
Expand All @@ -43,7 +43,7 @@ I would also like to thank the team at [AMBOSS](https://www.amboss.com/) for the

Ships with the following javascript libraries:
- jQuery (v1.12.4), (c) jQuery Foundation, licensed under the MIT license
- qTip2 (v2.1.1), (c) 2011-2018 Craig Michael Thompson, licensed under the MIT license
- qTip2 (v3.0.3), (c) 2011-2018 Craig Michael Thompson, licensed under the MIT license
- imagesLoaded (v4.1.4) (c) David DeSandro, licensed under the MIT license

PopupWikipedia is free and open-source software. The add-on code that runs within Anki is released under the GNU AGPLv3 license. For more information please see the [LICENSE](https://github.com/cfculhane/AnkiPopupWikipedia/blob/master/LICENSE) file that accompanied this program.
Expand Down
16 changes: 0 additions & 16 deletions package-lock.json

This file was deleted.

6 changes: 3 additions & 3 deletions popup_wikipedia/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class ADDON(object):
"""Class storing general add-on properties
Property names need to be all-uppercase with no leading underscores
"""
NAME = "Anki Wiki Popup"
MODULE = "anki_wiki_popup"
ID = "0000000000"
NAME = "Popup Wikipedia"
MODULE = "popup_wikipedia"
ID = "395343016"
VERSION = __version__
LICENSE = "GNU AGPLv3"
AUTHORS = (
Expand Down
5 changes: 2 additions & 3 deletions popup_wikipedia/wiki_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import re
from os import PathLike
from pathlib import Path
from typing import Dict, Union

from .libaddon._vendor.common.requests_cache import CachedSession

Expand Down Expand Up @@ -153,7 +152,7 @@ def get_extract(self, title: str) -> str:

return f'<div class="wiki-result">{filled_html}</div>'

def summary_parser(self, summary_resp: Dict) -> Dict:
def summary_parser(self, summary_resp: {}) -> {}:
"""
Handles disambiguation routing, search failuers
Expand Down Expand Up @@ -194,5 +193,5 @@ def srcrepl(match): # Return the file contents with paths replaced
return p.sub(srcrepl, html_str)

@staticmethod
def _write_htmlfile(html, pth: Union[Path, str, PathLike]) -> int:
def _write_htmlfile(html, pth: PathLike) -> int:
return Path(pth).write_text(html, encoding="utf-8")

0 comments on commit b655fa7

Please sign in to comment.