1313from .attribute import Attribute , Bool , Integer , OverrideDefault
1414from .draw import Line , LineStyle
1515from .element import create_destination
16- from .flowable import GroupedFlowables , StaticGroupedFlowables , WarnFlowable
16+ from .flowable import (GroupedFlowables , LabeledFlowableStyle ,
17+ StaticGroupedFlowables , WarnFlowable )
1718from .flowable import LabeledFlowable , GroupedLabeledFlowables
1819from .flowable import Flowable , FlowableStyle , GroupedFlowablesStyle
1920from .layout import PageBreakException
2627from .strings import StringField
2728from .util import NotImplementedAttribute , itemcount
2829
30+
2931__all__ = ['Section' , 'Heading' , 'ListStyle' , 'List' , 'ListItem' ,
3032 'ListItemLabel' , 'ListItemLabelStyle' , 'DefinitionList' ,
3133 'Header' , 'Footer' ,
3234 'TableOfContentsSection' , 'TableOfContents' , 'TableOfContentsStyle' ,
3335 'ListOfStyle' , 'ListOfEntry' , 'ListOfEntryStyle' ,
3436 'TableOfContentsEntry' , 'Admonition' , 'AdmonitionStyle' ,
35- 'AdmonitionTitleParagraph' ,
37+ 'AdmonitionFlowables' , ' AdmonitionTitleParagraph' ,
3638 'HorizontalRule' , 'HorizontalRuleStyle' , 'OutOfLineFlowables' ]
3739
3840
@@ -400,17 +402,17 @@ class ListOfEntry(ReferencingParagraph):
400402 style_class = ListOfEntryStyle
401403
402404
403- class AdmonitionStyle (GroupedFlowablesStyle ):
405+ class AdmonitionStyle (LabeledFlowableStyle ):
404406 inline_title = Attribute (Bool , True , "Show the admonition's title inline "
405407 "with the body text, if possible" )
406408
407409
408- class Admonition (StaticGroupedFlowables ):
410+ class Admonition (LabeledFlowable ):
409411 style_class = AdmonitionStyle
410412
411- def __init__ (self , flowables , title = None , type = None ,
413+ def __init__ (self , label , flowable , title = None , type = None ,
412414 id = None , style = None , parent = None ):
413- super ().__init__ (flowables , id = id , style = style , parent = parent )
415+ super ().__init__ (label , flowable , id = id , style = style , parent = parent )
414416 self .custom_title = title
415417 self .admonition_type = type
416418
@@ -421,13 +423,16 @@ def custom_title_text(self):
421423 def title (self , document ):
422424 return self .custom_title or document .get_string (self .admonition_type )
423425
426+
427+ class AdmonitionFlowables (StaticGroupedFlowables ):
428+
424429 def flowables (self , container ):
425- title = self .title (container .document )
430+ title = self .parent . title (container .document )
426431 with suppress (AttributeError ):
427432 title = title .copy ()
428433 flowables = super ().flowables (container )
429434 first_flowable = next (flowables )
430- inline_title = self .get_style ('inline_title' , container )
435+ inline_title = self .parent . get_style ('inline_title' , container )
431436 if inline_title and isinstance (first_flowable , Paragraph ):
432437 title = MixedStyledText (title , style = 'inline title' )
433438 kwargs = dict (id = first_flowable .id , style = first_flowable .style ,
0 commit comments