File tree Expand file tree Collapse file tree 4 files changed +60
-28
lines changed Expand file tree Collapse file tree 4 files changed +60
-28
lines changed Original file line number Diff line number Diff line change @@ -130,38 +130,33 @@ quartodoc:
130
130
- create_inventory
131
131
- convert_inventory
132
132
133
- - title : " Data models: structural"
133
+ - title : " Data models"
134
+
135
+ - subtitle : " Structural"
134
136
desc : |
135
137
Classes for specifying the broad structure your docs.
136
138
contents :
137
- - kind : " page"
138
- path : " layouts-structure"
139
- flatten : true
140
- contents :
141
- - layout.Layout
142
- - layout.Section
143
- - layout.Page
144
- - layout.SectionElement
145
- - layout.ContentElement
139
+ - layout.Layout
140
+ - layout.Section
141
+ - layout.Page
142
+ - layout.SectionElement
143
+ - layout.ContentElement
146
144
147
- - title : " Data models: docable "
145
+ - subtitle : " Docable "
148
146
desc : |
149
147
Classes representing python objects to be rendered.
150
148
contents :
151
- - kind : " page"
152
- path : " layouts-docable"
153
- flatten : true
154
- contents :
155
- - name : layout.Doc
156
- members : []
157
- - layout.DocFunction
158
- - layout.DocAttribute
159
- - layout.DocModule
160
- - layout.DocClass
161
- - layout.Link
162
- - layout.Item
163
- - layout.ChoicesChildren
164
- - title : " Data models: docstring patches"
149
+ - name : layout.Doc
150
+ members : []
151
+ - layout.DocFunction
152
+ - layout.DocAttribute
153
+ - layout.DocModule
154
+ - layout.DocClass
155
+ - layout.Link
156
+ - layout.Item
157
+ - layout.ChoicesChildren
158
+
159
+ - subtitle : " Docstring patches"
165
160
desc : |
166
161
Most of the classes for representing python objects live
167
162
in [](`griffe.dataclasses`) or [](`griffe.docstrings.dataclasses`).
Original file line number Diff line number Diff line change @@ -36,10 +36,29 @@ html { font-family: 'Inter', sans-serif; }
36
36
line-height : 22px ;
37
37
}
38
38
39
+ .sidebar-item {
40
+ margin-top : 0px ;
41
+ }
42
+
39
43
.sidebar-item-section {
40
44
padding-top : 16px ;
41
45
}
42
46
43
47
.sidebar-section {
44
48
padding-left : 0px !important ;
45
49
}
50
+
51
+ .sidebar-item-section .sidebar-item-section {
52
+ padding-top : 0px ;
53
+ padding-left : 10px ;
54
+ }
55
+
56
+
57
+ td : first-child {
58
+ text-wrap : nowrap;
59
+ text-size-adjust : 100% ;
60
+ }
61
+
62
+ td : first-child a {
63
+ word-break : normal;
64
+ }
Original file line number Diff line number Diff line change @@ -558,12 +558,30 @@ def create_inventory(self, items):
558
558
559
559
def _generate_sidebar (self , blueprint : layout .Layout ):
560
560
contents = [f"{ self .dir } /index{ self .out_page_suffix } " ]
561
+ in_subsection = False
562
+ crnt_entry = {}
561
563
for section in blueprint .sections :
564
+ if section .title :
565
+ if crnt_entry :
566
+ contents .append (crnt_entry )
567
+
568
+ in_subsection = False
569
+ crnt_entry = {"section" : section .title , "contents" : []}
570
+ elif section .subtitle :
571
+ in_subsection = True
572
+
562
573
links = []
563
574
for entry in section .contents :
564
575
links .extend (self ._page_to_links (entry ))
565
576
566
- contents .append ({"section" : section .title , "contents" : links })
577
+ if in_subsection :
578
+ sub_entry = {"section" : section .subtitle , "contents" : links }
579
+ crnt_entry ["contents" ].append (sub_entry )
580
+ else :
581
+ crnt_entry ["contents" ].extend (links )
582
+
583
+ if crnt_entry :
584
+ contents .append (crnt_entry )
567
585
568
586
return {"website" : {"sidebar" : {"id" : self .dir , "contents" : contents }}}
569
587
Original file line number Diff line number Diff line change @@ -74,13 +74,13 @@ class Section(_Structural):
74
74
subtitle : Optional [str ] = None
75
75
desc : Optional [str ] = None
76
76
package : Union [str , None , MISSING ] = MISSING ()
77
- contents : Optional [ ContentList ] = None
77
+ contents : ContentList = []
78
78
79
79
def __init__ (self , ** data ):
80
80
super ().__init__ (** data )
81
81
82
82
# TODO: should these be a custom type? Or can we use pydantic's ValidationError?
83
- if self .title is None and self .subtitle is None and self .contents is None :
83
+ if self .title is None and self .subtitle is None and not self .contents :
84
84
raise ValueError (
85
85
"Section must specify a title, subtitle, or contents field"
86
86
)
You can’t perform that action at this time.
0 commit comments