예제 #1
0
def single(args):
    '''
    For uploading (and converting) to google docs.
    '''
    handle_options(args)
    options.builder = 'singlehtml'
    #    options.builder = 'epub'
    if not hasattr(options, 'tags'):
        options.tags = []
    #options.tags.append('standalone')
    options.conf_overrides['html_theme'] = 'default'
    #options.conf_overrides['html_theme_options'] = {'nosidebar' : True}
    #print('options:',options)
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book

        conf_override(bookdir)

        paversphinx.run_sphinx(options)

        in_fname = os.path.join(bookdir, options.builddir, 'singlehtml',
                                'index.html')
        out_fname = os.path.join(bookdir, options.builddir, 'singlehtml',
                                 book + '.html')
        insert_gdoc_css(in_fname, out_fname)
    uncog()
예제 #2
0
def single(args):
    '''
    For uploading (and converting) to google docs.
    '''
    handle_options(args)
    options.builder = 'singlehtml'
#    options.builder = 'epub'
    if not hasattr(options, 'tags'):
        options.tags = []
    #options.tags.append('standalone')
    options.conf_overrides['html_theme'] = 'default'
    #options.conf_overrides['html_theme_options'] = {'nosidebar' : True}
    #print('options:',options)
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book

        conf_override(bookdir)
        
        paversphinx.run_sphinx(options)
        
        in_fname = os.path.join(bookdir,options.builddir,'singlehtml','index.html')
        out_fname = os.path.join(bookdir,options.builddir,'singlehtml',book+'.html')
        insert_gdoc_css(in_fname, out_fname)
    uncog()
예제 #3
0
def pseudo(args):
    handle_options(args)
    options.builder = 'pseudoxml'

    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book

        conf_override(bookdir)

        paversphinx.run_sphinx(options)
예제 #4
0
def pseudo(args):
    handle_options(args)
    options.builder = 'pseudoxml'
    
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book

        conf_override(bookdir)
        
        paversphinx.run_sphinx(options)    
예제 #5
0
def pdf(args):
    handle_options(args)
    override_text = ''
    options.builder = 'latex'
    if not hasattr(options, 'tags'):
        options.tags = []
    if hasattr(options, 'pdf_paper_size'):
        override_text += "latex_elements['paper_size'] = '" + options.pdf_paper_size + "'"
    #options.tags.append('standalone')
    #print('options:',options)
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book
        conf_override(bookdir, {'override_text': override_text})
        pdffile = os.path.join(bookdir, options.builddir, 'latex',
                               book + '.pdf')
        if os.path.exists(pdffile):
            os.unlink(pdffile)
        rval = paversphinx.run_sphinx(options)

        run_latex(os.path.join(bookdir, options.builddir, 'latex'))

        if os.path.exists(pdffile):
            print('copy', pdffile, bookdir)
            shutil.copy(pdffile, bookdir)
        else:
            print('pdf file not created')
    uncog()
예제 #6
0
def pdf(args):
    handle_options(args)
    override_text = ''
    options.builder = 'latex'
    if not hasattr(options, 'tags'):
        options.tags = []
    if hasattr(options, 'pdf_paper_size'):
        override_text += "latex_elements['paper_size'] = '"+options.pdf_paper_size+"'"
    #options.tags.append('standalone')
    #print('options:',options)
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book
        conf_override(bookdir, {'override_text' : override_text})
        pdffile = os.path.join(bookdir, options.builddir, 'latex', book+'.pdf')
        if os.path.exists(pdffile):
            os.unlink(pdffile)
        rval = paversphinx.run_sphinx(options)
        
        run_latex(os.path.join(bookdir, options.builddir, 'latex'))
        
        if os.path.exists(pdffile):
            print('copy',pdffile,bookdir)
            shutil.copy(pdffile, bookdir)
        else:
            print('pdf file not created')
    uncog()
예제 #7
0
def epub(args):
    handle_options(args)
    options.builder = 'epub'
    if not hasattr(options, 'tags'):
        options.tags = []
    #options.tags.append('standalone')
    options.conf_overrides['html_theme'] = 'default'
    #options.conf_overrides['html_theme_options'] = {'nosidebar' : True}
    #print('options:',options)
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book

        conf_override(bookdir)
        
        paversphinx.run_sphinx(options)
        epubfile = os.path.join(bookdir, options.builddir, 'epub', book+'.epub')
        print('copy',epubfile,bookdir)
        shutil.copy(epubfile, bookdir)
예제 #8
0
def epub(args):
    handle_options(args)
    options.builder = 'epub'
    if not hasattr(options, 'tags'):
        options.tags = []
    #options.tags.append('standalone')
    options.conf_overrides['html_theme'] = 'default'
    #options.conf_overrides['html_theme_options'] = {'nosidebar' : True}
    #print('options:',options)
    for book, bookdir in options.books.items():
        book_options = options
        book_options.docroot = bookdir
        book_options.conf_overrides['project'] = book

        conf_override(bookdir)

        paversphinx.run_sphinx(options)
        epubfile = os.path.join(bookdir, options.builddir, 'epub',
                                book + '.epub')
        print('copy', epubfile, bookdir)
        shutil.copy(epubfile, bookdir)
예제 #9
0
def all(args):
    handle_options(args)
    #rint('options:',options)
    options.conf_overrides['standalone'] = False
    paversphinx.run_sphinx(options, 'html')
예제 #10
0
def all(args):
    handle_options(args)
    #rint('options:',options)
    options.conf_overrides['standalone'] = False
    paversphinx.run_sphinx(options, 'html')