Skip to content

Commit

Permalink
Allow $(ref references to be split across lines
Browse files Browse the repository at this point in the history
BUG=354594
NOTRY=true

Review URL: https://codereview.chromium.org/205243007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258942 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ahernandez.miralles@gmail.com committed Mar 24, 2014
1 parent c00d325 commit ecd7c10
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chrome/common/extensions/docs/server2/document_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _RenderLinks(self, document, path):
new_document.append(document[cursor_index:end_ref_index + 1])
else:
ref = document[start_ref_index:end_ref_index]
ref_parts = ref[len(START_REF):].split(' ', 1)
ref_parts = ref[len(START_REF):].split(None, 1)

# Guess the api name from the html name, replacing '_' with '.' (e.g.
# if the page is app_window.html, guess the api name is app.window)
Expand Down
15 changes: 15 additions & 0 deletions chrome/common/extensions/docs/server2/document_renderer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ def testRefInTitle(self):
self.assertEqual(expected_document, text)
self.assertEqual([], warnings)

def testRefSplitAcrossLines(self):
document = 'Hello, $(ref:baz.baz_e1 world). A $(ref:foo.foo_t3\n link)'
expected_document = ('Hello, <a href=#type-baz_e1>world</a>. A <a href='
'#type-foo_t3>link</a>')

path = 'some/path/to/document.html'

text, warnings = self._renderer.Render(document, path)
self.assertEqual(expected_document, text)
self.assertEqual([], warnings)

text, warnings = self._renderer.Render(document, path, render_title=True)
self.assertEqual(expected_document, text)
self.assertEqual(['Expected a title'], warnings)

def testInvalidRef(self):
# There needs to be more than 100 characters between the invalid ref
# and the next ref
Expand Down

0 comments on commit ecd7c10

Please sign in to comment.