Merge branch 'Add-Parsedown-Support' of https://gitlab.com/bluekay/shopping-list into Add-Parsedown-Support

This commit is contained in:
Krehan Tim 2018-10-26 11:41:30 +02:00
commit b4e407adc1
3 changed files with 2067 additions and 6 deletions

View file

@ -2,11 +2,12 @@
<script src="/bin/recipe.js" charset="utf-8"></script> <script src="/bin/recipe.js" charset="utf-8"></script>
<?php <?php
include $_SESSION["docroot"].'/php/classes.recipe.php'; include $_SESSION["docroot"].'/php/classes.recipe.php';
include $_SESSION["docroot"].'/php/classes.parsedown.php';
$book = new cookbook; $book = new cookbook;
$book->getRecipe($_GET["number"]); $book->getRecipe($_GET["number"]);
$recipe = $book->sites[0]; $recipe = $book->sites[0];
echo "<h1 data-recipeid='$recipe->ID'>$recipe->Name</h1>"; echo "<h1 id='recipeHeader' data-recipeid='$recipe->ID'>$recipe->Name</h1>";
echo "<h2>Zutaten</h2>"; echo "<h2>Zutaten</h2>";
echo "<button id='addToListButton' class='button'>Zur Einkaufsliste hinzufügen</button>"; echo "<button id='addToListButton' class='button'>Zur Einkaufsliste hinzufügen</button>";
echo "<div id='ingredients'>"; echo "<div id='ingredients'>";
@ -17,9 +18,8 @@
} }
echo "</div>"; echo "</div>";
echo "<h2>Zubereitung</h2>"; echo "<h2>Zubereitung</h2>";
foreach(explode("\r\n", $recipe->Beschreibung) as $paragraph){ $parsedown = new Parsedown;
echo "<p>$paragraph</p>"; echo $parsedown->text($recipe->Beschreibung);
}
?> ?>
<div id="editingMenu"></div> <div id="editingMenu"></div>
<div id="editingMenuOpen"> <div id="editingMenuOpen">

1980
php/classes.parsedown.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,98 @@
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,800'); @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,800');
html { html {
transition: .6s; transition: .6s;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
background-color: #c3c3c3; background-color: #c3c3c3;
} }
h1 { h1 {
font-size: 3em; font-size: 3em;
text-align: center; text-align: center;
color: #333;
text-transform: uppercase;
} }
h2 {
color: #333;
text-transform: uppercase;
}
h3 {
color: #444;
text-transform: capitalize;
}
h4 {
color: #444;
text-transform: capitalize;
}
h5 {
color: #555;
text-transform: lowercase;
font-weight: normal;
}
h6 {
color: #555;
text-transform: lowercase;
font-weight: normal;
}
table {
border-collapse: collapse;
border: 1px solid black;
margin: 1em 0;
}
th {
background-color: #63bf3c;
color: white;
}
td, th {
/* border: 1px solid black; */
padding: .2em .5em;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
button {
display: block;
border: 1px solid #777777;
padding: .5em 1em;
margin: 1em .25em;
}
pre {
max-height: calc(50vh - 9em);
background: #f4f4f4;
border: 1px solid #ddd;
border-left: 3px solid #a0c391;
color: #666;
page-break-inside: avoid;
font-family: monospace;
font-size: 15px;
line-height: 1.6;
margin-bottom: 1.6em;
max-width: 100%;
overflow: auto;
padding: 1em 1.5em;
display: block;
word-wrap: break-word;
}
.even { .even {
background-color: #000; background-color: #000;
} }
.odd { .odd {
background-color: #5f5f5f; background-color: #5f5f5f;
} }
.search { .search {
background-image: url('/pic/search.png'); background-image: url('/pic/search.png');
background-position: 10px 12px; background-position: 10px 12px;
@ -22,6 +101,7 @@ h1 {
padding: 12px 20px 12px 40px; padding: 12px 20px 12px 40px;
border: 1px solid #ddd; border: 1px solid #ddd;
} }
.button { .button {
-webkit-appearance: none; -webkit-appearance: none;
border: none; border: none;
@ -33,6 +113,7 @@ h1 {
background-color: #4CAF50; background-color: #4CAF50;
color: white; color: white;
} }
.hover:hover { .hover:hover {
background-color: #4CAF50; background-color: #4CAF50;
cursor: pointer; cursor: pointer;