diff --git a/lib/page.rb b/lib/page.rb
new file mode 100644
index 0000000..aefa169
--- /dev/null
+++ b/lib/page.rb
@@ -0,0 +1,85 @@
+class Page
+ @file
+ @path
+ @link
+ @metadata
+ @@ADDTAGS = { :rbe => { html_open: "\<%=", html_close: "%\>" }, :rb => { html_open: "\<%", html_close: "%\>" } }
+ def initialize(path)
+ @path = path
+ @link = "https://broken-moon.net/" + path
+ begin
+ @file = File.readlines(path)
+ rescue
+ raise "Invalid page at " + path
+ end
+ if @file[0] == "+++\n"
+ @metadata = get_toml_meta
+ else
+ raise "No Metadata"
+ end
+ end
+
+ def get_date
+ if @metadata.has_key?("date")
+ return @metadata["date"]
+ else
+ return "1970.1.1"
+ end
+ end
+
+ def get_title
+ if @metadata.has_key?("title")
+ return @metadata["title"]
+ else
+ return "No title"
+ end
+ end
+
+ def get_description
+ if @metadata.has_key?("description")
+ return @metadata["description"]
+ else
+ return "No description"
+ end
+ end
+
+ def get_link
+ if @metadata.has_key?("link")
+ return @metadata["link"]
+ else
+ return @link
+ end
+ end
+
+ def get_path
+ return @path
+ end
+
+ def get_toml_meta
+ startIndex = @file.find_index("+++\n")
+ @file[startIndex] = ""
+ endIndex = @file.find_index("+++\n")
+ tomlString = @file[startIndex+1..endIndex-1].join
+ @file.slice!(startIndex, endIndex + 1)
+ # JANK AS SHIT, WILL HURT ME
+ return TOML.load(tomlString)
+ end
+
+ def render
+ case @metadata["format"]
+ when "markdown"
+ return Kramdown::Document.new(@file.join).to_html
+ when "erb"
+ return ERB.new(@file.join).result(binding)
+ when "bbcode"
+ return ERB.new(@file.join.concat("\n").gsub("\n[rb]", '[rb]').bbcode_to_html(false, @@ADDTAGS)).result(binding)
+ else
+ return @file
+ end
+ end
+
+
+ def get_feed_entry
+ return " - \n
" + get_title + " \n " + get_link + "\n " + get_description + " \n "
+ end
+end
\ No newline at end of file
diff --git a/news/notAwkwardAtAll b/news/notAwkwardAtAll
new file mode 100644
index 0000000..0b76f02
--- /dev/null
+++ b/news/notAwkwardAtAll
@@ -0,0 +1,5 @@
++++
+format = "bbcode"
++++
+[b]Test[/b]
+[rbe] "HAHAHHA" [/rbe]
\ No newline at end of file
diff --git a/news/wellThisIsAwkward.md b/news/wellThisIsAwkward
similarity index 93%
rename from news/wellThisIsAwkward.md
rename to news/wellThisIsAwkward
index b94b0b6..a0e74dc 100644
--- a/news/wellThisIsAwkward.md
+++ b/news/wellThisIsAwkward
@@ -1,3 +1,8 @@
++++
+date = "2021.08.18"
+format = "markdown"
+title = "Well, This is Awkward"
++++
# [Well, This is Awkward.](/news/wellThisIsAwkward)
So, been a good few months.
diff --git a/news/wellThisIsAwkward.md.meta b/news/wellThisIsAwkward.md.meta
deleted file mode 100644
index f4c0945..0000000
--- a/news/wellThisIsAwkward.md.meta
+++ /dev/null
@@ -1 +0,0 @@
-2021.08.18
\ No newline at end of file
diff --git a/public/css/mobileMenu.css b/public/css/mobileMenu.css
new file mode 100644
index 0000000..43f0111
--- /dev/null
+++ b/public/css/mobileMenu.css
@@ -0,0 +1,595 @@
+:root {
+ --fg-col: #FFFFFF;
+ /*--main-col: #d2738a;*/
+ --main-col:#b4a999;
+ --grey-col: #CCCCCC;
+ --bg-col: #1f1710;
+ --ver: calc(95vh - 50px);
+ --ver-btm: 10vh;
+ --ver-upr: 18px;
+ --shade: linear-gradient(to top, rgba(31,23,16,1), rgba(31,23,16,0.8), rgba(31,23,16,0));
+}
+
+body {
+ background-repeat: no-repeat;
+ background-color: var(--bg-col);
+ background-size: cover;
+ background-attachment: fixed;
+ background-position: bottom left;
+ word-break: break-word;
+ display: grid;
+ grid-template-columns: auto;
+ gap: 20px;
+}
+
+ul {
+ list-style: none;
+ margin: 4px 0;
+}
+
+li {
+ margin: 4px 0;
+}
+
+img {
+ padding: 2px;
+ border: 3px double var(--main-col);
+}
+
+table {
+ padding: 2px;
+ margin: 20px 0 20px 0;
+ border: 1px solid var(--main-col);
+}
+
+th {
+ color: var(--fg-col);
+ font-weight: bold;
+}
+
+tr:nth-child(odd) {
+ background-color: #150f0a;
+}
+tr:nth-child(even) {
+ background-color: #392a1d;
+}
+
+input[type="submit" i] {
+ background: unset;
+ border: 3px double var(--main-col);
+ margin-left: 10px;
+ color: var(--main-col);
+ font-size: 1.5em;
+}
+
+.aside, .article, .section, .banner {
+ opacity: 0.9;
+ transition: 0.3s;
+}
+.banner {
+ border: none;
+ width: 240px;
+ max-width: 100%;
+}
+.banner:hover {
+ opacity: 1;
+}
+
+.bannerother, .bannergrave {
+ border: none;
+ height: 60px;
+ width: 240px;
+ max-width: 100%;
+}
+
+.bannergrave {
+ filter: grayscale(1);
+ transition: 0.3s;
+}
+
+.bannergrave:hover {
+ filter: grayscale(0);
+}
+
+.bannerlarge {
+ border: none;
+ max-width: 100%;
+}
+
+.imgnoborder {
+ max-width: 100%;
+ border: none;
+}
+
+.aside, .article, .section {
+ background: var(--bg-col);
+ padding: 10px;
+ border: 1px solid var(--main-col);
+ box-shadow: 3px 3px 2px var(--main-col);
+}
+
+.aside:hover, .article:hover, .section:hover {
+ opacity: 1;
+ box-shadow: 6px 6px 4px var(--main-col);
+}
+
+.aside {
+ width: 250px;
+ margin: 2px;
+ max-height: var(--ver);
+ align-self: start;
+ overflow-x: hidden;
+ position: sticky;
+ top: calc(2px + 8px);
+}
+
+.aside > ul {
+ padding-inline-start: 20px;
+}
+
+.aside > ul > ul {
+ padding-inline-start: 25px;
+}
+
+.asideitem {
+ list-style-image: url("../images/list.gif");
+ list-style-position: inside;
+ font-size: 1.2em;
+}
+
+.asidesubitem {
+ list-style-image: url("../images/listsmall.gif");
+ list-style-position: inside;
+ font-size: 1em;
+}
+
+.openaside {
+ display: none;
+ position: fixed !important;
+ height: 1.5em;
+ padding: 6px 0 0 0 !important;
+ width: 100%;
+ top: 0;
+ left: 0;
+ right: 0;
+ background: var(--bg-col);
+ border-bottom: 3px double var(--main-col) !important;
+ border-top: none !important;
+ border-left: none !important;
+ border-right: none !important;
+ text-align: center;
+ box-shadow: none !important;
+ z-index: 1;
+}
+
+.openaside a {
+ font-size: 1.2em;
+ letter-spacing: 8px;
+ margin-top: 4px;
+}
+
+.bottom {
+ height: var(--ver-btm);
+ width: 100%;
+ bottom: 0;
+ left: 0;
+ position: fixed;
+ background-image: var(--shade);
+ display: table;
+ pointer-events: none;
+}
+
+.bottomcell {
+ display: table-cell;
+ vertical-align: bottom;
+ text-align: center;
+ opacity: 0.7;
+ transition: 0.3s;
+}
+
+.bottomcell a {
+ pointer-events: all;
+}
+
+.bottomcell p {
+ pointer-events: all;
+}
+
+.bottomcell:hover {
+ opacity: 1;
+}
+
+.cell {
+ width: 45%;
+ text-align: center;
+}
+
+.cell > p {
+ height: 24px;
+ margin: 16px 0 0 0;
+}
+
+.cell > h3 {
+ height: 48px;
+ margin: 16px 0 0 0;
+}
+
+.mobilemenu {
+ width: 250px;
+ overflow-x: hidden;
+ margin-right: auto;
+ margin-left: auto;
+}
+
+.mobilemenu > ul {
+ text-align: left;
+ position: relative;
+ right: 9px;
+}
+
+.mobilemenu > ul > ul > p {
+ left: 25% !important;
+}
+
+.content {
+ margin-bottom: 5vh;
+ margin-top: 2px;
+ width: fit-content;
+}
+
+.article {
+ margin: 2px 20px 0 20px;
+ padding: 25px !important;
+ margin-top: 30px;
+ margin-bottom: 55px;
+}
+
+.article-headerless {
+ margin: 0 20px 55px 0 !important;
+}
+
+.section {
+ max-height: 50vh;
+ overflow: hidden;
+ position: relative;
+}
+
+.section1 {
+ margin: 20px 20px 20px 80px;
+}
+
+.section2 {
+ margin: 20px 80px 20px 20px;
+}
+
+.section3 {
+ margin: 20px 60px 20px 60px;
+}
+
+.homesection {
+ margin-bottom: 60px;
+ width: 540px;
+ text-align: center;
+ max-height: unset;
+}
+
+.homemessage, .homesubmessage {
+ font-style: italic;
+}
+
+.homemessage {
+ font-size: 2em;
+}
+
+.homesubmessage {
+ font-size: 1.2em;
+}
+
+.homesmallimg {
+ display: none;
+}
+
+.upperdirs {
+ width: 80%;
+ height: var(--ver-upr);
+ margin-bottom: 20px;
+ margin-left: auto;
+ margin-right: auto;
+ text-align: center;
+}
+
+.numlist {
+ display: table;
+ margin-bottom: 20px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.seemore {
+ position: absolute;
+ bottom: 0;
+ width: calc(100% - 20px);
+ height: 60px;
+ background-image: var(--shade);
+}
+
+.seedate {
+ float: left;
+ margin-top: 40px;
+}
+
+.articledate {
+ float: left;
+ margin-top: 5px;
+}
+
+.seemorelink {
+ float: right;
+ margin-top: 40px;
+}
+
+.greyed {
+ color: var(--grey-col);
+}
+
+.archivereturn {
+ margin: 20px 60px 20px 60px;
+ display: table;
+}
+
+.search {
+ width: 25vw;
+ min-width: 300px;
+}
+
+.titlecol {
+ width: 65%;
+}
+
+.datecol {
+ width: 35%;
+}
+
+.nothinghere {
+ width: 50vw;
+ height: 10vh;
+ margin: 20px 10vw 0 10vw;
+ text-align: center;
+}
+
+.nothinghere > .notgood {
+ letter-spacing: 2px;
+ animation: notgood 4s ease-in-out infinite;
+ animation-play-state: running;
+}
+
+.nothingreturn {
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ font-size: 1.2em;
+ padding: 6px;
+}
+
+.extlink {
+ background: url("../images/ext.gif") no-repeat;
+ background-position: right;
+ padding-right: 13px;
+}
+
+.leftimg, .rightimg, .centerimg {
+ filter: grayscale(1);
+ transition: 0.2s;
+}
+
+.leftimg:hover, .rightimg:hover, .centerimg:hover {
+ filter: none;
+}
+
+.leftimg, .rightimg {
+ max-width: 50%;
+ max-height: 25em;
+ display: block;
+ margin: 10px;
+}
+
+.leftimg {
+ float: left;
+}
+
+.rightimg {
+ float: right;
+}
+
+.centerimg {
+ max-width: 70%;
+ max-height: 30em;
+ display: block;
+ margin: 10px auto;
+}
+
+.quote {
+ display: inline-block;
+ margin: 5px;
+ color: var(--grey-col);
+}
+
+.quote:before {
+ content: "「";
+ color: var(--main-col);
+ letter-spacing: 10px;
+}
+
+.quote:after {
+ content: "」";
+ color: var(--main-col);
+ letter-spacing: 10px;
+}
+
+.scrollingcontentbtm {
+ margin-bottom: var(--ver-btm);
+ display: inline-block;
+}
+
+.blogbox {
+ position: relative;
+ right: 11px;
+ border: 1px solid var(--main-col);
+ margin-left: 20px;
+ margin-bottom: 10px;
+}
+
+.asidehometext {
+ font-size: 1.2em;
+ position: relative;
+ display: none;
+ text-align: center;
+}
+
+.asidebottomimage {
+ height: 30px;
+ max-width: 30px;
+ margin: 0 3px;
+ transition: 0.5s;
+}
+
+.asidebottomimage:hover {
+ box-shadow: var(--main-col) 1px 4px 5px;
+}
+
+.archivespan {
+ margin: 30px;
+}
+
+.codeblock {
+ font-family: 'pxplus_ibm_vga9regular', monospace;
+ border: 1px solid var(--main-col);
+ background-color: #1b1b1d;
+ color: #ffcccc;
+ font-size: 0.9em;
+ padding: 10px;
+ white-space: pre-wrap;
+ margin: 10px;
+ overflow-wrap: break-word;
+ word-break: break-all;
+}
+
+.largefont {
+ font-size: 2em;
+}
+
+.center {
+ text-align: center;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.arrow {
+ border: none;
+ padding: 2px 0 0 0;
+}
+
+.datetext {
+ text-align: center;
+ font-weight: bold;
+}
+
+.webring-panel {
+ width: fit-content;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.webring-text {
+ margin: 6px;
+}
+
+.webring-table {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+@keyframes notgood {
+ 0% {
+ letter-spacing: 2px;
+ }
+ 50% {
+ letter-spacing: 4px;
+ }
+ 100% {
+ letter-spacing: 2px;
+ }
+}
+
+@media (max-width: 900px) {
+ .aside > .asidehomeimage {
+ display: none;
+ }
+
+ .aside > .asidehometext {
+ display: block;
+ }
+
+ .aside {
+ width: 200px;
+ }
+
+ .content {
+ }
+}
+
+@media (max-height: 580px) {
+ .aside > .asidehomeimage {
+ display: none;
+ }
+
+ .aside > .asidehometext {
+ display: block;
+ }
+}
+
+@media (max-width: 850px) {
+ .homesection {
+ width: 220px;
+ }
+ .homelargeimg {
+ display: none;
+ }
+ .homesmallimg {
+ display: block;
+ }
+}
+
+@media (max-width: 660px) {
+ .aside {
+ display: none;
+ }
+
+ body { grid-template-columns: auto }
+
+ .openaside {
+ display: block;
+ }
+
+ body {
+ margin: 3em 8px 8px 8px;
+ }
+
+ .content {
+ margin-left: unset;
+ }
+}
+
+@media (max-width: 600px) {
+ .seedate {
+ display: none;
+ }
+
+ .seemorelink {
+ float: left;
+ }
+
+ .bottomcell > p {
+ font-size: 0.7em;
+ }
+}
diff --git a/v5.rb b/v5.rb
index 4d88440..dc61eb6 100755
--- a/v5.rb
+++ b/v5.rb
@@ -3,27 +3,9 @@ require 'sinatra'
require 'erb'
require 'date'
require 'ruby-bbcode'
-
-class Page
- @path
- @date
- def initialize(path, date)
- @path = path
- @date = date
- end
- def setpath(path)
- @path = path
- end
- def setdate(date)
- @date = date
- end
- def getpath
- return @path
- end
- def getdate
- return @date
- end
-end
+require 'toml'
+require 'kramdown'
+require './lib/page.rb'
get '/' do
erb :greetpage
@@ -93,6 +75,10 @@ get '/contact' do
erb :contactpage
end
+get '/feed' do
+ erb :feed, locals: {folders: ["media", "technology", "news"]}
+end
+
not_found do
status 404
erb :oops
diff --git a/views/blogpage.erb b/views/blogpage.erb
index 2140d54..f0c39f4 100644
--- a/views/blogpage.erb
+++ b/views/blogpage.erb
@@ -1,12 +1,12 @@
-<% title = request.path_info[1..-1].capitalize %>
-<% title = title.slice(0..(title.index('/') - 1)) %>
+<% page = Page.new("." + request.path_info) %>
+<% title = page.get_title %>
<%= title %>
-
-
+
+
<%= erb :headerBoilerplate %>
@@ -14,42 +14,11 @@
<%= erb :asidemenu %>
<%= erb :blogbar, locals: {title: title} %>
- <% addtags = { :rbe => { html_open: "\<%=", html_close: "%\>" }, :rb => { html_open: "\<%", html_close: "%\>" } } %>
- <% if File.exist?("." + request.path_info) && request.path_info.end_with?(".erb") %>
- <%= ERB.new(File.read("." + request.path_info)).result(binding) %>
- <% elsif File.exist?("." + request.path_info + ".erb") %>
- <%= ERB.new(File.read("." + request.path_info + ".erb")).result(binding) %>
- <% elsif File.exist?("." + request.path_info) && request.path_info.end_with?(".md") %>
- <%= markdown(File.read("." + request.path_info)) %>
- <% elsif File.exist?("." + request.path_info + ".md") %>
- <%= markdown(File.read("." + request.path_info + ".md")) %>
- <% elsif File.exist?("." + request.path_info) && request.path_info.end_with?(".bb") %>
- <%= ERB.new(File.read("." + request.path_info).gsub("\n[rb]", '[rb]').bbcode_to_html(false, addtags) + "
").result(binding) %>
- <% elsif File.exist?("." + request.path_info + ".bb") %>
- <%= ERB.new(File.read("." + request.path_info + ".bb").gsub("\n[rb]", '[rb]').bbcode_to_html(false, addtags)+ "
").result(binding) %>
- <% end %>
- <% if File.exist?("." + request.path_info + ".meta") %>
+ <%= page.render %>
- <%= File.read("." + request.path_info + ".meta") %>
+ <%= page.get_date %>
- <% elsif File.exist?("." + request.path_info + ".erb.meta") %>
-
- <%= File.read("." + request.path_info + ".erb.meta") %>
-
- <% elsif File.exist?("." + request.path_info + ".md.meta") %>
-
- <%= File.read("." + request.path_info + ".md.meta") %>
-
- <% elsif File.exist?("." + request.path_info + ".bb.meta") %>
-
- <%= File.read("." + request.path_info + ".bb.meta") %>
-
- <% else %>
-
- 1970.01.01
-
- <% end %>
<%= erb :bottom %>
diff --git a/views/blogwindow.erb b/views/blogwindow.erb
deleted file mode 100644
index 29d66e3..0000000
--- a/views/blogwindow.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-
- <% if file.end_with?(".md") %>
- <%= markdown(File.read(file)) %>
- <% elsif file.end_with?(".erb") %>
- <%= ERB.new(File.read(file)).result(binding) %>
- <% elsif file.end_with?(".bb") %>
- <% addtags = { :rbe => { html_open: "\<%=", html_close: "%\>" }, :rb => { html_open: "\<%", html_close: "%\>" } } %>
- <%= ERB.new(File.read(file).gsub("\n[rb]", '[rb]').bbcode_to_html(false, addtags) + "
").result(binding) %>
- <% end %>
-
-
- <%= date %>
-
- Article Page
-
-
\ No newline at end of file
diff --git a/views/feed.erb b/views/feed.erb
new file mode 100644
index 0000000..81ca5c5
--- /dev/null
+++ b/views/feed.erb
@@ -0,0 +1,34 @@
+
+
+
+
+ Broken Moon Network
+ https://www.broken-moon.net
+ A personal project of Astoria.
+
+ <% pageArray = Array.new %>
+ <% folders.each do |folder| %>
+ <% if Dir.exists? folder %>
+ <% contents = Dir.children("./" + folder) %>
+ <% if !contents.empty? %>
+ <% contents.each do |content| %>
+ <% begin %>
+ <% newPage = Page.new(folder + "/" + content) %>
+ <% rescue %>
+ <% puts "bad times at " + content %>
+ <% else %>
+ <% pageArray.push(newPage) %>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <% pageArray.sort_by! { |page| page.get_date } %>
+
+ <% pageArray.reverse.each do | page | %>
+ <%= page.get_feed_entry %>
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/views/index.erb b/views/index.erb
index 7241fca..cc0f37a 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -4,12 +4,12 @@
<% contents = Dir.children("./" + folder).grep(/#{searchquery}/) %>
<% if !contents.empty? %>
<% contents.each do |content| %>
- <% if content.end_with?(".erb") || content.end_with?(".md") || content.end_with?(".bb") %>
- <% if File.exists?("./" + folder + "/" + content + ".meta") %>
- <% newPage = Page.new(folder + "/" + content, DateTime.parse(File.read("./" + folder + "/" + content + ".meta"), "%Y.%m.%d")) %>
- <% else %>
- <% newPage = Page.new(folder + "/" + content, DateTime.parse("1970.01.01", "%Y.%m.%d")) %>
- <% end %>
+ <% begin %>
+ <% newPage = Page.new(folder + "/" + content) %>
+ <% rescue %>
+ <%# Do nothing LOLOL %>
+ <% puts "bad times at " + content %>
+ <% else %>
<% contentsArray.push(newPage) %>
<% end %>
<% end %>
@@ -21,10 +21,16 @@
<%= erb :throwError, locals: {errorcode: "404", error: "No result", errordescriptor: "No pages matching " + searchquery, returntarget: origin} %>
<% end %>
-<% contentsArray.sort_by! { |page| page.getdate } %>
+<% contentsArray.sort_by! { |page| page.get_date } %>
<% contentsArray.reverse.each do |content| %>
- <% if content.getpath.end_with?(".erb") || content.getpath.end_with?(".md") || content.getpath.end_with?(".bb") %>
- <%= erb :blogwindow, locals: {file: "./" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
- <% end %>
+
+ <%= content.render %>
+
+
+ <%= content.get_date %>
+
+ Article Page
+
+
<% end %>
\ No newline at end of file
diff --git a/views/menuBoilerplate.erb b/views/menuBoilerplate.erb
new file mode 100644
index 0000000..d812aff
--- /dev/null
+++ b/views/menuBoilerplate.erb
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+ <%# Work on this later %>
\ No newline at end of file
diff --git a/views/mobilemenu.erb b/views/mobilemenu.erb
index ec528f2..d7c8606 100644
--- a/views/mobilemenu.erb
+++ b/views/mobilemenu.erb
@@ -6,7 +6,7 @@
- <%= erb :headerBoilerplate %>
+ <%= erb :menuBoilerplate %>