@@ -27,6 +27,7 @@ import 'package:dartdoc/src/markdown_processor.dart' show Documentation;
27
27
import 'package:dartdoc/src/model/model.dart' ;
28
28
import 'package:dartdoc/src/model_utils.dart' as utils;
29
29
import 'package:dartdoc/src/render/parameter_renderer.dart' ;
30
+ import 'package:dartdoc/src/render/model_element_renderer.dart' ;
30
31
import 'package:dartdoc/src/source_linker.dart' ;
31
32
import 'package:dartdoc/src/tuple.dart' ;
32
33
import 'package:dartdoc/src/utils.dart' ;
@@ -1144,8 +1145,7 @@ abstract class ModelElement extends Canonicalization
1144
1145
return htmlEscape.convert (name);
1145
1146
}
1146
1147
1147
- var classContent = isDeprecated ? ' class="deprecated"' : '' ;
1148
- return '<a${classContent } href="${href }">$name </a>' ;
1148
+ return ModelElementRendererHtml ().renderLinkedName (this );
1149
1149
}
1150
1150
1151
1151
/// Replace {@example ...} in API comments with the content of named file.
@@ -1370,37 +1370,14 @@ abstract class ModelElement extends Canonicalization
1370
1370
warn (PackageWarning .invalidParameter,
1371
1371
message: 'A @youtube directive has an invalid URL: '
1372
1372
'"${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.' );
1374
1374
return '' ;
1375
1375
}
1376
1376
final String youTubeId = url.group (url.groupCount);
1377
1377
final String aspectRatio = (height / width * 100 ).toStringAsFixed (2 );
1378
1378
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 ().renderYoutubeUrl (
1380
+ youTubeId, aspectRatio);
1404
1381
});
1405
1382
}
1406
1383
@@ -1531,45 +1508,8 @@ abstract class ModelElement extends Canonicalization
1531
1508
'parameter)' );
1532
1509
}
1533
1510
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 ().renderAnimation (
1512
+ uniqueId, width, height, movieUrl, overlayId);
1573
1513
});
1574
1514
}
1575
1515
0 commit comments