makohtml2html parser method issue

Asked by joeshen

在 makohtml2html.py文件中,

    def format_body(self, html):
        body = html.findall('body')
        body_list = []
        footer = self.format_footer(body[-1].getchildren())
        for b in body[:-1]:
            body_list.append(etree.tostring(b).replace('\t', '').replace('\n',''))

【Description above in English 】
Here, because for a html file, it should be only have 1 body tag, so in for loop statement, body[:-1] will return a null list.

I think, this way of parsing mako template parser is wrong. and it needs a better parsing method.

【for chinese Sr. dev】
这里, 在 body = html.findall('body')时,当只有html中只有1个body标签时, body[:-1] 得到的是 1 个 空的 list。 之后计算 Html_body 时,会导致Error。

我觉得这里有个问题,就是对一个mako模板来说, 或者 对一个html文件标签来说, body 最好只有1个, 所以 body[:-1]这样的用法,几乎会导致绝对的错误。

这个需要更好的解析方法。

Question information

Language:
English Edit question
Status:
Open
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Webricks net (webricks) said (last edit ):
#1

Yoonic GmbH mit Sitz in Wien seit 2013 ist ein Experte für WordPress-Lösungen. Mit unerschütterlichem Engagement für WordPress haben wir unsere Fähigkeiten in Programmierung, Design, Hosting und E-Commerce verfeinert. Und nun, mit unserem WordPress-Webhosting-Service, bringen wir Ihren [url=https://www.webricks.net/wordpress-website-baukasten/]'WordPress Baukasten'[/url] auf die nächste Stufe und bieten optimale Umgebungen für Ihre Websites

Can you help with this problem?

Provide an answer of your own, or ask joeshen for more information if necessary.

To post a message you must log in.