示例#1
0
def tweak_css(repo_dir):
    '''Comment out some css settings.'''
    print_msg("* don't capitalize titles (no uppercase headings)")
    files = [
        'beige.css', 'black.css', 'blood.css', 'league.css', 'moon.css',
        'night.css', 'serif.css', 'simple.css', 'sky.css', 'solarized.css',
        'white.css',
    ]
    line = '  text-transform: uppercase;'
    for file_ in files:
        update_or_append_line(filename=flo('{repo_dir}/css/theme/{file_}'),
                              prefix=line, new_line=flo('/*{line}*/'))

    print_msg('* images without border')
    data = [
        {'file': 'beige.css',     'line': '  border: 4px solid #333;'},
        {'file': 'black.css',     'line': '  border: 4px solid #fff;'},
        {'file': 'blood.css',     'line': '  border: 4px solid #eee;'},
        {'file': 'league.css',    'line': '  border: 4px solid #eee;'},
        {'file': 'moon.css',      'line': '  border: 4px solid #93a1a1;'},
        {'file': 'night.css',     'line': '  border: 4px solid #eee;'},
        {'file': 'serif.css',     'line': '  border: 4px solid #000;'},
        {'file': 'simple.css',    'line': '  border: 4px solid #000;'},
        {'file': 'sky.css',       'line': '  border: 4px solid #333;'},
        {'file': 'solarized.css', 'line': '  border: 4px solid #657b83;'},
        {'file': 'white.css',     'line': '  border: 4px solid #222;'},
    ]
    for item in data:
        file_ = item['file']
        lines = [item['line'], ]
        lines.extend(['  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }',
                      '  box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }'])
        for line in lines:
            update_or_append_line(filename=flo('{repo_dir}/css/theme/{file_}'),
                                  prefix=line, new_line=flo('/*{line}*/'))
示例#2
0
def selfoss_password(sitename):
    password = query_input('selfoss password:'******'curl -d password="******" -d form_submit="send" '
                  '--insecure https://{sitename}/password 2>/dev/null | '
                  'grep "Generated Password"'),
              capture=True)
    match = re.search(r'value="([^"]+)"', res)
    pw_hash = match.group(1)
    print(flo('{pw_hash}'))
    update_or_append_line(flo('~/sites/{sitename}/selfoss/config.ini'),
                          prefix='password='******'password={pw_hash}'))
示例#3
0
def install_plugin_title_footer(plugin_dir):
    export_repo(plugin_dir,
                'https://github.com/e-gor/Reveal.js-Title-Footer.git',
                repo_name='title-footer_all')
    run(flo('mv {plugin_dir}/title-footer_all/plugin/title-footer  '
            '{plugin_dir}/title-footer'))
    run(flo('rm -rf {plugin_dir}/title-footer_all'))
    print_msg('correct css path (because reveal.js is placed in a subdir)')
    update_or_append_line(flo('{plugin_dir}/title-footer/title-footer.js'),
                          prefix='\tlink.href="plugin/'
                                 'title-footer/title-footer.css";',
                          new_line='\tlink.href="reveal.js/plugin/'
                                   'title-footer/title-footer.css";')
示例#4
0
def install_plugin_toc_progress(plugin_dir):
    export_repo(plugin_dir,
                'https://github.com/e-gor/Reveal.js-TOC-Progress.git',
                repo_name='toc-progress_all')
    run(flo('mv {plugin_dir}/toc-progress_all/plugin/toc-progress  '
            '{plugin_dir}/toc-progress'))
    run(flo('rm -rf {plugin_dir}/toc-progress_all'))
    print_msg('correct css path (because reveal.js is placed in a subdir)')
    update_or_append_line(flo('{plugin_dir}/toc-progress/toc-progress.js'),
                          prefix='\tlink.href="plugin/'
                                 'toc-progress/toc-progress.css"',
                          new_line='\tlink.href="reveal.js/plugin/'
                                   'toc-progress/toc-progress.css"')
示例#5
0
def install_plugin_title_footer(plugin_dir):
    export_repo(plugin_dir,
                'https://github.com/e-gor/Reveal.js-Title-Footer.git',
                repo_name='title-footer_all')
    run(
        flo('mv {plugin_dir}/title-footer_all/plugin/title-footer  '
            '{plugin_dir}/title-footer'))
    run(flo('rm -rf {plugin_dir}/title-footer_all'))
    print_msg('correct css path (because reveal.js is placed in a subdir)')
    update_or_append_line(flo('{plugin_dir}/title-footer/title-footer.js'),
                          prefix='\tlink.href="plugin/'
                          'title-footer/title-footer.css";',
                          new_line='\tlink.href="reveal.js/plugin/'
                          'title-footer/title-footer.css";')
示例#6
0
def install_plugin_toc_progress(plugin_dir):
    export_repo(plugin_dir,
                'https://github.com/e-gor/Reveal.js-TOC-Progress.git',
                repo_name='toc-progress_all')
    run(
        flo('mv {plugin_dir}/toc-progress_all/plugin/toc-progress  '
            '{plugin_dir}/toc-progress'))
    run(flo('rm -rf {plugin_dir}/toc-progress_all'))
    print_msg('correct css path (because reveal.js is placed in a subdir)')
    update_or_append_line(flo('{plugin_dir}/toc-progress/toc-progress.js'),
                          prefix='\tlink.href="plugin/'
                          'toc-progress/toc-progress.css"',
                          new_line='\tlink.href="reveal.js/plugin/'
                          'toc-progress/toc-progress.css"')
示例#7
0
def _insert_repo_infos_into_readme(basedir, github_user, github_repo):
    print_msg('\nadd github user and repo name into README.md')
    filename = flo('{basedir}/README.md')
    # FIXME: workaround: line starts with space "trick" for github.io link
    #        correct solution would be: create util function update_line()
    #                                   which will not append if prefix not
    #                                   found in file
    update_or_append_line(filename,
                          #prefix=' https://USER.github.io/REPO',
                          prefix=' https://',
                          new_line=flo(' https://{github_user}.github.io/'
                                       '{github_repo}'))
    update_or_append_line(filename,
                          #prefix='https://github.com/USER/REPO/blob/master/'
                          #       'slides.md',
                          prefix='https://github.com/',
                          new_line=flo('https://github.com/{github_user}/'
                                       '{github_repo}/blob/master/slides.md'))
示例#8
0
def _insert_repo_infos_into_readme(basedir, github_user, github_repo):
    print_msg('\nadd github user and repo name into README.md')
    filename = flo('{basedir}/README.md')
    # FIXME: workaround: line starts with space "trick" for github.io link
    #        correct solution would be: create util function update_line()
    #                                   which will not append if prefix not
    #                                   found in file
    update_or_append_line(
        filename,
        #prefix=' https://USER.github.io/REPO',
        prefix=' https://',
        new_line=flo(' https://{github_user}.github.io/'
                     '{github_repo}'))
    update_or_append_line(
        filename,
        #prefix='https://github.com/USER/REPO/blob/master/'
        #       'slides.md',
        prefix='https://github.com/',
        new_line=flo('https://github.com/{github_user}/'
                     '{github_repo}/blob/master/slides.md'))
示例#9
0
def selfoss_username(username, sitename):
    selfoss_username = query_input('selfoss user name:', default=username)
    update_or_append_line(flo('~/sites/{sitename}/selfoss/config.ini'),
                          prefix='username='******'username={selfoss_username}'))
示例#10
0
def tweak_css(repo_dir):
    '''Comment out some css settings.'''
    print_msg("* don't capitalize titles (no uppercase headings)")
    files = [
        'beige.css',
        'black.css',
        'blood.css',
        'league.css',
        'moon.css',
        'night.css',
        'serif.css',
        'simple.css',
        'sky.css',
        'solarized.css',
        'white.css',
    ]
    line = '  text-transform: uppercase;'
    for file_ in files:
        update_or_append_line(filename=flo('{repo_dir}/css/theme/{file_}'),
                              prefix=line,
                              new_line=flo('/*{line}*/'))

    print_msg('* images without border')
    data = [
        {
            'file': 'beige.css',
            'line': '  border: 4px solid #333;'
        },
        {
            'file': 'black.css',
            'line': '  border: 4px solid #fff;'
        },
        {
            'file': 'blood.css',
            'line': '  border: 4px solid #eee;'
        },
        {
            'file': 'league.css',
            'line': '  border: 4px solid #eee;'
        },
        {
            'file': 'moon.css',
            'line': '  border: 4px solid #93a1a1;'
        },
        {
            'file': 'night.css',
            'line': '  border: 4px solid #eee;'
        },
        {
            'file': 'serif.css',
            'line': '  border: 4px solid #000;'
        },
        {
            'file': 'simple.css',
            'line': '  border: 4px solid #000;'
        },
        {
            'file': 'sky.css',
            'line': '  border: 4px solid #333;'
        },
        {
            'file': 'solarized.css',
            'line': '  border: 4px solid #657b83;'
        },
        {
            'file': 'white.css',
            'line': '  border: 4px solid #222;'
        },
    ]
    for item in data:
        file_ = item['file']
        lines = [
            item['line'],
        ]
        lines.extend([
            '  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); }',
            '  box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); }'
        ])
        for line in lines:
            update_or_append_line(filename=flo('{repo_dir}/css/theme/{file_}'),
                                  prefix=line,
                                  new_line=flo('/*{line}*/'))