diff --git a/bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py b/bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py index 4b8bca8745d37df1d9030335bfbeb8db4037c888..b08a55353b10fb9743c74b741481378295507f34 100644 --- a/bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py +++ b/bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py @@ -109,3 +109,45 @@ def parseTutorial(text): def urlread(url): import urllib return urllib.urlopen(url).read() + + +""" + Remove everything but the test in a webpage +""" +def extractTest(title, text): + import lxml.html + from lxml import etree + root = lxml.html.fromstring(text) + table_list = root.xpath('//test') + html = """ +<html xmlns:tal="http://xml.zope.org/namespaces/tal" + xmlns:metal="http://xml.zope.org/namespaces/metal"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>"""+ title + """</title> + </head> + <body> + <table name="SELENIUM-TEST" cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr class="title"> + <td colspan="3">"""+ title + """</td> + </tr> + </thead> + <tbody> +""" + + for table in table_list: + table = table[0] + if len(table) > 0: + for row in table[-1]: + if len(row) == 1: + # Include Macros as it is defined by the user. + html += row[0].text + else: + html += lxml.html.tostring(row) + html +=""" + </tbody> + </table> + </body> +</html>""" + return html \ No newline at end of file diff --git a/bt5/erp5_run_my_doc/bt/revision b/bt5/erp5_run_my_doc/bt/revision index 7003e7fe1fa0b91d6e034f2f7ac38f2f5989f85c..613955421088a491231b1c6c7766f0f95a5c5824 100644 --- a/bt5/erp5_run_my_doc/bt/revision +++ b/bt5/erp5_run_my_doc/bt/revision @@ -1 +1 @@ -51 \ No newline at end of file +52 \ No newline at end of file