c-okelly / org_to_anki

Python3 module to convert Txt, Org or LibreOffice files into Anki decks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

org_to_anki

Build Status codecov

Python module to convert org or txt files into Anki question decks. Also offered as an Add-on for Anki Lists to Anki

Provides a command line script to upload an org or txt file to Anki.

Based on AnkiConnect. An addon for Anki that provides a HTTP api for Anki.

Contents

  1. Supported file types
  2. What is an org file
  3. Using Org or text files
  4. Using LibreOffice files
  5. Installation
  6. Comand line scripts
  7. Running tests
  8. Contributing

Supported file types

This project supports reading from both .org, .txt and odt (LibreOffice) files.

To use LibreOffice files these must first be saved as HTML files. Please read the documentation on this.

Microsoft Word (.docx) files are no longer supported. Migration path is below

Word files to LibreOffice migraiton path

Users with existing Word files can migarte them to Libre office by doing the following:

  1. Install LibreOffice (Free / OpenSource Word equvilant)
  2. Open the file in LibreOffice
  3. Save file as ODT format

What is an org file?

An org files a basic text file, very similar to .txt files. The file type is from Org Mode for Emacs but really you don't need to know much about this.

This is all you need to know for this project.

  • Asterisks ( * ) are used to to create bullet point style lists.

  • .org files are series of lists

  • A list item for a question starts with *

  • A list item for a answer starts with **

  • A comment starts with a #

Examples are provided below.

Here is some example syntax for how question should be laid out

* Question
** Answer 1
** Answer 2
* Another Question
** Another answer

More information on org-mode

Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system

orgmode homepage

Org and Text files

Documentation on Org and Text files

LibreOffice

Documentation on LibreOffice files

Installation

Requirements

  1. Have the Anki app installed.

  2. Installing the Anki plugin AnkiConnect.

    i. For macOS users of anki-connect see note for macOS users

    ii. For Windows users of anki-connect see notes for Windows users

To install this module from source on Linux or macOS:

git clone https://github.com/c-okelly/org_to_anki
cd org_to_ani
python3 setup.py install

If the org_to_anki command returns a module not found error try the using the following command:

pip3 install ./

instead of

python3 setup.py install

Command line scripts

org_to_anki

org_to_anki
  • Upload the default org file to Anki
org_to_anki /path/to/your/org/file.org
  • Upload the specified file to Anki

Config values

  • Config in project root contains all the default values for running
  • Default org file is located at ~/orgNotes/quickOrgNotes.org
  • Default anki-connect url is http://127.0.0.1:8765/

Testing

A number of extra libraries are used in testing

  • To run unittests
python3 setup.py nosetests

Contributing

All contributions are welcome. Please open a issue first to discuss your ideas!

About

Python3 module to convert Txt, Org or LibreOffice files into Anki decks

License:MIT License


Languages

Language:Python 94.4%Language:HTML 5.6%Language:Shell 0.0%