import std.array; import std.algorithm; import dyaml; import vibe.vibe; import page; import staticpaths; import utils; /** * Represents a project, like an unfinished application */ class Project : Page { protected immutable string PROJECT_ICON_DIR = IMG_DIR ~ "projects/icons/"; protected immutable string PROJECT_IMAGE_DIR = IMG_DIR ~ "projects/images/"; protected string m_state; protected string[] m_platforms; protected string[] m_technologies; protected string m_icon; protected string[] m_images; protected string m_description; /** * Creates a project from a file */ this(string file) { super(file); } @safe override protected void loadHeader(Node headerNode) { super.loadHeader(headerNode); this.m_state = headerNode.getOr!string("state", "unknown"); this.m_platforms = headerNode.getArray!string("platforms", []); this.m_technologies = headerNode.getArray!string("technologies", []); this.m_icon = PROJECT_ICON_DIR ~ headerNode.getOr!string("icon", ""); this.m_images = headerNode.getArray!string("images", []) .map!(x => PROJECT_IMAGE_DIR ~ x).array; this.m_description = headerNode.getOr!string("description", ""); } @property string state() { return m_state; } @property string[] platforms() { return m_platforms; } @property string[] technologies() { return m_technologies; } @property string icon() { return m_icon; } @property string[] images() { return m_images; } @property string description() { return m_description; } }