本文整理汇总了Python中note.Note.parseNoteContentToMarkDown方法的典型用法代码示例。如果您正苦于以下问题:Python Note.parseNoteContentToMarkDown方法的具体用法?Python Note.parseNoteContentToMarkDown怎么用?Python Note.parseNoteContentToMarkDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类note.Note
的用法示例。
在下文中一共展示了Note.parseNoteContentToMarkDown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getpubs
# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import parseNoteContentToMarkDown [as 别名]
def getpubs():
"""Get Publisher initials and names from '__Publish Name and Initials'"""
import html2text # pip install html2text
import re
from note import Note
from models import ENNote
id = 90 # in table
title = '__Publish Name and Initials'
pubinitialsguid = '97a296aa-9698-4e29-bf74-3baa8e131ca1'
territorypoisguid = '658ad719-3492-4882-b0f7-f52f67a7f7fa'
#note_pubinitials = ENNote.objects.get(guid=pubinitialsguid)
note_pubinitials = ENNote.objects.get(id=90)
NotePubInitials = Note(note_pubinitials.content)
txt = NotePubInitials.parseNoteContentToMarkDown()
reobj = re.compile(r"(?P<lastname>.+?)\s*,\s*(?P<firstname>.+?)\s*-\s*_(?P<initials>[A-Z]+)")
match = reobj.search(txt)
if not match:
raise Exception("Failed to match publisher initials in: %s" % txt)
publishers = {}
for match in reobj.finditer(txt):
publishers[match.group("initials")] = "%s, %s" % (match.group("lastname"), match.group("firstname"))
return publishers