path: root/test/tools
diff options
authorPhilip Chimento <>2015-06-18 13:58:53 -0700
committerPhilip Chimento <>2015-06-18 14:04:37 -0700
commitac66ca54c46a8701c2e1c78c31225cf1ce5fe2da (patch)
treec021e20d52b677fe49a59e1a42fbd5ab62999c99 /test/tools
parenta2fe0c90e6cbc4d95f772f945833e5dd4255dca8 (diff)
Handle HTML with embedded tags
When an element, such as <p>, has a name="translatable" attribute, we also want to grab markup tags inside the element and translate them as well. For example, previously this HTML: <p name="translatable">An embedded <b>tag</b> in a paragraph</p> would result in the following string being extracted: _("An embedded"); However, we want it to be: _("An embedded <b>tag</b> in a paragraph"); This removes the use of BeautifulSoup from the eos-html-extractor script. Unfortunately BeautifulSoup could have done this quite easily, but it does not provide any line number information, which we need. Previously in order to get the line numbers we also used html.parser from Python's standard library, to augment the data we got from BeautifulSoup. However, this issue required html.parser to do all the work that BeautifulSoup did anyway, so there is no reason to use BeautifulSoup anymore. [endlessm/eos-sdk#3291]
Diffstat (limited to 'test/tools')
2 files changed, 4 insertions, 1 deletions
diff --git a/test/tools/test.html b/test/tools/test.html
index 6687013..18c07e3 100644
--- a/test/tools/test.html
+++ b/test/tools/test.html
@@ -20,6 +20,7 @@
but that doesn't matter to HTML.
<span name="translatable">String with a "quote"</span>
+ <span name="translatable">String with<br>embedded <b>tags</b></span>
diff --git a/test/tools/testHtmlExtractor.js b/test/tools/testHtmlExtractor.js
index 7d622e1..c1bde4e 100644
--- a/test/tools/testHtmlExtractor.js
+++ b/test/tools/testHtmlExtractor.js
@@ -11,7 +11,9 @@ _("Choose a template");\n\
#line 21 "test/tools/test.html"\n\
_("This is a string that is spread over multiple lines, but that doesn\'t matter to HTML.");\n\
#line 22 "test/tools/test.html"\n\
-_("String with a \\"quote\\"");\n';
+_("String with a \\"quote\\"");\n\
+#line 23 "test/tools/test.html"\n\
+_("String with<br>embedded <b>tags</b>");\n';
describe('eos-html-extractor', function () {
it('works correctly at a minimum', function () {