Esempio n. 1
0
    def analyzeHTML(self, s):
        result = None
        if None == s:
            self._isHTML = False
            self.numberOfLinesHigh = 0
            self.numberOfCharsWide = 0

        elif hasattr(s, "startswith") and not s.startswith("<html>"):
            # no html==>plain text
            self._isHTML = False
            self.numberOfLinesHigh = 1
            self.numberOfCharsWide = len(s)
            result = s

        else:
            # HTML
            self._isHTML = True
            # <html> is just a flag, not a tag, so strip it out.
            result = s[HTML_LEN:]
            if self.widthUpperBound == NAI:
                self.numberOfCharsWide = htmlWidth(result)


            if self.heightUpperBound == NAI:
                self.numberOfLinesHigh = htmlHeight(result)



        return result
Esempio n. 2
0
    def analyzeHTML(self, s):
        result = None
        if None == s:
            self._isHTML = False
            self.numberOfLinesHigh = 0
            self.numberOfCharsWide = 0

        elif hasattr(s, "startswith") and not s.startswith("<html>"):
            # no html==>plain text
            self._isHTML = False
            self.numberOfLinesHigh = 1
            self.numberOfCharsWide = len(s)
            result = s

        else:
            # HTML
            self._isHTML = True
            # <html> is just a flag, not a tag, so strip it out.
            result = s[HTML_LEN:]
            if self.widthUpperBound == NAI:
                self.numberOfCharsWide = htmlWidth(result)

            if self.heightUpperBound == NAI:
                self.numberOfLinesHigh = htmlHeight(result)

        return result
Esempio n. 3
0
def getNumberOfCharsWide(s):
    result = 0
    if not s.startswith("<html>"):
        result = len(s)

    else:
        result = htmlWidth(s)

    return result
Esempio n. 4
0
def getNumberOfCharsWide(s):
    result = 0
    if not s.startswith("<html>"):
        result = len(s)

    else:
        result = htmlWidth(s)

    return result