# file html2latexwrapper.py
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
# author Georg Baum
# Full author contact details are available in file CREDITS
# Usage:
# html2latexwrapper.py
# This script will call -s >
# and add a \usepackage{inputenc} line if needed.
import os, string, sys, re
from lyxpreview_tools import error, run_command
def usage(prog_name):
return "Usage: %s " % prog_name
def get_encoding(from_file_name):
'''Read the encoding from a HTML or XHTML file'''
try:
from_file = open(from_file_name)
regexpxml = re.compile(r'^\s?<\?xml\s+.*?encoding\s*=\s*"([^"]+)"', re.IGNORECASE)
regexptype = re.compile(r'^\s?