@@ -27,6 +27,7 @@ import 'package:dartdoc/src/markdown_processor.dart' show Documentation;
2727import 'package:dartdoc/src/model/model.dart' ;
2828import 'package:dartdoc/src/model_utils.dart' as utils;
2929import 'package:dartdoc/src/render/parameter_renderer.dart' ;
30+ import 'package:dartdoc/src/render/model_element_renderer.dart' ;
3031import 'package:dartdoc/src/source_linker.dart' ;
3132import 'package:dartdoc/src/tuple.dart' ;
3233import 'package:dartdoc/src/utils.dart' ;
@@ -1144,8 +1145,7 @@ abstract class ModelElement extends Canonicalization
11441145 return htmlEscape.convert (name);
11451146 }
11461147
1147- var classContent = isDeprecated ? ' class="deprecated"' : '' ;
1148- return '<a${classContent } href="${href }">$name </a>' ;
1148+ return ModelElementRendererHtml ().renderLinkedName (this );
11491149 }
11501150
11511151 /// Replace {@example ...} in API comments with the content of named file.
@@ -1370,37 +1370,14 @@ abstract class ModelElement extends Canonicalization
13701370 warn (PackageWarning .invalidParameter,
13711371 message: 'A @youtube directive has an invalid URL: '
13721372 '"${positionalArgs [2 ]}". Supported YouTube URLs have the '
1373- 'follwing format: https://www.youtube.com/watch?v=oHg5SJYRHA0.' );
1373+ 'following format: https://www.youtube.com/watch?v=oHg5SJYRHA0.' );
13741374 return '' ;
13751375 }
13761376 final String youTubeId = url.group (url.groupCount);
13771377 final String aspectRatio = (height / width * 100 ).toStringAsFixed (2 );
13781378
1379- // Blank lines before and after, and no indenting at the beginning and end
1380- // is needed so that Markdown doesn't confuse this with code, so be
1381- // careful of whitespace here.
1382- return '''
1383-
1384- <p style="position: relative;
1385- padding-top: $aspectRatio %;">
1386- <iframe src="https://www.youtube.com/embed/$youTubeId ?rel=0"
1387- frameborder="0"
1388- allow="accelerometer;
1389- autoplay;
1390- encrypted-media;
1391- gyroscope;
1392- picture-in-picture"
1393- allowfullscreen
1394- style="position: absolute;
1395- top: 0;
1396- left: 0;
1397- width: 100%;
1398- height: 100%;">
1399- </iframe>
1400- </p>
1401-
1402- ''' ; // String must end at beginning of line, or following inline text will be
1403- // indented.
1379+ return ModelElementRendererHtml ()
1380+ .renderYoutubeUrl (youTubeId, aspectRatio);
14041381 });
14051382 }
14061383
@@ -1531,45 +1508,8 @@ abstract class ModelElement extends Canonicalization
15311508 'parameter)' );
15321509 }
15331510
1534- // Blank lines before and after, and no indenting at the beginning and end
1535- // is needed so that Markdown doesn't confuse this with code, so be
1536- // careful of whitespace here.
1537- return '''
1538-
1539- <div style="position: relative;">
1540- <div id="${overlayId }"
1541- onclick="var $uniqueId = document.getElementById('$uniqueId ');
1542- if ($uniqueId .paused) {
1543- $uniqueId .play();
1544- this.style.display = 'none';
1545- } else {
1546- $uniqueId .pause();
1547- this.style.display = 'block';
1548- }"
1549- style="position:absolute;
1550- width:${width }px;
1551- height:${height }px;
1552- z-index:100000;
1553- background-position: center;
1554- background-repeat: no-repeat;
1555- background-image: url(static-assets/play_button.svg);">
1556- </div>
1557- <video id="$uniqueId "
1558- style="width:${width }px; height:${height }px;"
1559- onclick="var $overlayId = document.getElementById('$overlayId ');
1560- if (this.paused) {
1561- this.play();
1562- $overlayId .style.display = 'none';
1563- } else {
1564- this.pause();
1565- $overlayId .style.display = 'block';
1566- }" loop>
1567- <source src="$movieUrl " type="video/mp4"/>
1568- </video>
1569- </div>
1570-
1571- ''' ; // String must end at beginning of line, or following inline text will be
1572- // indented.
1511+ return ModelElementRendererHtml ()
1512+ .renderAnimation (uniqueId, width, height, movieUrl, overlayId);
15731513 });
15741514 }
15751515
0 commit comments