card module

class infocards.card.Card(title, description, content, tags, modified)

Bases: builtins.object

Cards have a simple structure and contain a small amount of information stored as plain text in the Archive.

Parameters:
  • title (str) – title of the card
  • description (str) – a small description of the card
  • content (str) – content of the card
  • tags (str) – tags are stored as a sequence of words and/or sentences separated by whitespaces in the archive. However, the Card object will store the tags as a list for easier access.
  • modified (datetime) – last modification’s date and time

Note that in order to be able to search for cards, it is necessary to include tags.

static normalize(tag_list=None, tag_string=None)

Normalize a tag string or list.

Normalization is achieved by removing repeated words and transforming every word into lowercase.

Parameters:
  • tag_list (list) – tag list to normalize (useful when modifying card tags)
  • tag_string (str) – tag string to normalize
static tag_list(tag_string)

Obtain a tag list from a string.

This method is called when a new card is created. It will remove duplicate tags, set the tags to lowercase and sort the list when created.

Parameters:tag_string (str) – string of tags separated by whitespaces
static tag_string(tag_list)

Obtain a string of tags from a list. Each tag will be separated by a whitespace.

Parameters:tag_list (list) – list of tags to convert