Initial Commit

Add the basic structure of the site.
This commit is contained in:
2022-06-28 15:27:58 -04:00
commit 6b8157f551
69 changed files with 5011 additions and 0 deletions

6
common/composer.json Normal file
View File

@@ -0,0 +1,6 @@
{
"require": {
"erusev/parsedown": "^1.7",
"erusev/parsedown-extra": "^0.8.1"
}
}

112
common/composer.lock generated Normal file
View File

@@ -0,0 +1,112 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "aa5767a5b8fb16d5e73cc5639dd2604b",
"content-hash": "0b5aa77427c5746d4d87e5e921804d34",
"packages": [
{
"name": "erusev/parsedown",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"time": "2019-12-30 22:54:17"
},
{
"name": "erusev/parsedown-extra",
"version": "0.8.1",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown-extra.git",
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef",
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef",
"shasum": ""
},
"require": {
"erusev/parsedown": "^1.7.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"ParsedownExtra": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "An extension of Parsedown that adds support for Markdown Extra.",
"homepage": "https://github.com/erusev/parsedown-extra",
"keywords": [
"markdown",
"markdown extra",
"parsedown",
"parser"
],
"time": "2019-12-30 23:20:37"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@@ -0,0 +1,14 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
?>
<h1 align="center">Error 403</h1>
<p align="center">
<font size="10">
<br/>>:(
<br/>
</font>
<br/>
You're not allowed here. Stop that.<br/>
</p>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?>

View File

@@ -0,0 +1,24 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
?>
<h1 align="center">Error 404</h1>
<p align="center">
<font size="10">
<br/>
:(<br/>
</font>
</p>
<br/>
<p align="center">
Sorry but what your looking for isn't here.<br/>
Maybe you misspelled something maybe you didn't. <font size="1">Or I totally broke the link you had... sorry.</font>
<br/>
Please try again.<br/>
</p>
<div class="centered_img">
<img alt="It's a 404 error my dudes." src="/common/images/404.jpg">
</div>
<br/>
<br/>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?>

View File

@@ -0,0 +1,10 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
?>
<h1 align="center">Error 500</h1>
<p align="center">
<br/>
We done made a boo boo...<br/>
</p>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?>

1
common/font_size.js Normal file
View File

@@ -0,0 +1 @@

13
common/footer.php Normal file
View File

@@ -0,0 +1,13 @@
</div> <!--End of body tag -->
<footer>
<p align="center">
<sub>We are hackers, that is why we have terminals with black backgrounds and green text.</sub><br/>
<font size="1">
Copyright <?php echo(strftime("%Y")); ?> 20xd6, webmaster.
<a href="/license/" title="Licensing information for this site.">License</a>
<a href="https://20xd6.net/git/20xd6/20xd6.net" title="Link to the git repository for this website.">Git</a>
</font>
</p>
</footer>
</body>
</html>

79
common/gallery.css Normal file
View File

@@ -0,0 +1,79 @@
/* Style the Image Used to Trigger the Modal */
#myImg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
img:hover {opacity: 0.7;}
/* The Modal (background) */
.modal_gal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.gallery_img {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#modal_img_caption {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
text-align: center;
color: #ccc;
padding: 10px 0;
height: 150px;
}
/* Add Animation - Zoom in the Modal */
.gallery_img, #caption {
animation-name: zoom;
animation-duration: 0.6s;
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
/* The Close Button */
.close_modal {
position: absolute;
top: 15px;
right: 35px;
color: #00cc00;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
}
.close_modal:hover,
.close_modal:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
.gallery_img {
width: 100%;
}
}

32
common/gallery.js Normal file
View File

@@ -0,0 +1,32 @@
var modalEle = document.querySelector(".modal_gal");
var modalImage = document.querySelector(".gallery_img");
Array.from(document.querySelectorAll(".img_thumb")).forEach(item => {
item.addEventListener("click", event => {
modalEle.style.display = "block";
modalImage.src = event.target.src;
});
});
document.querySelector(".close").addEventListener("click", () => {
modalEle.style.display = "none";
});
function image_modal(document){
// Get the modal
var modal = document.getElementById("modal_gallery");
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById("myImg");
var modalImg = document.getElementById("modal_img");
var captionText = document.getElementById("modal_img_caption");
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.src;
captionText.innerHTML = this.alt;
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close_modal")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
}

45
common/get_month_name.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
function get_month_name($passed_var){
switch($passed_var){
case "01":
$month_name = "January";
break;
case "02":
$month_name = "Febuary";
break;
case "03":
$month_name = "March";
break;
case "04":
$month_name = "April";
break;
case "05":
$month_name = "May";
break;
case "06":
$month_name = "June";
break;
case "07":
$month_name = "July";
break;
case "08":
$month_name = "August";
break;
case "09":
$month_name = "September";
break;
case "10":
$month_name = "October";
break;
case "11":
$month_name = "November";
break;
case "12":
$month_name = "December";
break;
default:
$month_name = $passed_var;
}
return$month_name;
}
?>

12
common/h1_month.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/get_month_name.php');
$current_dir = basename(getcwd());
$named_month = get_month_name($current_dir);
if ( $named_month == "blog") {
echo "<h1>Blog Posts</h1>";
}elseif ($named_month == "by_year"){
echo "<h1>Posts by Year</h1>";
} else {
echo "<h1>Posts for ". $named_month ."</h1> ";
}
?>

47
common/header.php Normal file
View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en-US">
<?php
function Title() {
//~ $new_title = $_SERVER['REQUEST_URI'];
//~ $new_title = preg_replace("/^^\//i", "", $new_title);
//~ $new_title = preg_replace("/\//i", "", $new_title);
//~ $page_title = $_SERVER['REQUEST_URI'];
//~ $page_title = preg_replace("/^(.*)\//i", "", $page_title);
$page_title = basename($_SERVER['SCRIPT_FILENAME'], '.php');
//~ echo($page_title);
if(strtolower($page_title) == 'index'){
parse_str($_SERVER['REQUEST_URI'], $page_uri);
$page_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
//~ echo($page_path);
//~ $folder_name = sizeof($page_path);
$folder_name = explode("/", trim($page_path, "/"));
$page_title = $folder_name[(sizeof($folder_name) - 1)];
} elseif(strtolower($page_title) == 'homepage'){
$page_title = 'Homepage';
}
$page_title = str_replace('_', ' ', $page_title);
$page_title = ucwords($page_title);
return $page_title;
}
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<?php
if(file_exists('tags')){
$tag_data_raw = fopen('tags',"r");
$tag_data = fread($tag_data_raw, filesize('tags'));
$tag_data = str_replace("\n", "", $tag_data);
echo "<meta name=\"keywords\" content=\"" . $tag_data . "\"/>\n";
fclose($tag_data_raw);
}
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><?php $title = Title(); echo $title;?></title>
<link href="/common/styles.css?v=<?php echo date('his'); ?>" type="text/css" rel="stylesheet"/>
<link href="/common/jmenu.css?v=<?php echo date('his'); ?>" type="text/css" rel="stylesheet"/>
<link href="/common/print.css?v=<?php echo date('his'); ?>" type="text/css" media="print" rel="stylesheet"/>
<script type="text/javascript" src="/common/page_format.js?v=<?php echo date('his'); ?>"></script>
</head>
<body lang="en-US">
<div class="body" id="body">

BIN
common/imgs/cursor.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

BIN
common/imgs/icon-rss.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

11
common/index.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
if (file_exists('article.md')){
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/md_read.php');
} else {
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/h1_month.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/page_menu.php');
}
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');
?>

158
common/jmenu.css Normal file
View File

@@ -0,0 +1,158 @@
/* JMenu 1.0 RC1 | MIT License | https://github.com/jamesjohnson280/JMenu */
/* Menu bar and fonts */
.jmenu {
box-shadow: 1px 1px 3px 0 rgba(0, 0, 0, .5);
box-sizing: border-box;
line-height: 1;
}
/* Menu Button */
input.jm-menu-btn {
display: none; /* Hide the checkbox */
}
input[type='checkbox'].jm-menu-btn ~ .jm-collapse {
display: none; /* Hide menu on load */
}
input[type='checkbox']:checked.jm-menu-btn ~ .jm-collapse {
display: block; /* Open when menu button is clicked */
}
label.jm-menu-btn {
cursor: pointer;
display: block;
padding: 16px 32px;
}
label.jm-menu-btn:hover {
color: #4b4f4b;
}
.jm-collapse {
/* Add border between menu and menu button when it's open */
border-top: 1px #000000 solid; /* Light Gray */
}
/* Menu Items */
.jmenu ul,
.jmenu li {
list-style: none;
margin: 0;
padding: 0;
}
/* Links */
.jmenu a {
display: inline-block;
padding: 16px 32px;
text-decoration: none;
}
.jmenu a:hover {
color: #fff; /* White */
}
/* Submenu Items */
.jmenu ul ul {
display: none; /* Hidden by default */
}
/* Dropdowns */
.jm-dropdown:hover ul {
display: block;
}
.jm-dropdown:hover a {
/* Make top-level menu item stay highlighted when hovering over children */
color: #fff;
}
.jm-dropdown ul {
background: #000000; /* White */
padding: 0;
}
.jm-dropdown ul a,
.jm-dropdown:hover ul a {
color: #d35013; /* Orange */
}
.jm-dropdown ul a:hover,
.jm-dropdown:hover ul a:hover {
color: #000; /* Black*/
}
/* Tertiary+ Menu Items */
.jm-dropdown ul ul {
border-bottom: 1px #000 solid; /* Light gray */
border-top: 1px #000 solid;
box-shadow: none;
margin-bottom: 16px;
max-width: 100%;
position: relative;
}
/* Icons */
.jm-icon-dropdown {
border: solid #959595; /* Light gray */
border-width: 0 2px 2px 0;
display: inline-block;
margin: 0 0 3px 8px;
padding: 3px;
transform: rotate(45deg);
}
li:hover .jm-icon-dropdown {
border-color: #fff; /* White */
}
.jm-icon-menu::before {
content: '\2630';
}
@media (min-width: 768px) {
/* Menu items */
.jmenu li {
display: inline-block;
}
.jmenu a {
padding: 16px;
}
/* Dropdowns */
.jm-dropdown {
position: relative;
}
.jm-dropdown li a {
display: block;
padding: 8px 16px;
white-space: nowrap;
}
.jm-dropdown ul {
box-shadow: 1px 1px 3px 0 rgba(0, 0, 0, .5);
padding: 8px 0;
position: absolute;
min-width: 100%;
}
/* Menu Button */
input.jm-menu-btn,
label.jm-menu-btn {
display: none; /* Hide menu button */
}
input[type='checkbox'].jm-menu-btn ~ .jm-collapse,
.jm-collapse {
display: block; /* Show menu */
}
}

13
common/markdown.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
#Markdown display code
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
function get_markdown($markdown_source){
#Markdown parseing code.
$MD_Parser = new Parsedown();
$MD_Path = $markdown_source;
$MD_File = fopen($MD_Path, "r") or die("File not found.");
$MD_Text = fread($MD_File, filesize($MD_Path));
echo $MD_Parser->text($MD_Text);
fclose($MD_File);
}
?>

41
common/md_read.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
#Markdown parser dependancy
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
#Markdown parseing code.
$MD_Parser = new ParsedownExtra();
$MD_Path = "article.md";
$MD_File = fopen($MD_Path, "r") or die("File not found.");
$MD_Text = fread($MD_File, filesize($MD_Path));
echo "<article id=\"article\">\n" . /* Adds the option to change the font size of the article text. */
"<div id=\"font_btns\">
Text Size:
<button id=\"btn_sml\" type=\"button\" onclick=\"font_set('small')\">a</button>
<button id=\"btn_mid\" type=\"button\" onclick=\"font_set('medium')\">A</button>
<button id=\"btn_lrg\" type=\"button\" onclick=\"font_set('25px')\">A</button>
</div><!--End of font_btns-->
<input type=\"button\" onclick=\"printDiv('print-content')\" title=\"Print this article\" value=\"Print\"/>
<div id=\"print-content\">\n
<nav class=\"jmenu\">
<label for=\"menu-btn\" class=\"jm-menu-btn\">Download</label>
<input type=\"checkbox\" id=\"menu-btn\" class=\"jm-menu-btn\"/>
<ul class=\"jm-collapse\">
</ul>
<li><a>PDF</a></li>
<li><a href=\"article.md\" title=\"Download \">MD</a></li>
</nav>
".
$MD_Parser->text($MD_Text) . "\n</article>";
fclose($MD_File);
echo "\n</div><!--End of print-content div-->\n";
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n");
if ($tag_data != NULL){
$page_tags = str_getcsv($tag_data);
natcasesort($page_tags);
echo "<div id=\"tags\"><h2>Tags</h2>\n<ul>\n";
foreach ($page_tags as $tag){
echo "<li><a href=\"/blog/by_tag/#" . $tag . "\">" . $tag . "</a></li>\n";
}
echo "</ul>\n</div>\n";
}
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/modal.php');
?>

21
common/menu.php Normal file
View File

@@ -0,0 +1,21 @@
<nav class="jmenu">
<label for="menu-btn" class="jm-menu-btn">Menu</label>
<input type="checkbox" id="menu-btn" class="jm-menu-btn"/>
<ul class="jm-collapse">
<li><a href="/">Homepage</a></li>
<li class="jm-dropdown" id="blog"><a href="/blog/">&nbsp;Blog</a>
<ul>
<li class="jm-dropdown" id="current_year"><a href="/blog/by_year/2021/">2021</a>
<ul>
<li id="current_month" date="2021-10"><a href="/blog/by_year/2021/10/">10</a></li>
</ul>
</li>
<li><a href="/blog/by_tag/">Tags</a></li>
</ul>
</li>
<li><a href="/contact/">Contact</a></li>
<li><a href="/license/">License</a></li>
<li><a href="/news/">Site News</a></li>
<li><a href="/feeds/articles.rss"><img src="/common/imgs/icon-rss.png" name="rssicon" width="20" height="20" alt="RSS Icon"/></a></li>
</ul>
</nav>

5
common/modal.php Normal file
View File

@@ -0,0 +1,5 @@
<div id="modal_gallery" class="modal_gal">
<span class="close_modal">&times;</span>
<img class="gallery_img" id="modal_img" alt="An Image"/>
<div id="modal_img_caption"></div>
</div><!--End of Modal Div-->

135
common/page_format.js Normal file
View File

@@ -0,0 +1,135 @@
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.
code_tag = document.getElementsByTagName('code').length;
if ( code_tag !== 0 ){
var script = document.createElement('script');
var style_sheet = document.createElement('link');
script.type = 'text/javascript';
script.src = '/common/prisim/prism.js';
style_sheet.type = 'text/css';
style_sheet.href = '/common/prisim/prism.css';
style_sheet.rel = 'stylesheet';
document.head.appendChild(script);
document.head.appendChild(style_sheet);
}
if ( document.getElementById("font_btns") ){//Show the font selection buttons.
document.getElementById("font_btns").style.display = 'inline';
var font_size = read_cookie("font_size");
if ( font_size != "" || font_size != "medium" ){
font_set(font_size);
}
}
if ( document.getElementById("search_inputs") ){//Show the search box and button on the tags page.
var search_box = document.getElementById("search_inputs")
search_box.style.display = 'block';
focus_element("tag_sort");
}
if (document.getElementById('modal_gallery')){//Display image modal on pages with this element
var modalEle = document.querySelector(".modal_gal");
var modalImage = document.querySelector(".gallery_img");
var captionText = document.getElementById("modal_img_caption");
Array.from(document.querySelectorAll("img")).forEach(item => {
item.addEventListener("click", event => {
modalEle.style.display = "block";
modalImage.src = event.target.src;
captionText.innerHTML = item.alt;
});
});
document.querySelector(".close_modal").addEventListener("click", () => {
modalEle.style.display = "none";
});
}
}
function font_set(size_to_set){
document.getElementById("article").style.fontSize = size_to_set;
set_cookie("font_size",size_to_set);
}
function focus_element(element_id){
var ele_to_focus = document.getElementById(element_id);
ele_to_focus.focus();
ele_to_focus.select();
}
function tag_search(){
var search_input, filter, tag_list, li, a, i;
search_input = document.getElementById("tag_sort");
filter = search_input.value.toUpperCase();
tag_list = document.getElementById("tag_menu");
li = tag_list.getElementsByTagName("li");
for(i = 0;i < li.length;i++){
a = li[i].innerHTML.toString();
if(a.toUpperCase().indexOf(filter) > -1){
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
function title_search(){
var search_input, filter, tag_list, li_list, ol, a, i;
search_input = document.getElementById("title_sort");
filter = search_input.value.toUpperCase();
tag_list = document.getElementById("tag_menu");
li_list = tag_list.getElementsByTagName("li");
for (i = 0;i < li_list.lentgh;i++){
li_list[i].style.display = "none";
}
ol = tag_list.getElementsByTagName("ol");
for(i = 0;i < ol.length;i++){
a = ol[i].innerHTML.toString();
if(a.toUpperCase().indexOf(filter) > -1){
ol[i].style.display = "list-item";
} else {
ol[i].style.display = "none";
}
}
}
function search_toggle(){
if (document.getElementById("tag_sort")){
document.getElementById("tag_sort").placeholder = "Search Titles";
document.getElementById("tag_sort").onkeyup = function() {title_search()};
document.getElementById("tag_sort").id = "title_sort";
document.getElementById("search_toggle").value = "Search Tags";
document.getElementById("page_title").innerHTML = "Posts by Title";
document.title = "Posts by Title";
focus_element("title_sort");
} else if (document.getElementById("title_sort")){
document.getElementById("title_sort").placeholder = "Search Tags";
document.getElementById("title_sort").onkeyup = function() {tag_search()};
document.getElementById("title_sort").id = "tag_sort";
document.getElementById("search_toggle").value = "Search Titles";
document.getElementById("page_title").innerHTML = "Posts by Tag";
document.title = "Posts by Tag";
focus_element("tag_sort");
}
}
function set_cookie(prop_name, prop_value){
document.cookie = prop_name + "=" + prop_value + ";path=/;SameSite=Strict;";
}
function read_cookie(cname){
let prop_name = cname + '=';
let decoded_cookie = decodeURIComponent(document.cookie);
let split_cookie = decoded_cookie.split(';');
for ( let i = 0; i < split_cookie.length;i++){
let split = split_cookie[i];
while (split.charAt(0) == ' '){
split = split.substring(1);
}
if ( split.indexOf(prop_name) == 0 ){
return split.substring(prop_name.length, split.length);
}
}
return "";
}
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
w=window.open();
w.document.write(printContents);
w.print();
w.close();
}
window.onload = format_page;

51
common/page_menu.php Normal file
View File

@@ -0,0 +1,51 @@
<nav id="body_nav" class="jmenu">
<div class="pmenu">
<ul><li><a href=/>Home</a></li></ul>
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/get_month_name.php');
function remove_sorting_number($link_title){
$first_three = mb_substr($link_title, 0, 3,"UTF-8");
if ( preg_match( '/[0-9][0-9] /', $first_three) ){
$link_title = mb_substr($link_title,3);
}
return $link_title;
}
$dir = '.';
// Check if the directory exists
if (file_exists($dir) && is_dir($dir) ) {
// Get the files of the directory as an array
$scan_arr = scandir($dir);
$files_arr = array_diff($scan_arr, array('.','..','index.php','common','.htaccess') );
// echo "<pre>"; print_r( $files_arr ); echo "</pre>";
// Get each files of our directory with line break
foreach ($files_arr as $file) {
//Get the file path
$file_path = "./".$file;
// Get the file extension
$file_ext = pathinfo($file_path, PATHINFO_EXTENSION);
if ($file_ext=="php" || $file_ext=="html" || $file_ext=="htm" || $file_ext == "") {
$file_array[] = $file;
}
}
foreach($file_array as $file) {
$_replace = array('.php', '.html', '.htm');
$link_title = str_replace('_',' ',$file);
$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");
}
}
else {
echo "Directory does not exists";
}
echo("<ul><li><a href='..'>Back</a></li></ul>\n");
?>
</div><!--end of pmenu-->
</nav>
<br>

View File

@@ -0,0 +1,36 @@
<table border="1" class="pmenu">
<tr>
<td><a href=/>Home</a></td>
</tr>
<?php
$dir = '.';
// Check if the directory exists
if (file_exists($dir) && is_dir($dir) ) {
// Get the files of the directory as an array
$scan_arr = scandir($dir);
$files_arr = array_diff($scan_arr, array('.','..','index.php','common','.htaccess') );
// echo "<pre>"; print_r( $files_arr ); echo "</pre>";
// Get each files of our directory with line break
foreach ($files_arr as $file) {
//Get the file path
$file_path = "./".$file;
// Get the file extension
$file_ext = pathinfo($file_path, PATHINFO_EXTENSION);
if ($file_ext=="php" || $file_ext=="html" || $file_ext=="htm" || $file_ext == "") {
$file_array[] = $file;
}
}
foreach($file_array as $file) {
$_replace = array('.php', '.html', '.htm');
$link_title = str_replace('_',' ',$file);
$link_title = str_replace($_replace,'',$link_title);
$link_title = ucwords($link_title);
echo("<tr><td><a href='$file'> $link_title </a></td></tr>\n");
}
}
else {
echo "Directory does not exists";
}
?>
</table>

0
common/path_menu.php Normal file
View File

1
common/print.css Normal file
View File

@@ -0,0 +1 @@

3
common/prisim/prism.css Normal file
View File

@@ -0,0 +1,3 @@
/* PrismJS 1.25.0
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+apacheconf+basic+batch+c+csharp+cpp+java+markup-templating+php+php-extras+powershell+python+vbnet+visual-basic */
code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}

21
common/prisim/prism.js Normal file

File diff suppressed because one or more lines are too long

404
common/styles.css Normal file
View File

@@ -0,0 +1,404 @@
body {
margin-left: 5%;
margin-right: 5%;
background-color: #000000;
color: #00cc00;
font-family: "Courier New", sans-serif;
font-size: medium;
/*dir:"ltr";
*/
}
button {
background-color: #000000;
color: #00cc00;
border: none;
}
input[type=button]{
margin-left: 15px;
border-radius: 25px;
}
#btn_sml{font-size: small;}
#btn_mid{font-size: medium;}
#btn_lrg{font-size: 25px;}
#back_btn{border-bottom:none;}
#date{
display: inline;
border-radius: 25px;
padding: 3px;
background: orange;
color: black;
}
article ul p {
list-style: unset;
list-style-type: circle;
list-style-position: outside;
}
article ol {
list-style: georgian;
}
article ol ol {
list-style: lower-alpha;
}
article ul {
list-style: disc;
}
article dd{
list-style-type: none;
}
article dd:before {
content: '\2014';
position: absolute;
margin-left: -20px;
}
article hr {
color: green;
}
#tag_menu{
list-style: none;
margin-left: 25%;
margin-right: 25%;
}
#search_inputs{
display: none;
}
#tag_sort{
margin-left: 25%;
}
#title_sort {
margin-left: 25%;
}
input{
color: #00cc00;
background-color: inherit;
border-color: #00cc00;
font-size: 20px;
margin-left: auto;
margin-right: auto;
}
pre {
background-color:#1f13d3;
color:antiquewhite;
}
code {
background-color:#1f13d3;
color:antiquewhite;
}
a:link {
background-color: #000000;
color: blue;
}
a:hover {
background-color: #000000;
color: #00cc00;
}
a:visited{
background-color: #000000;
color: green;
}
a:visited:hover{
background-color: #000000;
color: #00cc00;
}
table {
border: ridge;
background: #000000;
max-width:100%;
}
table thead{
border-bottom: ridge;
}
nav.jmenu ul li.jm-dropdown ul li ul a {
margin-left:15px;
list-style:circle;
}
.pmenu ul{
border-bottom: solid;
border-width: 1px;
}
#font_btns{
display: none;
}
img{
height: auto;
max-width: 100%;
}
img.center_align{
vertical-align:middle;
}
.top{
max-width: 100vw;
float: left;
margin-left: 25%;
margin-right: 3%;
}
.center {
text-align:center;
margin-left: auto;
margin-right: auto;
}
.centered_img {
max-width:100%;
height:auto;
text-align:center;
}
.centered_img img{
height: auto;
max-width: 100%;
}
.jmenu a:hover{
border-radius: 25px;
}
.pmenu{
text-align:center;
margin-left: auto;
margin-right: auto;
margin-bottom:5px;
background-color: #000000;
}
.pmenu a:link{
background-color: #000000;
}
.pmenu a:hover{
background-color: #4b4f4b;
border-radius: 25px;
}
footer{
background-color: #000000;
clear: both;
padding: 0;
text-align: center;
line-height: normal;
margin: 0;
position: relative;
bottom: 0px;
max-width: 100%;
border-top: solid;
margin-left: 25%;
margin-right: 25%;
}
.header-cont {
width: 100%;
text-align:center;
vertical-align: middle;
position:fixed;
top:0px;
}
.header {
height:50px;
background:black;
border:1px solid ##00cc00;
width:100%;
margin-left: 3%;
}
h1.homepage {
font-size:medium;
}
h1 a:link{
color: green;
text-decoration: none;
}
h2{
border-bottom-color: #00cc00;
border-bottom-style: solid;
}
a:link {
background-color: #000000;
color: #00cc00;
}
a:hover {
background-color: #4b4f4b;
color: #00cc00;
}
a:visited{
color: #777674;
}
a:visited:hover{
background-color: #4b4f4b;
color: #777674;
}
p {
margin-bottom: 0.1in;
line-height: 100%
}
blockquote {
font-style: italic;
font-size: 90%;
color: orange;
border-left: yellowgreen;
border-left-style: outset;
}
blockquote p {
margin-left: 5px;
}
#tags {
margin-left: 25%;
margin-right: 25%;
}
#body_nav {
margin-left: 25%;
margin-right: 25%;
}
/* Style the Image Used to Trigger the Modal */
#myImg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
img:hover {opacity: 0.7;}
/* The Modal (background) */
.modal_gal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (Image) */
.gallery_img {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#modal_img_caption {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
text-align: center;
color: #ccc;
padding: 10px 0;
height: 150px;
}
/* Add Animation - Zoom in the Modal */
.gallery_img, #caption {
animation-name: zoom;
animation-duration: 0.6s;
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
/* The Close Button */
.close_modal {
position: absolute;
top: 15px;
right: 35px;
color: #00cc00;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
}
.close_modal:hover,
.close_modal:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
@media screen and (min-width: 1280px){
article {
margin-left: 25%;
margin-right: 25%;
}
.footer {
margin-left: 25%;
margin-right: 25%;
}
}
@media screen and (max-width: 800px){
body {
margin-left: unset;
margin-right: 3%;
}
.body{
margin-left: 5%;
margin-right: 5%;
}
h1{
padding-left: 5%;
}
.top{
width: 90vw;
float: left;
margin-left: unset;
}
div.gallery img {
max-width:97%;
}
img {
max-width:90vw;
}
img.sigimg {
max-width:50vw;
}
video{
max-width: 100vw;
}
.button {
padding: 5%;
}
.pmenu {
max-width: 100vw;
}
.footer{
margin-left: 3%;
}
#body_nav {
margin-left: unset;
margin-right: unset;
}
#tag_menu {
margin-left: unset;
margin-right: unset;
}
#tag_sort {
margin-left: unset;
width: 100%;
}
#title_sort {
margin-left: unset;
width: 100%;
}
#search_toggle {
margin-left: unset;
margin-top: 5px;
width: 100%;
}
.gallery_img {
width: 100%;
}
footer {
margin-left: 5%;
margin-right: 5%;
}
#tags {
margin-left: 5%;
margin-right: 5%;
}
}
@media print{
p {font-size: 3px;
background: #0c0}
code {
background-color:#1f13d3;
color:antiquewhite;
}
blockquote {
font-style: italic;
font-size: 90%;
color: black;
border-left: darkgray;
border-left-style: outset;
}
blockquote p {
margin-left: 5px;
}
}

7
common/vendor/autoload.php vendored Normal file
View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitae431d6e5e864517dac9bce927d03088::getLoader();

415
common/vendor/composer/ClassLoader.php vendored Normal file
View File

@@ -0,0 +1,415 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

56
common/vendor/composer/LICENSE vendored Normal file
View File

@@ -0,0 +1,56 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Composer
Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
Source: https://github.com/composer/composer
Files: *
Copyright: 2016, Nils Adermann <naderman@naderman.de>
2016, Jordi Boggiano <j.boggiano@seld.be>
License: Expat
Files: src/Composer/Util/TlsHelper.php
Copyright: 2016, Nils Adermann <naderman@naderman.de>
2016, Jordi Boggiano <j.boggiano@seld.be>
2013, Evan Coury <me@evancoury.com>
License: Expat and BSD-2-Clause
License: BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,11 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ParsedownExtra' => array($vendorDir . '/erusev/parsedown-extra'),
'Parsedown' => array($vendorDir . '/erusev/parsedown'),
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,52 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitae431d6e5e864517dac9bce927d03088
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitae431d6e5e864517dac9bce927d03088', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitae431d6e5e864517dac9bce927d03088', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitae431d6e5e864517dac9bce927d03088::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}

View File

@@ -0,0 +1,30 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitae431d6e5e864517dac9bce927d03088
{
public static $prefixesPsr0 = array (
'P' =>
array (
'ParsedownExtra' =>
array (
0 => __DIR__ . '/..' . '/erusev/parsedown-extra',
),
'Parsedown' =>
array (
0 => __DIR__ . '/..' . '/erusev/parsedown',
),
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixesPsr0 = ComposerStaticInitae431d6e5e864517dac9bce927d03088::$prefixesPsr0;
}, null, ClassLoader::class);
}
}

99
common/vendor/composer/installed.json vendored Normal file
View File

@@ -0,0 +1,99 @@
[
{
"name": "erusev/parsedown",
"version": "1.7.4",
"version_normalized": "1.7.4.0",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"time": "2019-12-30 22:54:17",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
]
},
{
"name": "erusev/parsedown-extra",
"version": "0.8.1",
"version_normalized": "0.8.1.0",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown-extra.git",
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef",
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef",
"shasum": ""
},
"require": {
"erusev/parsedown": "^1.7.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"time": "2019-12-30 23:20:37",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"ParsedownExtra": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "An extension of Parsedown that adds support for Markdown Extra.",
"homepage": "https://github.com/erusev/parsedown-extra",
"keywords": [
"markdown",
"markdown extra",
"parsedown",
"parser"
]
}
]

View File

@@ -0,0 +1,30 @@
language: php
dist: trusty
sudo: false
matrix:
include:
- php: 5.3
dist: precise
- php: 5.4
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
- php: nightly
fast_finish: true
allow_failures:
- php: nightly
- php: hhvm-nightly
install:
- composer install --prefer-source
script:
- vendor/bin/phpunit
- vendor/bin/phpunit vendor/erusev/parsedown/test/CommonMarkTestWeak.php || true
- '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"ParsedownExtra.php\"); echo ParsedownExtra::version;")" ]'

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Emanuil Rusev, erusev.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,538 @@
<?php
#
#
# Parsedown Extra
# https://github.com/erusev/parsedown-extra
#
# (c) Emanuil Rusev
# http://erusev.com
#
# For the full license information, view the LICENSE file that was distributed
# with this source code.
#
#
class ParsedownExtra extends Parsedown
{
# ~
const version = '0.8.1';
# ~
function __construct()
{
if (version_compare(parent::version, '1.7.4') < 0)
{
throw new Exception('ParsedownExtra requires a later version of Parsedown');
}
$this->BlockTypes[':'] []= 'DefinitionList';
$this->BlockTypes['*'] []= 'Abbreviation';
# identify footnote definitions before reference definitions
array_unshift($this->BlockTypes['['], 'Footnote');
# identify footnote markers before before links
array_unshift($this->InlineTypes['['], 'FootnoteMarker');
}
#
# ~
function text($text)
{
$markup = parent::text($text);
# merge consecutive dl elements
$markup = preg_replace('/<\/dl>\s+<dl>\s+/', '', $markup);
# add footnotes
if (isset($this->DefinitionData['Footnote']))
{
$Element = $this->buildFootnoteElement();
$markup .= "\n" . $this->element($Element);
}
return $markup;
}
#
# Blocks
#
#
# Abbreviation
protected function blockAbbreviation($Line)
{
if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches))
{
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
$Block = array(
'hidden' => true,
);
return $Block;
}
}
#
# Footnote
protected function blockFootnote($Line)
{
if (preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
{
$Block = array(
'label' => $matches[1],
'text' => $matches[2],
'hidden' => true,
);
return $Block;
}
}
protected function blockFootnoteContinue($Line, $Block)
{
if ($Line['text'][0] === '[' and preg_match('/^\[\^(.+?)\]:/', $Line['text']))
{
return;
}
if (isset($Block['interrupted']))
{
if ($Line['indent'] >= 4)
{
$Block['text'] .= "\n\n" . $Line['text'];
return $Block;
}
}
else
{
$Block['text'] .= "\n" . $Line['text'];
return $Block;
}
}
protected function blockFootnoteComplete($Block)
{
$this->DefinitionData['Footnote'][$Block['label']] = array(
'text' => $Block['text'],
'count' => null,
'number' => null,
);
return $Block;
}
#
# Definition List
protected function blockDefinitionList($Line, $Block)
{
if ( ! isset($Block) or isset($Block['type']))
{
return;
}
$Element = array(
'name' => 'dl',
'handler' => 'elements',
'text' => array(),
);
$terms = explode("\n", $Block['element']['text']);
foreach ($terms as $term)
{
$Element['text'] []= array(
'name' => 'dt',
'handler' => 'line',
'text' => $term,
);
}
$Block['element'] = $Element;
$Block = $this->addDdElement($Line, $Block);
return $Block;
}
protected function blockDefinitionListContinue($Line, array $Block)
{
if ($Line['text'][0] === ':')
{
$Block = $this->addDdElement($Line, $Block);
return $Block;
}
else
{
if (isset($Block['interrupted']) and $Line['indent'] === 0)
{
return;
}
if (isset($Block['interrupted']))
{
$Block['dd']['handler'] = 'text';
$Block['dd']['text'] .= "\n\n";
unset($Block['interrupted']);
}
$text = substr($Line['body'], min($Line['indent'], 4));
$Block['dd']['text'] .= "\n" . $text;
return $Block;
}
}
#
# Header
protected function blockHeader($Line)
{
$Block = parent::blockHeader($Line);
if (! isset($Block)) {
return null;
}
if (preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
{
$attributeString = $matches[1][0];
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
$Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
}
return $Block;
}
#
# Markup
protected function blockMarkupComplete($Block)
{
if ( ! isset($Block['void']))
{
$Block['markup'] = $this->processTag($Block['markup']);
}
return $Block;
}
#
# Setext
protected function blockSetextHeader($Line, array $Block = null)
{
$Block = parent::blockSetextHeader($Line, $Block);
if (! isset($Block)) {
return null;
}
if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
{
$attributeString = $matches[1][0];
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
$Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
}
return $Block;
}
#
# Inline Elements
#
#
# Footnote Marker
protected function inlineFootnoteMarker($Excerpt)
{
if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches))
{
$name = $matches[1];
if ( ! isset($this->DefinitionData['Footnote'][$name]))
{
return;
}
$this->DefinitionData['Footnote'][$name]['count'] ++;
if ( ! isset($this->DefinitionData['Footnote'][$name]['number']))
{
$this->DefinitionData['Footnote'][$name]['number'] = ++ $this->footnoteCount; # » &
}
$Element = array(
'name' => 'sup',
'attributes' => array('id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name),
'handler' => 'element',
'text' => array(
'name' => 'a',
'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'),
'text' => $this->DefinitionData['Footnote'][$name]['number'],
),
);
return array(
'extent' => strlen($matches[0]),
'element' => $Element,
);
}
}
private $footnoteCount = 0;
#
# Link
protected function inlineLink($Excerpt)
{
$Link = parent::inlineLink($Excerpt);
if (! isset($Link)) {
return null;
}
$remainder = substr($Excerpt['text'], $Link['extent']);
if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches))
{
$Link['element']['attributes'] += $this->parseAttributeData($matches[1]);
$Link['extent'] += strlen($matches[0]);
}
return $Link;
}
#
# ~
#
protected function unmarkedText($text)
{
$text = parent::unmarkedText($text);
if (isset($this->DefinitionData['Abbreviation']))
{
foreach ($this->DefinitionData['Abbreviation'] as $abbreviation => $meaning)
{
$pattern = '/\b'.preg_quote($abbreviation, '/').'\b/';
$text = preg_replace($pattern, '<abbr title="'.$meaning.'">'.$abbreviation.'</abbr>', $text);
}
}
return $text;
}
#
# Util Methods
#
protected function addDdElement(array $Line, array $Block)
{
$text = substr($Line['text'], 1);
$text = trim($text);
unset($Block['dd']);
$Block['dd'] = array(
'name' => 'dd',
'handler' => 'line',
'text' => $text,
);
if (isset($Block['interrupted']))
{
$Block['dd']['handler'] = 'text';
unset($Block['interrupted']);
}
$Block['element']['text'] []= & $Block['dd'];
return $Block;
}
protected function buildFootnoteElement()
{
$Element = array(
'name' => 'div',
'attributes' => array('class' => 'footnotes'),
'handler' => 'elements',
'text' => array(
array(
'name' => 'hr',
),
array(
'name' => 'ol',
'handler' => 'elements',
'text' => array(),
),
),
);
uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData)
{
if ( ! isset($DefinitionData['number']))
{
continue;
}
$text = $DefinitionData['text'];
$text = parent::text($text);
$numbers = range(1, $DefinitionData['count']);
$backLinksMarkup = '';
foreach ($numbers as $number)
{
$backLinksMarkup .= ' <a href="#fnref'.$number.':'.$definitionId.'" rev="footnote" class="footnote-backref">&#8617;</a>';
}
$backLinksMarkup = substr($backLinksMarkup, 1);
if (substr($text, - 4) === '</p>')
{
$backLinksMarkup = '&#160;'.$backLinksMarkup;
$text = substr_replace($text, $backLinksMarkup.'</p>', - 4);
}
else
{
$text .= "\n".'<p>'.$backLinksMarkup.'</p>';
}
$Element['text'][1]['text'] []= array(
'name' => 'li',
'attributes' => array('id' => 'fn:'.$definitionId),
'rawHtml' => "\n".$text."\n",
);
}
return $Element;
}
# ~
protected function parseAttributeData($attributeString)
{
$Data = array();
$attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY);
foreach ($attributes as $attribute)
{
if ($attribute[0] === '#')
{
$Data['id'] = substr($attribute, 1);
}
else # "."
{
$classes []= substr($attribute, 1);
}
}
if (isset($classes))
{
$Data['class'] = implode(' ', $classes);
}
return $Data;
}
# ~
protected function processTag($elementMarkup) # recursive
{
# http://stackoverflow.com/q/1148928/200145
libxml_use_internal_errors(true);
$DOMDocument = new DOMDocument;
# http://stackoverflow.com/q/11309194/200145
$elementMarkup = mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8');
# http://stackoverflow.com/q/4879946/200145
$DOMDocument->loadHTML($elementMarkup);
$DOMDocument->removeChild($DOMDocument->doctype);
$DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild);
$elementText = '';
if ($DOMDocument->documentElement->getAttribute('markdown') === '1')
{
foreach ($DOMDocument->documentElement->childNodes as $Node)
{
$elementText .= $DOMDocument->saveHTML($Node);
}
$DOMDocument->documentElement->removeAttribute('markdown');
$elementText = "\n".$this->text($elementText)."\n";
}
else
{
foreach ($DOMDocument->documentElement->childNodes as $Node)
{
$nodeMarkup = $DOMDocument->saveHTML($Node);
if ($Node instanceof DOMElement and ! in_array($Node->nodeName, $this->textLevelElements))
{
$elementText .= $this->processTag($nodeMarkup);
}
else
{
$elementText .= $nodeMarkup;
}
}
}
# because we don't want for markup to get encoded
$DOMDocument->documentElement->nodeValue = 'placeholder\x1A';
$markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
$markup = str_replace('placeholder\x1A', $elementText, $markup);
return $markup;
}
# ~
protected function sortFootnotes($A, $B) # callback
{
return $A['number'] - $B['number'];
}
#
# Fields
#
protected $regexAttribute = '(?:[#.][-\w]+[ ]*)';
}

View File

@@ -0,0 +1,31 @@
> You might also like [Caret](http://caret.io?ref=parsedown) - our Markdown editor for the Desktop.
## Parsedown Extra
[![Build Status](https://img.shields.io/travis/erusev/parsedown-extra/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown-extra)
An extension of [Parsedown](http://parsedown.org) that adds support for [Markdown Extra](https://michelf.ca/projects/php-markdown/extra/).
[See Demo](http://parsedown.org/extra/)
### Installation
Include both `Parsedown.php` and `ParsedownExtra.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown-extra).
### Example
``` php
$Extra = new ParsedownExtra();
echo $Extra->text('# Header {.sth}'); # prints: <h1 class="sth">Header</h1>
```
### Questions
**Who uses Parsedown Extra?**
[October CMS](http://octobercms.com/), [Bolt CMS](http://bolt.cm/), [Kirby CMS](http://getkirby.com/), [Grav CMS](http://getgrav.org/), [Statamic CMS](http://www.statamic.com/) and [more](https://www.versioneye.com/php/erusev:parsedown-extra/references).
**How can I help?**
Use it, star it, share it and in case you feel generous, [donate some money](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).

View File

@@ -0,0 +1,33 @@
{
"name": "erusev/parsedown-extra",
"description": "An extension of Parsedown that adds support for Markdown Extra.",
"keywords": ["markdown", "markdown extra", "parser", "parsedown"],
"homepage": "https://github.com/erusev/parsedown-extra",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"require": {
"erusev/parsedown": "^1.7.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"autoload": {
"psr-0": {"ParsedownExtra": ""}
},
"autoload-dev": {
"psr-0": {
"TestParsedown": "test/",
"ParsedownExtraTest": "test/",
"ParsedownTest": "vendor/erusev/parsedown/test/",
"CommonMarkTest": "vendor/erusev/parsedown/test/",
"CommonMarkTestWeak": "vendor/erusev/parsedown/test/"
}
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite>
<file>test/ParsedownExtraTest.php</file>
</testsuite>
</testsuites>
</phpunit>

View File

@@ -0,0 +1,11 @@
<?php
class ParsedownExtraTest extends ParsedownTest
{
protected function initDirs()
{
$dirs = parent::initDirs();
$dirs[] = __DIR__ . '/data/';
return $dirs;
}
}

View File

@@ -0,0 +1,9 @@
<?php
class TestParsedown extends ParsedownExtra
{
public function getTextLevelElements()
{
return $this->textLevelElements;
}
}

View File

@@ -0,0 +1,3 @@
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.
The abbreviation <abbr title="Markup Language">ML</abbr> is contained in the abbreviation <abbr title="Hyper Text Markup Language">HTML</abbr>.</p>

View File

@@ -0,0 +1,7 @@
The HTML specification
is maintained by the W3C.
The abbreviation ML is contained in the abbreviation HTML.
*[HTML]: Hyper Text Markup Language
*[W3C]: World Wide Web Consortium
*[ML]: Markup Language

View File

@@ -0,0 +1,18 @@
<p>footnote <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup> and another one <sup id="fnref1:2"><a href="#fn:2" class="footnote-ref">2</a></sup></p>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>line 1
line 2</p>
<blockquote>
<p>quote</p>
</blockquote>
<p>another paragraph&#160;<a href="#fnref1:1" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
<li id="fn:2">
<p>paragraph</p>
<p>another paragraph&#160;<a href="#fnref1:2" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
</ol>
</div>

View File

@@ -0,0 +1,14 @@
footnote [^1] and another one [^2]
[^1]: line 1
line 2
> quote
another paragraph
[^2]:
paragraph
another paragraph

View File

@@ -0,0 +1,17 @@
<dl>
<dt>Term 1</dt>
<dd>one</dd>
<dd>two
extra line</dd>
<dt>Term 2</dt>
<dd><p>lazy
line</p></dd>
<dd><p>multiple</p>
<p>paragraphs</p></dd>
<dd><p>nested</p>
<pre><code>code block</code></pre>
<blockquote>
<p>quote
block</p>
</blockquote></dd>
</dl>

View File

@@ -0,0 +1,20 @@
Term 1
: one
: two
extra line
Term 2
: lazy
line
: multiple
paragraphs
: nested
code block
> quote
> block

View File

@@ -0,0 +1,20 @@
<p>first <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup> second <sup id="fnref1:2"><a href="#fn:2" class="footnote-ref">2</a></sup>.</p>
<p>first <sup id="fnref1:a"><a href="#fn:a" class="footnote-ref">3</a></sup> second <sup id="fnref1:b"><a href="#fn:b" class="footnote-ref">4</a></sup>.</p>
<p>second time <sup id="fnref2:1"><a href="#fn:1" class="footnote-ref">1</a></sup></p>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>one&#160;<a href="#fnref1:1" rev="footnote" class="footnote-backref">&#8617;</a> <a href="#fnref2:1" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
<li id="fn:2">
<p>two&#160;<a href="#fnref1:2" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
<li id="fn:a">
<p>one&#160;<a href="#fnref1:a" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
<li id="fn:b">
<p>two&#160;<a href="#fnref1:b" rev="footnote" class="footnote-backref">&#8617;</a></p>
</li>
</ol>
</div>

View File

@@ -0,0 +1,11 @@
first [^1] second [^2].
[^1]: one
[^2]: two
first [^a] second [^b].
[^a]: one
[^b]: two
second time [^1]

View File

@@ -0,0 +1,25 @@
<div class="example">
<p><em>markdown</em></p>
<p>This is another paragraph. It contains <em>inline markup</em>.</p>
<div>
_no markdown_
</div>
</div>
<hr />
<div>
<p><em>markdown</em></p>
<div>
<p><em>markdown</em></p>
</div>
</div>
<hr />
<div>
_no markdown_
<div>
<p><em>markdown</em></p>
</div>
</div>
<hr />
<div markdown="0">
_no markdown_
</div>

View File

@@ -0,0 +1,32 @@
<div class="example" markdown="1">
_markdown_
This is another paragraph. It contains <em>inline markup</em>.
<div>
_no markdown_
</div>
</div>
---
<div markdown="1">
_markdown_
<div markdown="1">
_markdown_
</div>
</div>
---
<div>
_no markdown_
<div markdown="1">
_markdown_
</div>
</div>
---
<div markdown="0">
_no markdown_
</div>

View File

@@ -0,0 +1,6 @@
<h1 id="header1">Header 1</h1>
<h2 id="header2">Header 2</h2>
<h2 class="main">The Site</h2>
<h2 id="the-site" class="main shine">The Site</h2>
<p><a href="http://parsedown.org" id="link" class="primary upper-case">link</a></p>
<p><img src="/md.png" alt="logo" id="logo" class="big" /></p>

View File

@@ -0,0 +1,12 @@
Header 1 {#header1}
========
## Header 2 ## {#header2}
## The Site ## {.main}
## The Site ## {.main .shine #the-site}
[link](http://parsedown.org) {.primary #link .upper-case}
![logo](/md.png) {#logo .big}

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013-2018 Emanuil Rusev, erusev.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
> I also make [Caret](https://caret.io?ref=parsedown) - a Markdown editor for Mac and PC.
## Parsedown
[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown)
<!--[![Total Downloads](http://img.shields.io/packagist/dt/erusev/parsedown.svg?style=flat-square)](https://packagist.org/packages/erusev/parsedown)-->
Better Markdown Parser in PHP
[Demo](http://parsedown.org/demo) |
[Benchmarks](http://parsedown.org/speed) |
[Tests](http://parsedown.org/tests/) |
[Documentation](https://github.com/erusev/parsedown/wiki/)
### Features
* One File
* No Dependencies
* Super Fast
* Extensible
* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
* Tested in 5.3 to 7.1 and in HHVM
* [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
### Installation
Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown).
### Example
``` php
$Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>
```
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
### Security
Parsedown is capable of escaping user-input within the HTML that it generates. Additionally Parsedown will apply sanitisation to additional scripting vectors (such as scripting link destinations) that are introduced by the markdown syntax itself.
To tell Parsedown that it is processing untrusted user-input, use the following:
```php
$parsedown = new Parsedown;
$parsedown->setSafeMode(true);
```
If instead, you wish to allow HTML within untrusted user-input, but still want output to be free from XSS it is recommended that you make use of a HTML sanitiser that allows HTML tags to be whitelisted, like [HTML Purifier](http://htmlpurifier.org/).
In both cases you should strongly consider employing defence-in-depth measures, like [deploying a Content-Security-Policy](https://scotthelme.co.uk/content-security-policy-an-introduction/) (a browser security feature) so that your page is likely to be safe even if an attacker finds a vulnerability in one of the first lines of defence above.
#### Security of Parsedown Extensions
Safe mode does not necessarily yield safe results when using extensions to Parsedown. Extensions should be evaluated on their own to determine their specific safety against XSS.
### Escaping HTML
> ⚠️  **WARNING:** This method isn't safe from XSS!
If you wish to escape HTML **in trusted input**, you can use the following:
```php
$parsedown = new Parsedown;
$parsedown->setMarkupEscaped(true);
```
Beware that this still allows users to insert unsafe scripting vectors, such as links like `[xss](javascript:alert%281%29)`.
### Questions
**How does Parsedown work?**
It tries to read Markdown like a human. First, it looks at the lines. Its interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines).
We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages.
**Is it compliant with CommonMark?**
It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve.
**Who uses it?**
[Laravel Framework](https://laravel.com/), [Bolt CMS](http://bolt.cm/), [Grav CMS](http://getgrav.org/), [Herbie CMS](http://www.getherbie.org/), [Kirby CMS](http://getkirby.com/), [October CMS](http://octobercms.com/), [Pico CMS](http://picocms.org), [Statamic CMS](http://www.statamic.com/), [phpDocumentor](http://www.phpdoc.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony demo](https://github.com/symfony/symfony-demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).
**How can I help?**
Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).

View File

@@ -0,0 +1,33 @@
{
"name": "erusev/parsedown",
"description": "Parser for Markdown.",
"keywords": ["markdown", "parser"],
"homepage": "http://parsedown.org",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"require": {
"php": ">=5.3.0",
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"autoload": {
"psr-0": {"Parsedown": ""}
},
"autoload-dev": {
"psr-0": {
"TestParsedown": "test/",
"ParsedownTest": "test/",
"CommonMarkTest": "test/",
"CommonMarkTestWeak": "test/"
}
}
}