def test_multiline_comment(self): """Multi-line spans should close at the end of one line and reopen at the beginning of the next.""" c = Region('c') c2 = Region('c') l = LINE tags = [(0, True, c), (79, False, c), (80, False, l), (80, True, c2), (151, False, l), (222, False, l), (284, False, c2), (285, False, l), (286, False, l)] text = u"""/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ """ eq_(list(html_lines(balanced_tags(tags), text.__getslice__)), ['<span class="c">/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>', '<span class="c">/* This Source Code Form is subject to the terms of the Mozilla Public</span>', '<span class="c"> * License, v. 2.0. If a copy of the MPL was not distributed with this</span>', '<span class="c"> * file, You can obtain one at http://mozilla.org/MPL/2.0/. */</span>', ''])
def test_simple_html_lines(): """See if the offsets are right in simple HTML stitching.""" a = Region('a') b = Region('b') line = LINE eq_(''.join(html_lines([(0, True, line), (0, True, a), (3, False, a), (3, True, b), (5, False, b), (5, False, line)], 'hello'.__getslice__)), '<span class="a">hel</span><span class="b">lo</span>')
def test_simple_html_lines(): """See if the offsets are right in simple HTML stitching.""" a = Region('a') b = Region('b') line = LINE eq_( ''.join( html_lines([(0, True, line), (0, True, a), (3, False, a), (3, True, b), (5, False, b), (5, False, line)], 'hello'.__getslice__)), '<span class="a">hel</span><span class="b">lo</span>')
def test_multiline_comment(self): """Multi-line spans should close at the end of one line and reopen at the beginning of the next.""" c = Region('c') c2 = Region('c') l = LINE tags = [(0, True, c), (79, False, c), (80, False, l), (80, True, c2), (151, False, l), (222, False, l), (284, False, c2), (285, False, l), (286, False, l)] text = u"""/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ """ eq_(list(html_lines(balanced_tags(tags), text.__getslice__)), [ '<span class="c">/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>', '<span class="c">/* This Source Code Form is subject to the terms of the Mozilla Public</span>', '<span class="c"> * License, v. 2.0. If a copy of the MPL was not distributed with this</span>', '<span class="c"> * file, You can obtain one at http://mozilla.org/MPL/2.0/. */</span>', '' ])