@@ -254,8 +254,8 @@ String convertDoxygenCommentsInDartSource(String source, {String? path}) {
254254
255255 final indent = docMatch.group (1 )! ;
256256 final block = < String > [];
257- while (index < lines.length &&
258- _docCommentLineRegExp.hasMatch (lines[index])) {
257+ while (
258+ index < lines.length && _docCommentLineRegExp.hasMatch (lines[index])) {
259259 block.add (lines[index]);
260260 index++ ;
261261 }
@@ -275,8 +275,8 @@ String convertDoxygenCommentsInDartSource(String source, {String? path}) {
275275 final annotatedOutput = _shouldHideTopLevelGeneratedBindingsDeclarations (path)
276276 ? _annotateGeneratedBindingsTopLevelDeclarations (output)
277277 : _shouldHideVersionedTizenLibraryGetters (path)
278- ? _annotateVersionedTizenLibraryGetters (output)
279- : output;
278+ ? _annotateVersionedTizenLibraryGetters (output)
279+ : output;
280280 final normalizedOutput = _rewriteVersionedTizenLibraryName (
281281 annotatedOutput,
282282 path,
@@ -524,35 +524,35 @@ _StructuredDoc _parseStructuredDoc(List<String> docLines) {
524524
525525 for (final rawDocLine in docLines) {
526526 final stripped = _stripGeneratedDocLine (rawDocLine);
527+
528+ if (currentCodeBlock != null ) {
529+ final trimmed = stripped.trim ();
530+ if (trimmed == r'@endcode' || trimmed == r'\endcode' ) {
531+ final title = pendingParagraphTitles.isNotEmpty
532+ ? pendingParagraphTitles.removeLast ()
533+ : null ;
534+ doc.codeBlocks.add (
535+ _CodeBlock (
536+ lines: List <String >.from (currentCodeBlock),
537+ title: title,
538+ language: currentCodeLanguage,
539+ ),
540+ );
541+ currentCodeBlock = null ;
542+ currentCodeLanguage = null ;
543+ appendContinuation = null ;
544+ continue ;
545+ }
546+ currentCodeBlock.add (_normalizeCodeLine (stripped));
547+ continue ;
548+ }
549+
527550 final expandedLines = _expandDocLine (stripped);
528551
529552 for (final expandedLine in expandedLines) {
530- final line = currentCodeBlock == null
531- ? expandedLine.trimRight ()
532- : expandedLine;
553+ final line = expandedLine.trimRight ();
533554 final trimmed = line.trim ();
534555
535- if (currentCodeBlock != null ) {
536- if (trimmed == r'@endcode' || trimmed == r'\endcode' ) {
537- final title = pendingParagraphTitles.isNotEmpty
538- ? pendingParagraphTitles.removeLast ()
539- : null ;
540- doc.codeBlocks.add (
541- _CodeBlock (
542- lines: List <String >.from (currentCodeBlock),
543- title: title,
544- language: currentCodeLanguage,
545- ),
546- );
547- currentCodeBlock = null ;
548- currentCodeLanguage = null ;
549- appendContinuation = null ;
550- continue ;
551- }
552- currentCodeBlock.add (_normalizeCodeLine (line));
553- continue ;
554- }
555-
556556 if (trimmed.isEmpty) {
557557 appendContinuation = null ;
558558 continue ;
@@ -832,7 +832,11 @@ void _appendDocBullets(
832832 final bulletText = item.startsWith ('http://' ) || item.startsWith ('https://' )
833833 ? '<$item >'
834834 : item;
835- output.add ('/// - $bulletText ' );
835+ final lines = bulletText.split ('\n ' );
836+ output.add ('/// - ${lines .first }' );
837+ for (var i = 1 ; i < lines.length; i++ ) {
838+ output.add (lines[i].isEmpty ? '///' : '/// ${lines [i ]}' );
839+ }
836840 }
837841}
838842
@@ -841,9 +845,8 @@ void _appendDocNamedBullets(
841845 String heading,
842846 List <_DocItem > items,
843847) {
844- final filteredItems = items
845- .where ((item) => item.description.trim ().isNotEmpty)
846- .toList ();
848+ final filteredItems =
849+ items.where ((item) => item.description.trim ().isNotEmpty).toList ();
847850 if (filteredItems.isEmpty) {
848851 return ;
849852 }
@@ -852,22 +855,31 @@ void _appendDocNamedBullets(
852855 }
853856 output.add ('/// **$heading :**' );
854857 for (final item in filteredItems) {
855- final buffer = StringBuffer ('/// - ' );
858+ final firstLineBuffer = StringBuffer ('/// - ' );
859+ String description = item.description;
856860 if (item.name != null ) {
857861 final displayName = item.name! .startsWith ('`' ) && item.name! .endsWith ('`' )
858862 ? item.name!
859863 : '`${item .name }`' ;
860- buffer .write (displayName);
864+ firstLineBuffer .write (displayName);
861865 if (item.direction != null && item.direction! .isNotEmpty) {
862- buffer .write (' (${item .direction })' );
866+ firstLineBuffer .write (' (${item .direction })' );
863867 }
864- if (item.description.isNotEmpty) {
865- buffer.write (': ${item .description }' );
868+ if (description.isNotEmpty) {
869+ firstLineBuffer.write (': ' );
870+ }
871+ }
872+
873+ if (description.isNotEmpty) {
874+ final lines = description.split ('\n ' );
875+ firstLineBuffer.write (lines.first);
876+ output.add (firstLineBuffer.toString ());
877+ for (var i = 1 ; i < lines.length; i++ ) {
878+ output.add (lines[i].isEmpty ? '///' : '/// ${lines [i ]}' );
866879 }
867880 } else {
868- buffer. write (item.description );
881+ output. add (firstLineBuffer. toString () );
869882 }
870- output.add (buffer.toString ());
871883 }
872884}
873885
@@ -1049,6 +1061,12 @@ String _mergeDocText(String current, String next) {
10491061 if (next.isEmpty) {
10501062 return current;
10511063 }
1064+ final nextTrimmed = next.trimLeft ();
1065+ if (nextTrimmed.startsWith ('- ' ) ||
1066+ nextTrimmed.startsWith ('* ' ) ||
1067+ RegExp (r'^\d+\.\s' ).hasMatch (nextTrimmed)) {
1068+ return '$current \n $next ' ;
1069+ }
10521070 return '$current $next ' ;
10531071}
10541072
0 commit comments