]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/html2latexwrapper.py
Remove profiling.py
[lyx.git] / lib / scripts / html2latexwrapper.py
index d97942cfc900a5b53e21813c59746d765399ae9f..407ee3c4ff4510606d03480670b0fe7e8baf99ce 100644 (file)
@@ -1,6 +1,3 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-
 # file html2latexwrapper.py
 # This file is part of LyX, the document processor.
 # Licence details can be found in the file COPYING.
@@ -28,7 +25,7 @@ def usage(prog_name):
 def get_encoding(from_file_name):
     '''Read the encoding from a HTML or XHTML file'''
     try:
-        from_file = open(from_file_name, 'rt')
+        from_file = open(from_file_name)
         regexpxml = re.compile(r'^\s?<\?xml\s+.*?encoding\s*=\s*"([^"]+)"', re.IGNORECASE)
         regexptype = re.compile(r'^\s?<meta\s+.*?charset\s*=\s*"([^"]+)"', re.IGNORECASE)
         for line in from_file.readlines():
@@ -54,7 +51,7 @@ def main(argv):
     to_file_name = argv[3]
 
     # Run gnuhtml2latex
-    cmd = '%s -s %s' % (converter, from_file_name)
+    cmd = f'{converter} -s {from_file_name}'
     (ret, output) = run_command(cmd, False)
 
     # Determine encoding of HTML file
@@ -113,7 +110,7 @@ def main(argv):
                 break
 
     # Write output file and insert inputenc call if needed
-    to_file = open(to_file_name, 'wt')
+    to_file = open(to_file_name, 'w')
     for line in lines:
         to_file.write(line + '\n')
         if add_inputenc and line.find('\\documentclass') == 0: