mirror of
https://gitlab.com/parroquia-san-leandro/cancionero-web.git
synced 2025-04-27 23:55:57 +02:00
Move to less, improved style, fixed bugs
* Redirection wasn't being encoded properly * CSS to LESS transition * Improved Makefile * Explained red color in index * Unified link and button styles
This commit is contained in:
parent
67bedb49e4
commit
c7bca76c8c
14 changed files with 233 additions and 185 deletions
|
@ -3,6 +3,7 @@ from audio_scanner import find_audios
|
|||
from os.path import join
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import urllib.parse
|
||||
import os
|
||||
import re
|
||||
|
||||
|
@ -232,26 +233,28 @@ class SongLoader:
|
|||
|
||||
def print_index(self, index_file="index.html"):
|
||||
self.songs = sorted(self.songs, key=lambda s: s.number)
|
||||
body = index_template % join_list([index_per_song_template %
|
||||
(' class="hasChords"' if not s.chorded() else '',
|
||||
s.get_url(),
|
||||
s.number, s.name,
|
||||
" por %s " % s.author if s.author else "",
|
||||
" basado en %s " % s.origin if s.origin else "")
|
||||
for s in self.songs])
|
||||
song_list = join_list([index_per_song_template.format(
|
||||
url=s.get_url(),
|
||||
li_class=' class="hasChords"' if not s.chorded() else '',
|
||||
number=s.number,
|
||||
name=s.name,
|
||||
author=" por %s " % s.author if s.author else "",
|
||||
origin=" basado en %s " % s.origin if s.origin else "")
|
||||
for s in self.songs])
|
||||
body = index_template.format(list_content=song_list)
|
||||
with open(index_file, 'w') as f:
|
||||
f.write(page_template % (index_css, body))
|
||||
f.write(page_template.format(css=index_css, main=body))
|
||||
|
||||
def print_songs(self, directory="."):
|
||||
for song in self.songs:
|
||||
num_dir = join(directory, "%03d" % (song.number))
|
||||
mkdir(num_dir)
|
||||
with open(join(num_dir, "index.html"), 'w') as f:
|
||||
f.write(song_redir_template.format("../" + song.get_url()))
|
||||
f.write(song_redir_template.format(url=urllib.parse.quote("../" + song.get_url())))
|
||||
song_dir = join(directory, song.get_url())
|
||||
mkdir(song_dir)
|
||||
with open(join(song_dir, "index.html"), 'w') as f:
|
||||
f.write(page_template % (song_css, str(song)))
|
||||
f.write(page_template.format(css=song_css, main=str(song)))
|
||||
|
||||
|
||||
def copy_static(source_dir, target_dir):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue