Пример #1
0
  def assertGeneratesText(self, infile, expected_outfile):
    with open(expected_outfile, "r", encoding="utf-8") as expected_outfile:
      expected_result = expected_outfile.read()

    with open(infile, "r", encoding="utf-8") as infile:
      with io.StringIO() as outfile:
        chordpro.to_ast(infile).write_out(textwriter.TextWriter(outfile))
        result = outfile.getvalue()

    self.assertMultiLineEqual(result, expected_result)
Пример #2
0
def main(args):
  args = _parse_options(args)

  with args.outfile as outfile:
    if outfile == sys.stdout:
      # TODO: This is a hack to use sys.stdout in binary mode.
      # The input streams use the system encoding. (Set LANG=en_US.UTF-8)
      outfile = getattr(outfile, 'buffer', outfile)

    with args.infile as infile:
      pdf_writer = pdfwriter.PdfWriter(outfile, pagesizes.A4)
      chordpro.to_ast(infile).write_out(pdf_writer)
Пример #3
0
def main(args):
    args = _parse_options(args)

    with args.outfile as outfile:
        if outfile == sys.stdout:
            # TODO: This is a hack to use sys.stdout in binary mode.
            # The input streams use the system encoding. (Set LANG=en_US.UTF-8)
            outfile = getattr(outfile, 'buffer', outfile)

        with args.infile as infile:
            pdf_writer = pdfwriter.PdfWriter(outfile, pagesizes.A4)
            chordpro.to_ast(infile).write_out(pdf_writer)