Esempio n. 1
0
def test_publish_cell():
    """Test pypublish cell format"""
    pweave.publish("tests/publish/publish_test_cell.txt", doc_format="html")
    test = io.open("tests/publish/publish_test_cell.html", "r").read().encode("utf-8")
    ref = io.open("tests/publish/publish_test_ref.html", "r").read().encode("utf-8")
    #Leave out the changing footer
    assert (test[:len(test) - 500] == ref[:len(test) - 500])
Esempio n. 2
0
def test_publish():
    """Test pypublish"""
    pweave.publish("tests/publish/publish_test.txt", doc_format="html")
    test = io.open("tests/publish/publish_test.html", "r").read().encode("utf-8")
    ref = io.open("tests/publish/publish_test_ref.html", "r").read().encode("utf-8")
    #Leave out the changing footer
    assert (test[:len(test) - 400] == ref[:len(test) - 400])
Esempio n. 3
0
def generate_report(out_dir):
    """
	Generates Pweave report
	:param out_dir: output directory where the HTML will be stored
	"""
    pweave.publish("eval.pmd", output=f"{out_dir}/eval_output.html")
    flag = Path(out_dir) / '.SUCCESS'
    flag.touch()
Esempio n. 4
0
def main():
    """
        Build html from specified files, using pweave.
    """

    # Get the pweave files from the source directoy :
    files = [f for f in os.listdir("src/") if f[-4:] == ".pmd"]

    for f in files:
        pweave.publish(os.path.join("src", f),
                       output=os.path.join("build", f.replace("pmd", "html")))
Esempio n. 5
0
def publish():
    if len(sys.argv) == 1:
        print("Publish a python script. Part of Pweave %s, use -h for help" %
              pweave.__version__)
        sys.exit()

    parser = OptionParser(
        usage="pypublish [options] sourcefile",
        version="Part of Pweave " + pweave.__version__,
    )
    parser.add_option(
        "-f",
        "--format",
        dest="format",
        default="html",
        help=
        "Output format html or pdf, pdf output requires pandoc and pdflatex",
    )
    parser.add_option(
        "-e",
        "--latex_engine",
        dest="latex_engine",
        default="pdflatex",
        help="The command for running latex.",
    )
    parser.add_option(
        "-t",
        "--theme",
        dest="theme",
        default="skeleton",
        help="Theme for HTML output",
    )
    parser.add_option(
        "-o",
        "--output",
        dest="output",
        default=None,
        help="Name of the output file",
    )

    (options, args) = parser.parse_args()

    try:
        infile = args[0]
    except IndexError:
        infile = ""

    pweave.publish(
        infile,
        options.format,
        options.theme,
        options.latex_engine,
        options.output,
    )
Esempio n. 6
0
def publish():
    if len(sys.argv)==1:
        print "Publish a python script. Part of Pweave %s, use -h for help" % pweave.__version__
        sys.exit()
    parser = OptionParser(usage="pypublish [options] sourcefile", version="Part of Pweave " + pweave.__version__)
    parser.add_option("-f", "--format", dest="format", default='html',
                      help = "Output format html or pdf, pdf output requires pandoc and pdflatex")
    
    (options, args) = parser.parse_args()

    try:
        infile = args[0]
    except:
        infile = ""

    pweave.publish(infile, options.format)
Esempio n. 7
0
def publish():
    if len(sys.argv) == 1:
        print("Publish a python script. Part of Pweave %s, use -h for help" % pweave.__version__)
        sys.exit()

    parser = OptionParser(usage="pypublish [options] sourcefile", version="Part of Pweave " + pweave.__version__)
    parser.add_option("-f", "--format", dest="format", default='html',
                      help="Output format html or pdf, pdf output requires pandoc and pdflatex")
    parser.add_option("-e", "--latex_engine", dest = "latex_engine", default = "pdflatex",
                      help = "The command for running latex.")
    parser.add_option("-t", "--theme", dest = "theme", default = None,
                      help = "Theme for HTML output")

    (options, args) = parser.parse_args()

    try:
        infile = args[0]
    except IndexError:
        infile = ""

    pweave.publish(infile, options.format, options.theme, options.latex_engine)
def publish():
    if len(sys.argv) == 1:
        print "Publish a python script. Part of Pweave %s, use -h for help" % pweave.__version__
        sys.exit()
    parser = OptionParser(usage="pypublish [options] sourcefile",
                          version="Part of Pweave " + pweave.__version__)
    parser.add_option(
        "-f",
        "--format",
        dest="format",
        default='html',
        help=
        "Output format html or pdf, pdf output requires pandoc and pdflatex")

    (options, args) = parser.parse_args()

    try:
        infile = args[0]
    except:
        infile = ""

    pweave.publish(infile, options.format)
Esempio n. 9
0
import pweave
pweave.publish('midterm.pmd', doc_format='pdf')