How to use the nbsite.cmd.generate_rst function in nbsite

To help you get started, we’ve selected a few nbsite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyviz-dev / nbsite / nbsite / __main__.py View on Github external
def main(args=None):
    parser = argparse.ArgumentParser(description="nbsite commands")
    subparsers = parser.add_subparsers(title='available commands')

    init_parser = subparsers.add_parser("init", help=inspect.getdoc(init))
    _add_common_args(init_parser,'--project-root','--doc')
    init_parser.add_argument('--theme', type=str, help='sphinx theme to use in template', choices=['holoviz', ''], default='')
    _set_defaults(init_parser,init)

    generaterst_parser = subparsers.add_parser("generate-rst", help=inspect.getdoc(generate_rst))
    _add_common_args(generaterst_parser,'--project-root','--doc','--examples', '--overwrite')
    generaterst_parser.add_argument('--project-name', type=str, help='name of project')
    generaterst_parser.add_argument('--host',type=str,help='host to use when generating notebook links',default='GitHub')
    generaterst_parser.add_argument('--org',type=str,help='github organization',default='')
    generaterst_parser.add_argument('--repo',type=str,help='name of repo',default='')
    generaterst_parser.add_argument('--branch',type=str,help='branch to point to in notebook links',default='master')
    generaterst_parser.add_argument('--offset',type=int,help='number of cells to delete from top of notebooks',default=0)
    generaterst_parser.add_argument('--nblink',type=str,help='where to place notebook links',choices=['bottom', 'top', 'both', 'none'], default='bottom')
    generaterst_parser.add_argument('--skip',type=str,help='notebooks to skip running; comma separated case insensitive re to match',default='')
    generaterst_parser.add_argument('--keep-numbers',action='store_true',help='whether to keep the leading numbers of notebook URLs and titles')
    _set_defaults(generaterst_parser,generate_rst)

    build_parser = subparsers.add_parser("build", help=inspect.getdoc(build))
    build_parser.add_argument('--what',type=str,help='type of output to generate',default='html')
    build_parser.add_argument('--output',type=str,help='where to place output',default="builtdocs")
    _add_common_args(build_parser,'--project-root','--doc','--examples', '--overwrite')
github pyviz-dev / nbsite / scripts / nbsite_nbpagebuild.py View on Github external
from nbsite.cmd import generate_rst

# if only someone had made a way to handle parameters
org = sys.argv[1]
project = sys.argv[2]
examples_path = os.path.abspath(sys.argv[3])
doc_path = os.path.abspath(sys.argv[4])
offset = 0
overwrite = bool(1)
if len(sys.argv) > 5:
    offset = int(sys.argv[5])
if len(sys.argv) > 6:
    overwrite = int(sys.argv[6])
    
generate_rst(
    project,
    examples=examples_path,
    doc=doc_path,
    org = org,
    repo=project,
    offset=offset,
    overwrite=bool(overwrite))