瀏覽代碼

Merge pull request #1 from joyeusenoelle/dev

Handle filenames
master
Noëlle Anthony 5 年之前
父節點
當前提交
f51d271cf8
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 11 行新增2 行删除
  1. 11
    2
      pyris.py

+ 11
- 2
pyris.py 查看文件

@@ -15,12 +15,21 @@ class Citation:
self.fn, self.ext = ".".join(chunks[:-1]), chunks[-1]
else: # has one period in filename
self.fn, self.ext = chunks[0], chunks[1]
with open(filename, 'r') as f:
self.contents = f.read()
self.outfile = self.fn + ".ris"

def toString(self):
return "Current file: {}.{}".format(self.fn, self.ext)
rstr = "Current infile: {}.{}".format(self.fn, self.ext)
rstr += "\n"
rstr += "Current outfile: {}".format(self.outfile)
return rstr

def print(self):
print("Current file: {}.{}").format(self.fn, self.ext)
rstr = "Current infile: {}.{}".format(self.fn, self.ext)
rstr += "\n"
rstr += "Current outfile: {}".format(self.outfile)
print(rstr)

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

Loading…
取消
儲存