Commit 255aa291 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_corporate_identity&test: get correct a tag

parent da6255c7
...@@ -11,6 +11,7 @@ import re ...@@ -11,6 +11,7 @@ import re
blank = "" blank = ""
for link in re.findall('([^[]<a.*?</a>[^]])', doc_content or blank): for link in re.findall('([^[]<a.*?</a>[^]])', doc_content or blank):
link = link[1:-1]
link_reference_list = re.findall('href=\"(.*?)\"', link) link_reference_list = re.findall('href=\"(.*?)\"', link)
if link_reference_list: if link_reference_list:
link_reference = link_reference_list[0] link_reference = link_reference_list[0]
......
...@@ -55,6 +55,7 @@ if doc_content.find('${WebPage_') != -1: ...@@ -55,6 +55,7 @@ if doc_content.find('${WebPage_') != -1:
# call it with the parameters provided # call it with the parameters provided
for link in re.findall('([^[]<a.*?</a>[^]])', doc_content): for link in re.findall('([^[]<a.*?</a>[^]])', doc_content):
link = link[1:-1]
link_reference_list = re.findall('href=\"(.*?)\"', link) link_reference_list = re.findall('href=\"(.*?)\"', link)
if link_reference_list: if link_reference_list:
link_reference = link_reference_list[0] link_reference = link_reference_list[0]
......
...@@ -494,13 +494,15 @@ within corelated noise and vibration in allowed by regulations levels [<a href=" ...@@ -494,13 +494,15 @@ within corelated noise and vibration in allowed by regulations levels [<a href="
Finally an abbreviation: [<a href="#AB-1" title="Enterprise Research Planning">AB-1</a>], Finally an abbreviation: [<a href="#AB-1" title="Enterprise Research Planning">AB-1</a>],
mixed with another link to an external <a href="https://google.com">document</a> mixed with another link to an external <a href="https://google.com">document</a>
which should not be touched. which should not be touched.
</p><h1><a name="header-embedded-document12_anchor"></a>Header Embedded Document<a class="custom-para" href=#header-embedded-document12_anchor><span style="font-size:.75em;line-height:1em;padding-left:.5em;">&para;</span></a></h1> </p>
<h1><a name="header-embedded-document12_anchor"></a>Header Embedded Document<a class="custom-para" href=#header-embedded-document12_anchor><span style="font-size:.75em;line-height:1em;padding-left:.5em;">&para;</span></a></h1>
<p>This is the content of an embedded document loaded via reference.</p> <p>This is the content of an embedded document loaded via reference.</p>
<h2><a name="header-embedded-document-content-examples13_anchor"></a>Header Embedded Document content Examples<a class="custom-para" href=#header-embedded-document-content-examples13_anchor><span style="font-size:.75em;line-height:1em;padding-left:.5em;">&para;</span></a></h2> <h2><a name="header-embedded-document-content-examples13_anchor"></a>Header Embedded Document content Examples<a class="custom-para" href=#header-embedded-document-content-examples13_anchor><span style="font-size:.75em;line-height:1em;padding-left:.5em;">&para;</span></a></h2>
<p>Some more references to include in the overall tables <p>Some more references to include in the overall tables
[<a href="#AD-2" title="Gnu">AD-2</a>], as well another image. [<a href="#AD-2" title="Gnu">AD-2</a>], as well another image.
</p> </p>
<a href="#Figure-1"></a><p class="ci-book-img" style="text-align:center"><img src="Template.Test.Illustration.Reach?format=png&amp;display=medium" alt="Reach" /></p><span>Figure-1 - Reach</span> <a href="#Figure-1"></a><p class="ci-book-img" style="text-align:center"><img src="Template.Test.Illustration.Reach?format=png&amp;display=medium" alt="Reach" /></p><span>Figure-1 - Reach</span>
<p>Another example of an image and a table of data</p> <p>Another example of an image and a table of data</p>
<a href="#Figure-2"></a><p class="ci-book-img" style="text-align:center"><img src="Template.Test.Image.Office?format=png&amp;display=medium" alt="Caption for this image" /></p><span>Figure-2 - Caption for this image</span> <a href="#Figure-2"></a><p class="ci-book-img" style="text-align:center"><img src="Template.Test.Image.Office?format=png&amp;display=medium" alt="Caption for this image" /></p><span>Figure-2 - Caption for this image</span>
<p>Another example of an image and a table of data</p> <p>Another example of an image and a table of data</p>
......
...@@ -190,7 +190,7 @@ class TestCorporateIdentityMethod(ERP5TypeTestCase): ...@@ -190,7 +190,7 @@ class TestCorporateIdentityMethod(ERP5TypeTestCase):
# be careful of space between <div> <a> # be careful of space between <div> <a>
doc_content = '<div> <a href="Template.Test.Book.Embeddable.Document">This link should be embedded</a> </div>' doc_content = '<div> <a href="Template.Test.Book.Embeddable.Document">This link should be embedded</a> </div>'
output =web_page.WebPage_embedLinkedDocumentList(doc_content) output =web_page.WebPage_embedLinkedDocumentList(doc_content)
self.assertEqual(output, '<div>%s</div>' %web_page.restrictedTraverse('Template.Test.Book.Embeddable.Document').asStrippedHTML()) self.assertEqual(output, '<div> %s </div>' %web_page.restrictedTraverse('Template.Test.Book.Embeddable.Document').asStrippedHTML())
def test_webPage_embedReportDocumentList(self): def test_webPage_embedReportDocumentList(self):
web_page_no_follow_up = self.portal.web_page_module.template_test_slideshow_input_001_en_html web_page_no_follow_up = self.portal.web_page_module.template_test_slideshow_input_001_en_html
...@@ -206,11 +206,11 @@ class TestCorporateIdentityMethod(ERP5TypeTestCase): ...@@ -206,11 +206,11 @@ class TestCorporateIdentityMethod(ERP5TypeTestCase):
# it has no matter with/without follow up # it has no matter with/without follow up
doc_content = '<div> <a href="sale_opportunity_module/template_test_embed_sale_opportunity?report=Base_generateCorporareIdentityTestReport&amp;test=23"></a> </div>' doc_content = '<div> <a href="sale_opportunity_module/template_test_embed_sale_opportunity?report=Base_generateCorporareIdentityTestReport&amp;test=23"></a> </div>'
output =web_page_with_follow_up.WebPage_embedReportDocumentList(doc_content) output =web_page_with_follow_up.WebPage_embedReportDocumentList(doc_content)
self.assertEqual(output, '<div>test report {"test": "23", "document_language": null, "format": null}</div>') self.assertEqual(output, '<div> test report {"test": "23", "document_language": null, "format": null} </div>')
doc_content = '<div> <a href="sale_opportunity_module/template_test_embed_sale_opportunity?report=Base_generateCorporareIdentityTestReport&amp;test=23"></a> </div>' doc_content = '<div> <a href="sale_opportunity_module/template_test_embed_sale_opportunity?report=Base_generateCorporareIdentityTestReport&amp;test=23"></a> </div>'
output =web_page_no_follow_up.WebPage_embedReportDocumentList(doc_content) output =web_page_no_follow_up.WebPage_embedReportDocumentList(doc_content)
self.assertEqual(output, '<div>test report {"test": "23", "document_language": null, "format": null}</div>') self.assertEqual(output, '<div> test report {"test": "23", "document_language": null, "format": null} </div>')
def test_getTemplateProxyParameter_override_person(self): def test_getTemplateProxyParameter_override_person(self):
output_dict_list = self.test_person.Base_getTemplateProxyParameter( output_dict_list = self.test_person.Base_getTemplateProxyParameter(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment