Пример #1
0
def make_html(src,
              dest,
              embed_stylesheet=False,
              stylesheet=None,
              url_prefix=''):

    # Fix the url_prefix path in the banner HTML.
    # This Python tricky business is necessary because the custom docutils
    # writer, which inserts the HTML blobs, can't do it, because docutils
    # doesn't provide any way to pass an argument such as image_dir to the
    # writer.
    # There must be a better way, but I haven't figured it out yet.
    if url_prefix:
        html_fragments.url_prefix = url_prefix.rstrip('/') + '/'
    html_fragments.nav = html_fragments.make_nav()
    html_fragments.banner = html_fragments.make_banner()
    html_fragments.footer = html_fragments.make_footer()

    args = list(docutils_opts)
    if embed_stylesheet:
        # for embedded stylesheet
        args.append('--stylesheet-path=%s' % stylesheet)
        args.append('--embed-stylesheet')
    else:
        # for linked stylesheet
        args.append('--stylesheet=%s' % stylesheet)
        args.append('--link-stylesheet')
    if src is not None:
        args.append(src)
    if dest is not None:
        args.append(dest)

    # Invoke docutils processing of the reST document.  This call
    # to a docutils method ends up executing the custom HTML writer
    # in docutils_htmldeco_writer.py
    description = (
        'Generates (X)HTML documents from standalone reStructuredText '
        'sources, with custom banner and footer.  ' + default_description)
    publish_cmdline(writer_name=rst_writer, description=description, argv=args)
Пример #2
0
def make_html(src, dest, embed_stylesheet=False,
              stylesheet=None, url_prefix=''):

    # Fix the url_prefix path in the banner HTML.
    # This Python tricky business is necessary because the custom docutils
    # writer, which inserts the HTML blobs, can't do it, because docutils
    # doesn't provide any way to pass an argument such as image_dir to the
    # writer.
    # There must be a better way, but I haven't figured it out yet.
    if url_prefix:
        html_fragments.url_prefix = url_prefix.rstrip('/') + '/'
    html_fragments.nav = html_fragments.make_nav()
    html_fragments.banner = html_fragments.make_banner()
    html_fragments.footer = html_fragments.make_footer()

    args = list(docutils_opts)
    if embed_stylesheet:
        # for embedded stylesheet
        args.append('--stylesheet-path=%s' % stylesheet)
        args.append('--embed-stylesheet')
    else:
        # for linked stylesheet
        args.append('--stylesheet=%s' % stylesheet)
        args.append('--link-stylesheet')
    if src is not None:
        args.append(src)
    if dest is not None:
        args.append(dest)

    # Invoke docutils processing of the reST document.  This call
    # to a docutils method ends up executing the custom HTML writer
    # in docutils_htmldeco_writer.py
    description = ('Generates (X)HTML documents from standalone reStructuredText '
                   'sources, with custom banner and footer.  ' + default_description)
    publish_cmdline(writer_name=rst_writer,
                    description=description,
                    argv=args)
Пример #3
0
    ('teal', 0, 128, 128),  #008080
    ('thistle', 216, 191, 216),  #d8bfd8
    ('tomato', 255, 99, 71),  #ff6347
    ('turquoise', 64, 224, 208),  #40e0d0
    ('violet', 238, 130, 238),  #ee82ee
    ('wheat', 245, 222, 179),  #f5deb3
    ('white', 255, 255, 255),  #ffffff
    ('whitesmoke', 245, 245, 245),  #f5f5f5
    ('yellow', 255, 255, 0),  #ffff00
    ('yellowgreen', 154, 205, 50),  #9acd32
]

html_fragments.url_prefix = ''
banner = html_fragments.make_banner()
nav = html_fragments.make_nav()
footer = html_fragments.make_footer()
stylesheet_url = 'docutils-articles.css'

head = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<title>GraphicsMagick Color Selections</title>
	<meta name="description" content="GraphicsMagick is a robust collection of tools
and libraries to read, write, and manipulate an image in any of the more
popular image formats including GIF, JPEG, PNG, PDF, and Photo CD.  With
GraphicsMagick you can create GIFs dynamically making it suitable for Web
applications.  You can also resize, rotate, sharpen, color reduce, or add
special effects to an image and save your completed work in the same or
differing image format.">
    <meta name="keywords" content="GraphicsMagick, Image Magick, Image
Пример #4
0
    ('thistle', 216, 191, 216), #d8bfd8
    ('tomato', 255, 99, 71), #ff6347
    ('turquoise', 64, 224, 208), #40e0d0
    ('violet', 238, 130, 238), #ee82ee
    ('wheat', 245, 222, 179), #f5deb3
    ('white', 255, 255, 255), #ffffff
    ('whitesmoke', 245, 245, 245), #f5f5f5
    ('yellow', 255, 255, 0), #ffff00
    ('yellowgreen', 154, 205, 50), #9acd32
]


html_fragments.url_prefix = ''
banner = html_fragments.make_banner()
nav = html_fragments.make_nav()
footer = html_fragments.make_footer()
stylesheet_url = 'docutils-articles.css'


head = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<title>GraphicsMagick Color Selections</title>
	<meta name="description" content="GraphicsMagick is a robust collection of tools
and libraries to read, write, and manipulate an image in any of the more
popular image formats including GIF, JPEG, PNG, PDF, and Photo CD.  With
GraphicsMagick you can create GIFs dynamically making it suitable for Web
applications.  You can also resize, rotate, sharpen, color reduce, or add
special effects to an image and save your completed work in the same or
differing image format.">