
from karteikarten.models import Card

class AnkiExporter(object):
  '''
  Exports cards to ANKI Text File.
  '''
  @staticmethod
  def export(cardset):
    result = u'front\tback\n'
    for card in Card.objects.filter(parent_card_set = cardset):
      result += card.front.replace('\n', '<br />') + '\t' + \
                card.back.replace('\n', '<br />') + '\n'
    return result

  @staticmethod
  def getExtension():
    return '.txt'


from karteikarten.models import Card

class AnkiExporter(object):
  '''
  Exports cards to ANKI Text File.
  '''
  @staticmethod
  def export(cardset):
    result = u'front\tback\n'
    for card in Card.objects.filter(parent_card_set = cardset):
      result += card.front.replace('\n', '<br />').replace('\r', '') + '\t' + \
                card.back.replace('\n', '<br />').replace('\r', '') + '\n'
    return result

  @staticmethod
  def getExtension():
    return '.txt'

Remove carriage returns in Anki exporter
Remove carriage returns in Anki exporter

  
  from karteikarten.models import Card
  
  class AnkiExporter(object):
    '''
    Exports cards to ANKI Text File.
    '''
    @staticmethod
    def export(cardset):
      result = u'front\tback\n'
      for card in Card.objects.filter(parent_card_set = cardset):
-       result += card.front.replace('\n', '<br />') + '\t' + \
+       result += card.front.replace('\n', '<br />').replace('\r', '') + '\t' + \
-                 card.back.replace('\n', '<br />') + '\n'
+                 card.back.replace('\n', '<br />').replace('\r', '') + '\n'
      return result
  
    @staticmethod
    def getExtension():
      return '.txt'
  
Remove carriage returns in Anki exporter
## Code Before:

from karteikarten.models import Card

class AnkiExporter(object):
  '''
  Exports cards to ANKI Text File.
  '''
  @staticmethod
  def export(cardset):
    result = u'front\tback\n'
    for card in Card.objects.filter(parent_card_set = cardset):
      result += card.front.replace('\n', '<br />') + '\t' + \
                card.back.replace('\n', '<br />') + '\n'
    return result

  @staticmethod
  def getExtension():
    return '.txt'

## Instruction:
Remove carriage returns in Anki exporter
## Code After:

from karteikarten.models import Card

class AnkiExporter(object):
  '''
  Exports cards to ANKI Text File.
  '''
  @staticmethod
  def export(cardset):
    result = u'front\tback\n'
    for card in Card.objects.filter(parent_card_set = cardset):
      result += card.front.replace('\n', '<br />').replace('\r', '') + '\t' + \
                card.back.replace('\n', '<br />').replace('\r', '') + '\n'
    return result

  @staticmethod
  def getExtension():
    return '.txt'
