Skip to content

Commit

Permalink
add a stylesheet to the HTML beatmaps listing
Browse files Browse the repository at this point in the history
  • Loading branch information
fmang committed Mar 10, 2018
1 parent cad54bd commit d4775b8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ include(GNUInstallDirs)
# the final absolute path. We'll suffix the former with INSTALL_DIRECTORY.
set(OSHU_DATA_INSTALL_DIRECTORY "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
set(OSHU_SKINS_INSTALL_DIRECTORY "${OSHU_DATA_INSTALL_DIRECTORY}/skins")
set(OSHU_WEB_INSTALL_DIRECTORY "${OSHU_DATA_INSTALL_DIRECTORY}/web")
# Absolute paths for config.h:
set(OSHU_DATA_DIRECTORY "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
set(OSHU_SKINS_DIRECTORY "${OSHU_DATA_DIRECTORY}/skins")
set(OSHU_WEB_DIRECTORY "${OSHU_DATA_DIRECTORY}/web")

configure_file(config.h.in config.h)
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

#define OSHU_DATA_DIRECTORY "@OSHU_DATA_DIRECTORY@"
#define OSHU_SKINS_DIRECTORY "@OSHU_SKINS_DIRECTORY@"
#define OSHU_WEB_DIRECTORY "@OSHU_WEB_DIRECTORY@"

#define OSHU_DEFAULT_SKIN "default"
4 changes: 4 additions & 0 deletions lib/library/html.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* \ingroup library_html
*/

#include "config.h"

#include "library/html.h"

#include <iostream>
Expand Down Expand Up @@ -45,6 +47,7 @@ static const char *head = R"html(
<!doctype html>
<meta charset="utf-8" />
<title>oshu! beatmaps listing</title>
<h1>oshu! beatmaps listing</h1>
)html";

static void generate_entry(const beatmap_entry &entry, std::ostream &os)
Expand All @@ -68,6 +71,7 @@ static void generate_set(const beatmap_set &set, std::ostream &os)
void generate_beatmap_set_listing(const std::vector<beatmap_set> &sets, std::ostream &os)
{
os << head;
os << "<link rel=\"stylesheet\" href=\"" << escape{OSHU_WEB_DIRECTORY} << "/style.css\" />";
for (const beatmap_set &set : sets)
generate_set(set, os);
}
Expand Down
1 change: 1 addition & 0 deletions share/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_subdirectory(desktop)
add_subdirectory(man)
add_subdirectory(skins)
add_subdirectory(web)
4 changes: 4 additions & 0 deletions share/web/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install(
FILES style.css
DESTINATION "${OSHU_WEB_INSTALL_DIRECTORY}"
)
17 changes: 17 additions & 0 deletions share/web/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
article {
margin: 20px 0;
}

h4 {
margin: 0;
}

ul {
padding: 0;
margin: 0;
}

li {
display: inline-block;
margin-right: 10px;
}

0 comments on commit d4775b8

Please sign in to comment.