# -*- coding: utf-8 -*- """novelWriter HTML Text Converter novelWriter – HTML Text Converter =================================== Extends the Tokenizer class to write HTML File History: Created: 2019-05-07 [0.0.1] """ import logging import nw from nw.convert.tokenizer import Tokenizer logger = logging.getLogger(__name__) class ToHtml(Tokenizer): def __init__(self, theProject, theParent): Tokenizer.__init__(self, theProject, theParent) return def doConvert(self): htmlTags = { self.FMT_B_B : "", self.FMT_B_E : "", self.FMT_I_B : "", self.FMT_I_E : "", self.FMT_U_B : "", self.FMT_U_E : "", } self.theResult = "" thisPar = [] for tType, tText, tFormat in self.theTokens: if tType == "empty": if len(thisPar) > 0: self.theResult += "
%s
\n" % " ".join(thisPar) thisPar = [] elif tType == "header1": self.theResult += "