Kaynağa Gözat

Merge pull request #2 from joyeusenoelle/dev

Add basic citation structure
master
Noëlle Anthony 5 yıl önce
ebeveyn
işleme
b36134a6c3
No account linked to committer's email address
1 değiştirilmiş dosya ile 49 ekleme ve 1 silme
  1. 49
    1
      pyris.py

+ 49
- 1
pyris.py Dosyayı Görüntüle

@@ -7,7 +7,55 @@ __version__ = "0.1.0"
import sys, os

class Citation:
def __init__(self):
self.type = ""
self.authors = {}
self.authorcount = 0
self.title = ""
self.date = {
year: "",
month: "",
day: "",
info: ""
}

def addAuthor(self, author):
fmtAuthor = ",".join(list(map(lambda x: x.strip(), author.split(','))))
self.authors[self.authorcount] = fmtAuthor
self.authorcount += 1

def getAuthors(self):
astr = ""
for author in self.authors:
astr += "A1 - {}\n".format(author)
return astr

def addType(self, ctype):
self.type = ctype

def getType(self):
return "TY - {}\n".format(self.type)

def addTitle(self, ctitle):
self.title = ctitle

def getTitle(self):
return "TI - {}\n".format(self.title)

def addDate(self, yr=None, mn=None, dy=None, info=None):
self.date.year = "" if yr == None else yr
self.date.month = "" if mn == None else mn
self.date.day = "" if dy == None else dy
self.date.info = "" if info == None else info

def getDate(self):
return "CY - {}/{}/{}/{}\n".format(self.date.year, self.date.month, self.date.day, self.date.info)


class CiteList:
def __init__(self, filename):
self.citations = {}
self.idx = 0
chunks = filename.split(".")
if len(chunks) == 1: # has no extension
self.fn, self.ext = chunks[0], ""
@@ -32,7 +80,7 @@ class Citation:
print(rstr)

def main(filename):
cite = Citation(filename)
cList = CiteList(filename)

if __name__ == "__main__":
args = sys.argv()

Loading…
İptal
Kaydet