Exemplo n.º 1
0
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()
Exemplo n.º 2
0
def generateMdFile(cardInfo):
    now = datetime.now()
    filename = now.strftime('%Y-%m-%d-%H-%M-%S')
    reportname = '%s-report' % (filename)

    print('Generating %s...' % (reportname))
    mdFile = MdUtils(file_name=reportname, title='Today\'s Trello Report')

    # Intro text
    mdFile.write(
        'Hey tech-team! Here’s a snapshot of what we’re working on based on our current Trello! '
    )
    mdFile.write(
        'If you have updates you want to give or are interested in following up with/joining some of this work,'
    )
    mdFile.write(
        'either ask here, message the folks on the task, or get in the Trello yourself and see what’s going on!'
    )
    mdFile.new_line()
    mdFile.new_line()

    for card in cardInfo:
        # Card Title
        print('Creating entry for %s...' % (card['name']))
        mdFile.write('**%s**' % (card['name']))

        # Card Tags
        if (len(card['labels']) > 0):
            mdFile.write(' (')
            for i in range(len(card['labels'])):
                mdFile.write('%s' % (card['labels'][i]))
                if (i != len(card['labels']) - 1):
                    mdFile.write(', ')
            mdFile.write(')')

        # Names on the card
        if (len(card['members']) > 0):
            mdFile.write(' [')
            for i in range(len(card['members'])):
                mdFile.write('%s' % (card['members'][i]))
                if (i != len(card['members']) - 1):
                    mdFile.write(', ')
            mdFile.write(']')

        # Recent comment
        if (len(card['recentComment']) > 0):
            mdFile.write(': ')
            mdFile.write('%s' % card['recentComment'])
        else:
            mdFile.write(
                ': No further information (someone should add some comments/users)!'
            )

        # Lines between files
        mdFile.new_line()
        mdFile.new_line()

    # Create file
    mdFile.create_md_file()
    print('Done!')
Exemplo n.º 3
0
def create_notebook(name, title):
    md_file = MdUtils(file_name=name)
    md_file.write("#%% md\n")
    md_file.write("# " + title + "\n")
    return md_file