Get linear attrib for spine names as well

This commit is contained in:
Kovid Goyal 2013-10-08 16:17:27 +05:30
parent 47b438db2b
commit e34477da93
2 changed files with 4 additions and 4 deletions

View File

@ -319,15 +319,15 @@ class Container(object): # {{{
path = self.name_path_map.get(name, None) path = self.name_path_map.get(name, None)
if path: if path:
if item.get('linear', 'yes') == 'yes': if item.get('linear', 'yes') == 'yes':
yield name yield name, True
else: else:
non_linear.append(name) non_linear.append(name)
for name in non_linear: for name in non_linear:
yield name yield name, False
@property @property
def spine_items(self): def spine_items(self):
for name in self.spine_names: for name, linear in self.spine_names:
yield self.name_path_map[name] yield self.name_path_map[name]
def remove_item(self, name): def remove_item(self, name):

View File

@ -35,7 +35,7 @@ class ContainerTests(BaseTest):
self.assertIn(name, c2.name_path_map) self.assertIn(name, c2.name_path_map)
self.assertEqual(c1.open(name).read(), c2.open(name).read(), 'The file %s differs' % name) self.assertEqual(c1.open(name).read(), c2.open(name).read(), 'The file %s differs' % name)
spine_names = tuple(c1.spine_names) spine_names = tuple(x[0] for x in c1.spine_names)
text = spine_names[0] text = spine_names[0]
root = c2.parsed(text) root = c2.parsed(text)
root.xpath('//*[local-name()="body"]')[0].set('id', 'changed id for test') root.xpath('//*[local-name()="body"]')[0].set('id', 'changed id for test')