m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2021-09-12 14:38:07 +0200
committerMarcin Chrzanowski <m@m-chrzan.xyz>2021-09-12 14:38:07 +0200
commit7994abe07c61df326223171c3e9b036d11275664 (patch)
tree4d224b36eb34e789dd061bab6d569a2daf929146
parent9b33a8e5ae5048ff459c01e01cf27ff664a4b1a7 (diff)
Add templates
-rw-r--r--templates/bandcamp.html.erb1
-rw-r--r--templates/sheet_music.html.erb2
-rw-r--r--templates/song.html.erb23
-rw-r--r--templates/song.tex.erb24
-rw-r--r--templates/tag.html.erb9
-rw-r--r--templates/template.html.erb15
-rw-r--r--templates/youtube.html.erb1
7 files changed, 75 insertions, 0 deletions
diff --git a/templates/bandcamp.html.erb b/templates/bandcamp.html.erb
new file mode 100644
index 0000000..d5bddb2
--- /dev/null
+++ b/templates/bandcamp.html.erb
@@ -0,0 +1 @@
+<iframe style="border: 0; width: 100%; height: 120px;" src="<%= @link %>" seamless><a href="https://tegiechlopy.bandcamp.com/album/wesele">Wesele! by Tęgie Chłopy</a></iframe>
diff --git a/templates/sheet_music.html.erb b/templates/sheet_music.html.erb
new file mode 100644
index 0000000..69ddbc3
--- /dev/null
+++ b/templates/sheet_music.html.erb
@@ -0,0 +1,2 @@
+<h3>Nuty</h3>
+<img src='<%= path_to (song_svg id) %>' />
diff --git a/templates/song.html.erb b/templates/song.html.erb
new file mode 100644
index 0000000..2c4164f
--- /dev/null
+++ b/templates/song.html.erb
@@ -0,0 +1,23 @@
+<h2><%= song.title -%></h2>
+<a href='<%= path_to (song_pdf song.id) %>'>[PDF]</a>
+
+<% song.split_lyrics.each do |paragraph| -%>
+<p>
+ <%- paragraph.each do |line| -%>
+ <%= line %> <br />
+ <%- end -%>
+</p>
+<%- end -%>
+
+<%- if File.file?(src (song_ly song.id)) -%>
+<img src='<%= path_to (song_svg song.id) %>' />
+<%- end -%>
+
+<%- if !song.recordings.empty? -%>
+<h3>Nagrania</h3>
+<%- song.recordings.each do |recording| -%>
+<p>
+<%= recording.render -%>
+</p>
+<%- end -%>
+<%- end -%>
diff --git a/templates/song.tex.erb b/templates/song.tex.erb
new file mode 100644
index 0000000..1e98547
--- /dev/null
+++ b/templates/song.tex.erb
@@ -0,0 +1,24 @@
+\documentclass{article}
+\usepackage{graphicx}
+\usepackage{alltt}
+
+\title{<%= song.title %>}
+\date{}
+
+\begin{document}
+
+\maketitle
+
+\begin{alltt} \rmfamily
+<%= song.lyrics %>
+\end{alltt}
+
+<%- p "tmp sheet file: #{tmp(song_sheet_pdf song.id)}" -%>
+<%- if File.file? tmp(song_sheet_pdf song.id) -%>
+\begin{figure}
+ \centering
+ \includegraphics[width=\textwidth]{<%= tmp(song_sheet_pdf song.id) %>}
+\end{figure}
+<%- end -%>
+
+\end{document}
diff --git a/templates/tag.html.erb b/templates/tag.html.erb
new file mode 100644
index 0000000..829be5d
--- /dev/null
+++ b/templates/tag.html.erb
@@ -0,0 +1,9 @@
+<h2><%= tag %></h2>
+<ul>
+<%- songs.each do |song| -%>
+ <li>
+ <a href='../<%= song.metadata_filename.sub /yaml$/, 'html' %>'>
+ <%= song.title %>
+ </a>
+ </li>
+<%- end -%>
diff --git a/templates/template.html.erb b/templates/template.html.erb
new file mode 100644
index 0000000..a2f36fc
--- /dev/null
+++ b/templates/template.html.erb
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang=en>
+<head>
+ <title>Śpiewnik tradycyjny<%= title ? " | #{title}" : "" %></title>
+ <meta charset='utf-8'>
+ <link rel='stylesheet' type='text/css' href='<%= path_to 'style' %>'>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+</head>
+<body>
+<h1><a href='<%= path_to 'index' %>'>Śpiewnik tradycyjny</a></h1>
+
+<%= content -%>
+
+</body>
+</html>
diff --git a/templates/youtube.html.erb b/templates/youtube.html.erb
new file mode 100644
index 0000000..821454b
--- /dev/null
+++ b/templates/youtube.html.erb
@@ -0,0 +1 @@
+<iframe width="560" height="315" src="https://www.youtube.com/embed/<%= @vid %>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>