@@ -226,25 +226,30 @@ fn appendEntries(self: *DocDatabase, allocator: Allocator, parent: Entry, parent
226226
227227const MethodKey = enum {
228228 name ,
229+ description ,
229230};
230231
231232const PropertyKey = enum {
232233 name ,
233234 type ,
234235 getter ,
235236 setter ,
237+ description ,
236238};
237239
238240const ConstantKey = enum {
239241 name ,
242+ description ,
240243};
241244
242245const SignalKey = enum {
243246 name ,
247+ description ,
244248};
245249
246250const EnumKey = enum {
247251 name ,
252+ description ,
248253};
249254
250255const kind_key_map : std .StaticStringMap (type ) = .initComptime (.{
@@ -258,25 +263,31 @@ const kind_key_map: std.StaticStringMap(type) = .initComptime(.{
258263
259264const constant_handler_map : std .StaticStringMap (* const fn (Allocator , * Entry , * Scanner ) anyerror ! void ) = .initComptime (.{
260265 .{ @tagName (ConstantKey .name ), handleEntryName },
266+ .{ @tagName (ConstantKey .description ), handleEntryDescription },
261267});
262268
263269const method_handler_map : std .StaticStringMap (* const fn (Allocator , * Entry , * Scanner ) anyerror ! void ) = .initComptime (.{
264270 .{ @tagName (MethodKey .name ), handleEntryName },
271+ .{ @tagName (MethodKey .description ), handleEntryDescription },
265272});
266273
267274const signal_handler_map : std .StaticStringMap (* const fn (Allocator , * Entry , * Scanner ) anyerror ! void ) = .initComptime (.{
268275 .{ @tagName (SignalKey .name ), handleEntryName },
276+ .{ @tagName (SignalKey .description ), handleEntryDescription },
269277});
270278
271279const enum_value_handler_map : std .StaticStringMap (* const fn (Allocator , * Entry , * Scanner ) anyerror ! void ) = .initComptime (.{
272280 .{ @tagName (EnumKey .name ), handleEntryName },
281+ .{ @tagName (EnumKey .description ), handleEntryDescription },
273282});
274283
275284const property_handler_map : std .StaticStringMap (* const fn (Allocator , * Entry , * Scanner ) anyerror ! void ) = .initComptime (.{
276285 .{ @tagName (PropertyKey .name ), handleEntryName },
277286 .{ @tagName (PropertyKey .type ), handlePropertyType },
278287 .{ @tagName (PropertyKey .getter ), skipValue },
279288 .{ @tagName (PropertyKey .setter ), skipValue },
289+ // TODO: bbcodez throws for some reason
290+ // .{ @tagName(PropertyKey.description), handleEntryDescription },
280291});
281292
282293const kind_handler_map : std .StaticStringMap (std .StaticStringMap (* const fn (Allocator , * Entry , * Scanner ) anyerror ! void )) = .initComptime (.{
@@ -302,6 +313,10 @@ fn handlePropertyType(allocator: Allocator, entry: *Entry, scanner: *Scanner) an
302313 entry .signature = try std .fmt .allocPrint (allocator , ": {s}" , .{@"type" .string });
303314}
304315
316+ fn handleEntryDescription (allocator : Allocator , entry : * Entry , scanner : * Scanner ) anyerror ! void {
317+ entry .description = try nextTokenToMarkdownAlloc (allocator , scanner );
318+ }
319+
305320fn skipValue (allocator : Allocator , entry : * Entry , scanner : * Scanner ) anyerror ! void {
306321 _ = allocator ;
307322 _ = entry ;
@@ -465,6 +480,10 @@ fn formatMemberLine(self: DocDatabase, member_idx: usize, writer: *Writer) !void
465480
466481 if (member .brief_description ) | brief | {
467482 try writer .print (" - {s}" , .{brief });
483+ } else if (member .description ) | desc | {
484+ const new_line_idx = std .mem .indexOf (u8 , desc , "\n " );
485+ const first_line = if (new_line_idx ) | idx | desc [0.. idx ] else desc ;
486+ try writer .print (" - {s}" , .{first_line });
468487 }
469488
470489 try writer .writeByte ('\n ' );
0 commit comments