def episodeToMarkdown(data, podInfo, auth): """ Take in a podcast episode data from PodcastIndex and return Markdowns """ fileName = str(data['id']) + '.md' published = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(data['datePublished'])) mf = MdUtils(file_name=fileName, title=data['title']) showTxt = data['title'] + ' - ' + data['enclosureType'] mf.new_line(mf.new_inline_link(link=data['enclosureUrl'], text=showTxt)) mf.new_line(mf.new_inline_link(link=data['link'], text='Show Notes Link')) mf.new_line(f'Published: {published}') if 'image' in data: mf.new_paragraph(Html.image(path=data['image'])) elif 'feedImage': mf.new_paragraph(Html.image(path=data['feedImage'])) showTitle = "Podcast: " + podInfo['feed']['title'] mf.new_header(1, showTitle) feedUrl = podInfo['feed']['url'] podLink = f'[Original RSS Feed]({feedUrl})' mf.new_paragraph(podLink) mf.new_paragraph(data['description']) mf.new_paragraph('PodcastIndex.org ID: ' + str(data['id'])) mf.read_md_file('postfooter.md') mf.file_data_text = mf.file_data_text.replace('somethingtoreplacehere777', auth) print(f'Working on {showTxt}') return mf, fileName
def create_markdown(github, owner): """ create markdown for repos in github dict """ filename = 'prepbadge' print(f'Creating markdown file for {owner} repos in {filename}.md') md = MdUtils(file_name=filename, title='EdgeXFoundry Repo Badges Preview') for repo in github[0]['result']: md.new_header(level=1, title=md.new_inline_link(link=repo['github_url'], text=repo['name'])) for badge in repo['badges']: md.write(f'{badge} ') md.new_line('') md.create_md_file()
def md_file_create(self, research_topic, filename, ordered_by='time'): ''' Creates a markdown file of data in the research database given a research topic. Returns the file name ''' Record = Query() records = self.research_db.search( Record.research_topic == research_topic) mdfile = MdUtils(file_name=filename, title=research_topic) for record in records: mdfile.new_line('- ' + mdfile.new_inline_link( link=record["url"], text=record["page_title"])) mdfile.create_md_file() return
end_datetime = str2time(end_time) for target in target_list: if repo.find(target) != -1: if start_datetime <= cur_datetime <= end_datetime: if node['issue']['id'] not in comment_issue_ids: comment_issue_ids.append(node['issue']['id']) comment_issues.append(node) break mdFile = MdUtils(file_name='output', title='Weekly Report') if len(open_issues) > 0: mdFile.new_header(level=2, title='Open Issues', add_table_of_contents='n') mdFile.new_list( map( lambda x: 'Open Issue ' + mdFile.new_inline_link( link=x['issue']['url'], text=x['issue']['title']), open_issues)) if len(open_prs) > 0: mdFile.new_header(level=2, title='Open PRs', add_table_of_contents='n') mdFile.new_list( map( lambda x: 'Open PR ' + mdFile.new_inline_link( link=x['pullRequest']['url'], text=x['pullRequest']['title']), open_prs)) if len(review_prs) > 0: mdFile.new_header(level=2, title='Review PRs', add_table_of_contents='n') mdFile.new_list( map( lambda x: 'Review PR ' + mdFile.new_inline_link(