Switch to useing markdown for user formatted text

This commit is contained in:
2018-08-12 03:52:55 +02:00
parent 307eba4218
commit 79e413d194
17 changed files with 120 additions and 47 deletions

View File

@@ -99,7 +99,7 @@ else {
</div>
</div>
<p class="subtitle">Beskrivelse</p>
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivese" required><?= implode($event->getDescription(), "\n"); ?></textarea>

View File

@@ -95,7 +95,10 @@ $events = array_values(array_filter(
<p class="subnote">
<?= $event->getStart()->format("(Y-m-d H:i:s)") . " - " . $event->getStop()->format("(Y-m-d H:i:s)"); ?>
</p>
<p><?= implode($event->getDescription(), "<br>"); ?></p>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $event->getDescription()));
?>
</div>
<div class="event-actions">

View File

@@ -53,7 +53,7 @@ $motd = $motdfetcher->getMOTD();
<p class="subnote">Ikke nødvendig</p>
<input type="text" name="title" value="<?= $motd['title'] ?>" class="boxinput" style="width:66%;"><br>
<p class="subtitle no-chin">Innhold</p>
<p class="subtitle no-chin">Innhold (<i>markdown</i>)</p>
<textarea name="content" style="width:100%" rows="8" class="boxinput"><?= implode("\n", $motd["content"]) ?></textarea>
<div style="margin-top: 2em;">

View File

@@ -87,7 +87,7 @@ foreach($members as $i => $data){
<p class="subtitle">Tittel</p>
<?= '<input type="text" name="title" value="' . $project->getName() . '" class="boxinput">' ?><br>
<p class="subtitle">Beskrivelse</p>
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
<textarea name="desc" cols="40" rows="5" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>
</div>
@@ -140,4 +140,4 @@ foreach($members as $i => $data){
</form>
<p>
</main>
</body>
</body>

View File

@@ -92,7 +92,10 @@ $projects = array_values(array_filter(
<div class="event-info">
<h3 class="no-chin"><?= $project->getName() . " (ID: " . $projectID . ")"; ?></h3>
<p class="subnote"><?= 'Organisert av: ' . $owner['name']; ?></p>
<p><?= implode($project->getDescription(), "<br>"); ?></p>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $project->getDescription()));
?>
</div>
<div class="event-actions">
@@ -137,4 +140,4 @@ $projects = array_values(array_filter(
</div>
</main>
</body>
</body>

View File

@@ -42,7 +42,7 @@ $day = (isset($_GET['day']))
$limit = 0;
foreach($events as $event) {
?>
<div>
<article>
<h2>
<?php if ($event->getImageURL()) { ?>
<img src="<?= $event->getImageURL() ?>">
@@ -64,10 +64,12 @@ $day = (isset($_GET['day']))
<?php $description = $event->getDescription(); ?>
<?php if ($limit) array_splice($description, $limit); ?>
<?= implode($description, "<br>") ?>
</div>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $description));
?>
</article>
<?php if (!$limit || $limit > 4) {$limit = 4;} else $limit = 2; ?>
<?php } ?>
</main>

View File

@@ -38,7 +38,10 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
</strong>
</ul>
<?= implode($nextEvent->getDescription(), "<p>\n</p>")?>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
?>
</article>
</main>

View File

@@ -46,7 +46,10 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
</strong>
</ul>
<?= implode($nextEvent->getDescription(), "<p>\n</p>")?>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
?>
</article>
</main>

View File

@@ -42,7 +42,11 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
<?php $description = $event->getDescription(); ?>
<?php if ($description_paragraphs) array_splice($description, $description_paragraphs); ?>
<p><?= implode("<br>", $description) ?></p>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $description));
?>
<ul class="subtext">
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>

View File

@@ -89,8 +89,9 @@ $motd = $motdfetcher->getMOTD();
echo $title;
}
echo "</h2>";
echo "<p>" . implode($motd["content"], "<br>") . "</p>";
$Parsedown = new Parsedown();
echo $Parsedown->text(implode("\n", $motd["content"]));
?>
</div>
</main>

View File

@@ -38,7 +38,10 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
</strong>
</ul>
<?= implode($nextEvent->getDescription(), "<p>\n</p>")?>
<?php
$Parsedown = new Parsedown();
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
?>
</article>
</main>

View File

@@ -71,7 +71,7 @@ if($new == 0){
<p class="subnote">Gi prosjektet ditt et passende navn</p>
<input type="text" name="title" value="<?= $project->getName() ?>" class="boxinput" style="width:66%;"><br>
<p class="subtitle no-chin">Beskrivelse</p>
<p class="subtitle no-chin">Beskrivelse (<i style="opacity:0.5;">markdown</i>)</p>
<p class="subnote no-chin">Hva går prosjektet ditt ut på?</p>
<p class="subnote">De første to linjene blir vist på prosjektkortet, prøv å gjøre de til et fint sammendrag eller intro!</p>
<textarea name="desc" style="width:100%" rows="8" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>

View File

@@ -93,7 +93,10 @@ $projects = $projectManager->getAll();
<a class="nostyle" href="info.php?id=<?= $project->getID() ?>"><div class="project-card">
<div class="card-content">
<h4 class="project-title"><?= $project->getName(); ?></h4>
<p><?= implode('<br>',array_slice($project->getDescription(), 0, 2)); ?></p>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", array_slice($project->getDescription(), 0, 2)));
?>
</div>
<p class="project-organizer">Organisert av <?= $owner['name']; ?></p>
</div></a>

View File

@@ -56,7 +56,10 @@ if ($attrs){
<main class="contentsplit">
<div class="gridr">
<h2><?= $project->getName(); ?></h2>
<p><?= implode($project->getDescription(), "<br>"); ?></p>
<?php
$Parsedown = new \Parsedown();
echo $Parsedown->text(implode("\n", $project->getDescription()));
?>
</div>
<div class="gridl">