15 Commits

Author SHA1 Message Date
f1b3eec9d8 Readd README.md to resolve merge confilict 2022-07-05 15:16:48 -04:00
91119d3575 Merge branch 'code_docs' 2022-07-05 15:13:44 -04:00
6b06c36b0b Merge pull request 'Update to upstream master' (#1) from 20xd6/simple_blog:master into master
Reviewed-on: #1
2022-07-05 15:10:54 -04:00
394e34b7b8 Update URL path 2022-07-05 15:01:32 -04:00
de3986efcb Add comments to page_menu.php 2022-07-05 14:45:16 -04:00
58f94c415d Add comments to index.php 2022-07-05 14:40:20 -04:00
4117b552f2 Add comments to header.php
This file needs it's Title() function cleaned up.
2022-07-05 14:36:54 -04:00
a00013d619 Add comments to h1_month.php 2022-07-05 14:33:18 -04:00
ef7056be35 Add comments to get_month_name.php 2022-07-05 14:32:11 -04:00
93514c0e1d Add comments to page_format.js 2022-07-05 14:29:43 -04:00
a2ee59d2f3 Fix for issue#8
The array was being processed such that it would stop when it reached
the number of row not the number of coloums.
2022-07-05 10:56:02 -04:00
efcea55a8d Add the license informtion for Prism.
Resolves issue#3
2022-07-04 15:12:03 -04:00
5f3465bc9a Merge pull request 'Update /licenses/' (#1) from manfromhuh/simple_blog:update_licenses into master
Reviewed-on: 20xd6/simple_blog#1
2022-07-04 14:53:56 -04:00
9d9711cccc Add Parsedown-extra to /license/
Add the license information for Pasedown-extra to /license/index.php
2022-07-02 09:53:42 -04:00
6df7971792 Clarify licensing
A change was made to the <h2> header for the license applying to simple_blog itself to clarify what that license is for. The GPL is only attached to the code used to render the site and not the Markdown parser or menu CSS. These components are licensed MIT.
2022-07-02 09:40:46 -04:00
9 changed files with 49 additions and 28 deletions

View File

@@ -71,7 +71,7 @@ This directory contains the files and libraries used to render the site's pages.
#### CSS
* [styles.css](src/branch/master/common/styles.css) - The main site CSS.
* [styles.css](/git/20xd6/simple_blog/src/branch/master/common/styles.css) - The main site CSS.
* [jmenu.css]() - Used to render the responsive menus.
* [print.css]() - Used to style printed pages.
* [gallery.css]() - Styles the floating

View File

@@ -43,12 +43,12 @@
//echo "</pre>\n";
echo "<ul id=\"tag_menu\">\n";
$coloum_number = 0;
for ($row_number = 0; $row_number < $tags_rows; $row_number++){
#echo $row_number;
for ($row_number = 0; $row_number <= $tags_coloums; $row_number++){
//echo $row_number;
$section_title = $tags_csv[0][$coloum_number];
echo "\t<li id=\"" . $section_title . "\"><b>" . $section_title . " </b>\n";
for ($row = 1; $row < $tags_coloums; $row++){
#echo "rn: " . $row_number . "\ncn:" . $coloum_number;
//echo "rn: " . $row . "\ncn:" . $coloum_number ." ";
$tag_content = $tags_csv[$row][$coloum_number];
if ($tag_content == ""){
break;

View File

@@ -1,4 +1,5 @@
<?php
//Parses it's passed input to convert it to a month name.
function get_month_name($passed_var){
switch($passed_var){
case "01":

View File

@@ -1,4 +1,5 @@
<?php
//Sets the proper level 1 heading for the folder.
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/get_month_name.php');
$current_dir = basename(getcwd());
$named_month = get_month_name($current_dir);

View File

@@ -1,7 +1,8 @@
<!DOCTYPE html>
<html lang="en-US">
<?php
function Title() {
//Sets the page title based on the name of the current directory
function Title() {//Needs cleanup.
//~ $new_title = $_SERVER['REQUEST_URI'];
//~ $new_title = preg_replace("/^^\//i", "", $new_title);
@@ -27,7 +28,7 @@
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<?php
<?php//If a tags file is present parse it and add any tags found to the renderd page's metadata.
if(file_exists('tags')){
$tag_data_raw = fopen('tags',"r");
$tag_data = fread($tag_data_raw, filesize('tags'));

View File

@@ -1,7 +1,10 @@
<?php
//The common file used to render pages on the blog.
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
if (file_exists('article.md')){
//Looks for an article.md to see if the current directory is an article or not
//If it is not then it is a menu page.
if (file_exists('article.md')){
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/md_read.php');
} else {
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/h1_month.php');

View File

@@ -1,8 +1,10 @@
//
function format_page(){//Set the title of the page based on the main header, <h1>, tag.le != '' )){
if ( document.getElementsByTagName('h1').length !== 0){
document.title = document.getElementsByTagName('h1')[0].innerText;
}
//detect if the page contains code blocks to be highlighted and loads the prisim.js and prism.css files to accomplish this.
//Detect if the page contains code blocks to be highlighted and loads the
//prisim.js and prism.css files if codeblocks are found.
code_tag = document.getElementsByTagName('code').length;
if ( code_tag !== 0 ){
var script = document.createElement('script');
@@ -15,11 +17,14 @@ function format_page(){//Set the title of the page based on the main header, <h1
document.head.appendChild(script);
document.head.appendChild(style_sheet);
}
if ( document.getElementById("font_btns") ){//Show the font selection buttons.
//Sets the displayed fontsize.
//This functionality won't work without JavaScript enabled. For this reason the
//buttons won't be shown if this script isn't run.
if ( document.getElementById("font_btns") ){//Show the font selection buttons.
document.getElementById("font_btns").style.display = 'inline';
var font_size = read_cookie("font_size");
var font_size = read_cookie("font_size");//reads a saved value for fontsize from the site cookie
if ( font_size != "" || font_size != "medium" ){
font_set(font_size);
font_set(font_size);//insure a sane default
}
}
if ( document.getElementById("search_inputs") ){//Show the search box and button on the tags page.
@@ -43,7 +48,7 @@ function format_page(){//Set the title of the page based on the main header, <h1
});
}
}
function font_set(size_to_set){
function font_set(size_to_set){//Set a cookie to remember the fontsize selection.
document.getElementById("article").style.fontSize = size_to_set;
set_cookie("font_size",size_to_set);
}
@@ -52,7 +57,7 @@ function focus_element(element_id){
ele_to_focus.focus();
ele_to_focus.select();
}
function tag_search(){
function tag_search(){//searches in the avaliable tags and displays all articles matching the searched tag.
var search_input, filter, tag_list, li, a, i;
search_input = document.getElementById("tag_sort");
filter = search_input.value.toUpperCase();
@@ -66,9 +71,8 @@ function tag_search(){
li[i].style.display = "none";
}
}
}
function title_search(){
function title_search(){//searches for matches in the article titles rather than tags. Allows more granular search
var search_input, filter, tag_list, li_list, ol, a, i;
search_input = document.getElementById("title_sort");
filter = search_input.value.toUpperCase();
@@ -88,7 +92,7 @@ function title_search(){
}
}
function search_toggle(){
function search_toggle(){//Toggles if the unit being sorted on is the article title or tag
if (document.getElementById("tag_sort")){
document.getElementById("tag_sort").placeholder = "Search Titles";
document.getElementById("tag_sort").onkeyup = function() {title_search()};
@@ -107,10 +111,10 @@ function search_toggle(){
focus_element("tag_sort");
}
}
function set_cookie(prop_name, prop_value){
function set_cookie(prop_name, prop_value){//sets a passed cookie property and value.
document.cookie = prop_name + "=" + prop_value + ";path=/;SameSite=Strict;";
}
function read_cookie(cname){
function read_cookie(cname){//reads a property value
let prop_name = cname + '=';
let decoded_cookie = decodeURIComponent(document.cookie);
let split_cookie = decoded_cookie.split(';');
@@ -125,11 +129,11 @@ function read_cookie(cname){
}
return "";
}
function printDiv(divName) {
function printDiv(divName) {//Formats the page for printing.
var printContents = document.getElementById(divName).innerHTML;
w=window.open();
w.document.write(printContents);
w.print();
w.close();
}
window.onload = format_page;
window.onload = format_page;//loades the page formatting script.

View File

@@ -4,6 +4,7 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/get_month_name.php');
//Removes the number used to keep articles in post order from the displayed title.
function remove_sorting_number($link_title){
$first_three = mb_substr($link_title, 0, 3,"UTF-8");
@@ -31,14 +32,14 @@ if (file_exists($dir) && is_dir($dir) ) {
$file_array[] = $file;
}
}
foreach($file_array as $file) {
$_replace = array('.php', '.html', '.htm');
$link_title = str_replace('_',' ',$file);
foreach($file_array as $file) {//Renders the folder names as more readable titles.
$_replace = array('.php', '.html', '.htm');//Remove file extensions from webpages.
$link_title = str_replace('_',' ',$file);//Remove undersores and replace them with spaces
$link_title = str_replace($_replace,'',$link_title);
$link_title = ucwords($link_title);
$link_title = get_month_name($link_title);
$link_title = remove_sorting_number($link_title);
echo("<ul><li><a href='$file'> $link_title </a></li></ul>\n");
$link_title = ucwords($link_title);//Set the first letter of each word to upercase.
$link_title = get_month_name($link_title);//
$link_title = remove_sorting_number($link_title);//Removes the number used to keep articles in post order from the displayed title.
echo("<ul><li><a href='$file'> $link_title </a></li></ul>\n");//Output the result.
}
}
else {

View File

@@ -8,7 +8,7 @@ include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
?>
<article>
<p>A summery of all licenses that apply to this website.</p>
<h2>Code License</h2>
<h2>simple_blog License</h2>
<font size="2">
Copyright <?php echo(strftime("%Y")); ?> 20xd6<br>
<br>
@@ -46,5 +46,15 @@ JMenu is <a href="/license/MIT.php">MIT Licensed</a>.</p>
<p>Parsedown is used for all of the Markdown processing for this site.<br/>
Parsedown is <a href="/license/MIT.php">MIT Licensed</a>.</p>
<?php display_file($_SERVER['DOCUMENT_ROOT'].'/common/vendor/erusev/parsedown/LICENSE.txt');?>
<h3><a href="https://github.com/erusev/parsedown-extra">Parsedown Extra</a></h3>
<blockquote><p>An extension of <a href="https://github.com/erusev/parsedown">Parsedown</a> that adds support for <a href="https://michelf.ca/projects/php-markdown/extra/">Markdown Extra.</a></p></blockquote>
<p>Pasrsedown-extra is used primarily to add support for footnotes in articles. <br/>Parsedown-extra is <a href="/license/MIT.php">MIT Licensed</a>.</p>
<?php display_file($_SERVER['DOCUMENT_ROOT'].'/common/vendor/erusev/parsedown-extra/LICENSE.txt');?>
<h3>Prism</h3>
<blockquote><p>Prism is a lightweight, robust, and elegant syntax highlighting library. It's a spin-off project from <a href="https://dabblet.com/">Dabblet</a>.<br/>
You can learn more on <a href="https://prismjs.com/">prismjs.com</a>.</p></blockquote>
<p>Prism is used for syntax highlighting is simple_blog.<br/>
Prism is <a href="/license/MIT.php">MIT Licensed</a>.</p>
<?php display_file("MIT_License.txt"); ?>
</article>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?>