Giter Club home page Giter Club logo

anki-rb's Introduction

ankirb

Gem Version Build Status

A basic gem to create Anki decks (.apkg). Supports integrated media (audio, images and videos).

Installation

Add this line to your application's Gemfile:

gem 'ankirb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ankirb

Usage

require 'ankirb'

#create a deck
deck = Anki::Deck.new 'FancyExampleDeck'

#create a basic card
card = Anki::Card.new(:front=>"What is the french for cheese omelette?", :back=>"Omelette au fromage")

#add audio to the back
card.back << "dexters_lab_omelette.wav"

#add card to the deck
deck.add_card card

#add the reverse version of the card
deck.add_card card.invert 

#export to ~/Anki/Decks/FancyExampleDeck.apkg
Anki::apkg.export deck, "~/Anki/Decks" 

Media types

Media can be added to a card face via the << operator, just pass a string that points to a valid media file and the lib will convert + package the file.

For images, the position of the image in the card can be set by using a placeholder {{img}}.

card = Anki::Card.new :front => "{{img}} text after image", :back => "text before image {{img}}"
card.front << "front_img.jpg"
card.back << "back_img.jpg"

If no placeholder is present the image will just be added at the end. If multiple placeholders are present, they'll be replaced sequentially with the image files added to the card.

As with anki, html tags can be used for more styling in the card content. Card model / css template support may be added in future.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rkachowski/ankirb.

License

The gem is available as open source under the terms of the MIT License.

anki-rb's People

Contributors

rkachowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

anki-rb's Issues

fix require issue

can't correctly run require 'ankirb', which is a little bit of a downer

Encoding errors

Anki droid shows some garbage when using non ascii chars. Likely there is a way to enforce utf8 encoding somewhere in the schema. i need to look into this

looking for ways to automate anki-deck creation

I am very interested to learn about ways to to automize the creation of anki-decks and just starting to learn about the subject.

I haven't tested your project yet, but it seems to be an extension of https://github.com/dennmart/anki? Do you happen to know other projects, which also try to create anki-decks from some source document?

It is my goal to maintain some deck-source-files on github e.g. and find a elegant way to create anki-decks from them. The plainer and readable the source-file the better and the incorporation of markdown in the source and html or pdf in the flashcards themselves would be ideal (though this may not be supported). I would like to incorporate syntax-highlighted code-snippets this way and control their appearance (possible alternative: https://ankiweb.net/shared/info/1463041493).

I will also post in the Anki-forums, but any shared thoughts would be greatly appreciated.

Kind regards! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.