diff --git a/CHANGES.rst b/CHANGES.rst index a43bc06a1..2d8933419 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -24,6 +24,8 @@ New Features: Fixed: +* the 'nested bulleted/enumerated list' selectors were broken; their + corresponding styles were never applied * items inside a table cannot be referenced (issue #174) * Sphinx frontend: fix handling of relative image paths in .rst files inside a directory in the Sphinx project root diff --git a/src/rinoh/stylesheets/matcher.py b/src/rinoh/stylesheets/matcher.py index 550838b16..92cf57da6 100644 --- a/src/rinoh/stylesheets/matcher.py +++ b/src/rinoh/stylesheets/matcher.py @@ -123,11 +123,14 @@ # lists matcher('list item label', ListItemLabel) +matcher('list item body', ListItem / GroupedFlowables) +matcher('list item paragraph', 'list item body' / Paragraph) matcher('enumerated list', List.like('enumerated')) matcher('enumerated list item', 'enumerated list' / ListItem) matcher('enumerated list item label', 'enumerated list item' / ListItemLabel) -matcher('nested enumerated list', ListItem / 'enumerated list') +matcher('nested enumerated list', SelectorByName('list item body') + / 'enumerated list') matcher('(table) enumerated list', TableCell / ... / 'enumerated list') matcher('(table) enumerated list item', '(table) enumerated list' / ListItem) @@ -138,7 +141,8 @@ matcher('compact bulleted list', List.like('bulleted', compact=True)) matcher('bulleted list item', 'bulleted list' / ListItem) matcher('bulleted list item label', 'bulleted list item' / ListItemLabel) -matcher('nested bulleted list', ListItem / 'bulleted list') +matcher('nested bulleted list', SelectorByName('list item body') + / 'bulleted list') matcher('(table) bulleted list', TableCell / ... / 'bulleted list') matcher('(table) bulleted list item', '(table) bulleted list' / ListItem) @@ -161,9 +165,6 @@ matcher('choices list item', 'choices list' / ListItem) matcher('choices list item label', 'choices list item' / ListItemLabel) -matcher('list item body', ListItem / GroupedFlowables) -matcher('list item paragraph', 'list item body' / Paragraph) - matcher('definition list', DefinitionList) matcher('definition list item', 'definition list' / LabeledFlowable) matcher('definition term', 'definition list item' diff --git a/tests_regression/rst/bullet_list.pdf b/tests_regression/rst/bullet_list.pdf index ed8423867..0f6023449 100644 Binary files a/tests_regression/rst/bullet_list.pdf and b/tests_regression/rst/bullet_list.pdf differ diff --git a/tests_regression/rst/bullet_list.stylelog b/tests_regression/rst/bullet_list.stylelog index 18e97806e..2cb933f84 100644 --- a/tests_regression/rst/bullet_list.stylelog +++ b/tests_regression/rst/bullet_list.stylelog @@ -8,7 +8,7 @@ DocumentTree() List(style='bulleted') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:2 > (0,0,1,0,2) bulleted list - ListItem() + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -18,7 +18,7 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('A bullet list') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:2 > (0,0,0,0,5) list item paragraph @@ -26,8 +26,9 @@ MixedStyledText('A bullet list') SingleStyledText('A bullet list') List(style='bulleted') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:4 - > (0,0,1,0,2) bulleted list - ListItem() + > (0,0,1,0,5) nested bulleted list + (0,0,1,0,2) bulleted list + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -37,14 +38,14 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Nested bullet list') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:4 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('Nested bullet list') SingleStyledText('Nested bullet list') - ListItem() + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -54,14 +55,14 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Nested item 2') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:5 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('Nested item 2') SingleStyledText('Nested item 2') - ListItem() + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -71,7 +72,7 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Item 2') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:7 > (0,0,0,0,5) list item paragraph @@ -84,8 +85,9 @@ MixedStyledText('Paragraph 2 of item 2') SingleStyledText('Paragraph 2 of item 2') List(style='bulleted') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:11 - > (0,0,1,0,2) bulleted list - ListItem() + > (0,0,1,0,5) nested bulleted list + (0,0,1,0,2) bulleted list + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -95,14 +97,14 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Nested bullet list') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:11 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('Nested bullet list') SingleStyledText('Nested bullet list') - ListItem() + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -112,7 +114,7 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Nested item 2') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:12 > (0,0,0,0,5) list item paragraph @@ -120,8 +122,9 @@ MixedStyledText('Nested item 2') SingleStyledText('Nested item 2') List(style='bulleted') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:14 - > (0,0,1,0,2) bulleted list - ListItem() + > (0,0,1,0,5) nested bulleted list + (0,0,1,0,2) bulleted list + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -131,14 +134,14 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Third level') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:14 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('Third level') SingleStyledText('Third level') - ListItem() + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -148,14 +151,14 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Item 2') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:15 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('Item 2') SingleStyledText('Item 2') - ListItem() + ListItem() None:None x (0,0,1,0,4) bulleted list item > fallback to default style ListItemLabel('•') @@ -165,7 +168,7 @@ SingleStyledText('') SingleStyledText('•') SingleStyledText('') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Nested item 3') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/bullet_list.rst:17 > (0,0,0,0,5) list item paragraph diff --git a/tests_regression/rst/enumerated_list.pdf b/tests_regression/rst/enumerated_list.pdf index 509770d99..a77592cfa 100644 Binary files a/tests_regression/rst/enumerated_list.pdf and b/tests_regression/rst/enumerated_list.pdf differ diff --git a/tests_regression/rst/enumerated_list.stylelog b/tests_regression/rst/enumerated_list.stylelog index 6eab46e15..07d1cc7c8 100644 --- a/tests_regression/rst/enumerated_list.stylelog +++ b/tests_regression/rst/enumerated_list.stylelog @@ -8,7 +8,7 @@ DocumentTree() List(style='enumerated') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:2 > (0,0,1,0,2) enumerated list - ListItem() + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('1.') @@ -17,7 +17,7 @@ MixedStyledText('1.') SingleStyledText('1') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Arabic numerals') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:2 > (0,0,0,0,5) list item paragraph @@ -25,8 +25,9 @@ MixedStyledText('Arabic numerals') SingleStyledText('Arabic numerals') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('1.') @@ -35,7 +36,7 @@ MixedStyledText('1.') SingleStyledText('1') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('lower alpha)') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:4 > (0,0,0,0,5) list item paragraph @@ -43,8 +44,9 @@ MixedStyledText('lower alpha)') SingleStyledText('lower alpha)') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('1.') @@ -53,7 +55,7 @@ MixedStyledText('1.') SingleStyledText('1') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('(lower roman)') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:6 > (0,0,0,0,5) list item paragraph @@ -61,8 +63,9 @@ MixedStyledText('(lower roman)') SingleStyledText('(lower roman)') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('1.') @@ -71,7 +74,7 @@ MixedStyledText('1.') SingleStyledText('1') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('upper alpha') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:8 > (0,0,0,0,5) list item paragraph @@ -79,8 +82,9 @@ MixedStyledText('upper alpha') SingleStyledText('upper alpha') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('1.') @@ -89,14 +93,14 @@ MixedStyledText('1.') SingleStyledText('1') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('upper roman)') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:10 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('upper roman)') SingleStyledText('upper roman)') - ListItem() + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('2.') @@ -105,7 +109,7 @@ MixedStyledText('2.') SingleStyledText('2') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Lists that don't start at 1:') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:12 > (0,0,0,0,5) list item paragraph @@ -113,8 +117,9 @@ MixedStyledText('Lists that don't start at 1:') SingleStyledText('Lists that don't start at 1:') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('3.') @@ -123,14 +128,14 @@ MixedStyledText('3.') SingleStyledText('3') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Three') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:14 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('Three') SingleStyledText('Three') - ListItem() + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('4.') @@ -139,7 +144,7 @@ MixedStyledText('4.') SingleStyledText('4') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('Four') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:16 > (0,0,0,0,5) list item paragraph @@ -147,8 +152,9 @@ MixedStyledText('Four') SingleStyledText('Four') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('3.') @@ -157,14 +163,14 @@ MixedStyledText('3.') SingleStyledText('3') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('C') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:18 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('C') SingleStyledText('C') - ListItem() + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('4.') @@ -173,7 +179,7 @@ MixedStyledText('4.') SingleStyledText('4') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('D') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:20 > (0,0,0,0,5) list item paragraph @@ -181,8 +187,9 @@ MixedStyledText('D') SingleStyledText('D') List(style='enumerated') None:None - > (0,0,1,0,2) enumerated list - ListItem() + > (0,0,1,0,5) nested enumerated list + (0,0,1,0,2) enumerated list + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('3.') @@ -191,14 +198,14 @@ MixedStyledText('3.') SingleStyledText('3') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('iii') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:22 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('iii') SingleStyledText('iii') - ListItem() + ListItem() None:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('4.') @@ -207,14 +214,14 @@ MixedStyledText('4.') SingleStyledText('4') SingleStyledText('.') - StaticGroupedFlowables() None:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('iv') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:24 > (0,0,0,0,5) list item paragraph (0,0,0,0,2) body MixedStyledText('iv') SingleStyledText('iv') - ListItem() + ListItem() /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:None x (0,0,1,0,4) enumerated list item > fallback to default style ListItemLabel('3.') @@ -223,7 +230,7 @@ MixedStyledText('3.') SingleStyledText('3') SingleStyledText('.') - StaticGroupedFlowables() /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:None + StaticGroupedFlowables() > (0,0,0,0,3) list item body Paragraph('List items may also be auto-enum...') /Users/brechtm/Documents/Code/rinohtype/tests_regression/rst/enumerated_list.rst:26 > (0,0,0,0,5) list item paragraph