예제 #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])
예제 #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])
예제 #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()
예제 #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")))
예제 #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,
    )
예제 #6
0
파일: scripts.py 프로젝트: aaren/Pweave
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)
예제 #7
0
파일: scripts.py 프로젝트: joelkim/Pweave
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)
예제 #9
0
import pweave
pweave.publish('midterm.pmd', doc_format='pdf')