$database = $notion->databases()->find($collection->notion_database);
$songs = $notion->databases()->queryAllPages($database);
+
$res = [];
foreach ($songs as $song) {
$pageContents = '';
$s['notes'] = self::_blockToHtml($notesProperty);
$s['notion_url'] = $song->url;
-
$s['files'] = [];
$s['audios'] = [];
foreach ($filesProperty->files as $file) {
* @return string
*/
protected static function _blockToHtml($block) {
- $start = '';
- $end = '';
+ $start = '<p>';
+ $end = '</p>';
if ($block instanceof Paragraph) {
- $start = '<p>';
- $end = '</p>';
+
}
$res = '';
foreach ($block->text as $rt) {
$res = $start . $res . $end;
$res = str_replace('</h3><br />', '</h3>', $res);
$res = str_replace('<blockquote><br />', '<blockquote>', $res);
+ $res = str_replace('<p><br />', '<p>', $res);
+ $res = str_replace('<p></p>', '', $res);
+ $res = str_replace('<p><p>', '<p>', $res);
+ $res = str_replace('</p></p>', '</p>', $res);
return $res;
}
protected static function _richTextToHtml($rt) {
$start = '';
$end = '';
+
if ($rt->annotations->isBold) {
- $start = '<strong>' . $start;
- $end = $end . '</strong>';
- }
- if ($rt->annotations->isItalic) {
- $start = '<em>' . $start;
- $end = $end . '</em>';
+ $start = '<p><strong>' . $start;
+ $end = $end . '</strong></p>';
+ } else if ($rt->annotations->isItalic) {
+ $start = '<p><em>' . $start;
+ $end = $end . '</em></p>';
+ } else {
+ $start = '<p>' . $start;
+ $end = $end . '</p>';
}
if ($rt->annotations->isUnderline) {
$start = '<h3>' . $start;
});
$("body").get(0).style.setProperty("--text-multi", getOption('size'));
- s.find('.lyrics,h3').css('font-size', getOption('size') * 16);
+ s.find('.lyrics,h3,p,blockquote,div').css('font-size', getOption('size') * 16);
}
@php
$songurl="/$collection->slug/$csong->slug.html";
- $prefetch[]=$songurl;
- $tracks=$csong->getAudioTracks();
- foreach ($tracks as $track) {
- $prefetch[]=$track['url'];
- }
@endphp
<li><a rel="prefetch" @if(isset($song) && $csong->id == $song->id) class="active"
@endif href="{{$songurl}}">{{trim($csong->title.' - '.$csong->artist,' -')}}</a>