From 79e413d194fd6108a5157f54515ae16ae06324b6 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 12 Aug 2018 03:52:55 +0200 Subject: [PATCH] Switch to useing markdown for user formatted text --- composer.json | 5 ++- composer.lock | 50 ++++++++++++++++++++++++- src/pvv/side/social/brettspillevent.php | 44 +++++++++++----------- www/admin/aktiviteter/edit.php | 2 +- www/admin/aktiviteter/index.php | 5 ++- www/admin/motd/index.php | 2 +- www/admin/prosjekter/edit.php | 4 +- www/admin/prosjekter/index.php | 7 +++- www/aktiviteter/index.php | 10 +++-- www/anime/index.php | 5 ++- www/brettspill/index.php | 5 ++- www/hendelser/index.php | 6 ++- www/index.php | 5 ++- www/nerdepitsa/index.php | 5 ++- www/prosjekt/edit.php | 2 +- www/prosjekt/index.php | 5 ++- www/prosjekt/info.php | 5 ++- 17 files changed, 120 insertions(+), 47 deletions(-) diff --git a/composer.json b/composer.json index 92f9725..b416487 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,9 @@ { "require": { - "simplesamlphp/simplesamlphp": "~1" + "simplesamlphp/simplesamlphp": "~1", + "erusev/parsedown": "^1.7" }, "require-dev": { "ext-pdo_sqlite": "*" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index bbbcf5c..02e2358 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,57 @@ { "_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", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eff76bfaa958c3f30a87781731812450", + "content-hash": "892031a2c857679ab79c60de03fccc25", "packages": [ + { + "name": "erusev/parsedown", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "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": "2018-03-08T01:11:30+00:00" + }, { "name": "gettext/gettext", "version": "v3.6.1", diff --git a/src/pvv/side/social/brettspillevent.php b/src/pvv/side/social/brettspillevent.php index 41137b5..7f0266d 100644 --- a/src/pvv/side/social/brettspillevent.php +++ b/src/pvv/side/social/brettspillevent.php @@ -33,30 +33,28 @@ class BrettspillEvent extends Event { public function getDescription() { return [ - '

Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo?' . "\n" . - 'Da er vår brettspillkveld noe for deg!' . "\n" . + 'Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo?'. + 'Da er vår brettspillkveld noe for deg!' . 'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!', - - '

Vår samling', - - '

' . "\n" . - '', - '

* Vi har flere ekspansjoner til spillet', - '

** Vi har flere varianter av spillet', - '

' + '', + '## Vår samling', + '', + '* Dominion\*', + '* Three cheers for master', + '* Avalon', + '* Hanabi', + '* Cards aginst humanity\*', + '* Citadels', + '* Munchkin\*\*', + '* Exploding kittens\*\*', + '* Aye dark overlord', + '* Settlers of catan\*', + '* Risk\*\*', + '* og mange flere...', + '', + '\* Vi har flere ekspansjoner til spillet', + '', + '\*\* Vi har flere varianter av spillet', ]; } diff --git a/www/admin/aktiviteter/edit.php b/www/admin/aktiviteter/edit.php index 4825cb9..9163473 100644 --- a/www/admin/aktiviteter/edit.php +++ b/www/admin/aktiviteter/edit.php @@ -99,7 +99,7 @@ else { -

Beskrivelse

+

Beskrivelse (markdown)

diff --git a/www/admin/aktiviteter/index.php b/www/admin/aktiviteter/index.php index e2a17b5..89ad1e5 100644 --- a/www/admin/aktiviteter/index.php +++ b/www/admin/aktiviteter/index.php @@ -95,7 +95,10 @@ $events = array_values(array_filter(

getStart()->format("(Y-m-d H:i:s)") . " - " . $event->getStop()->format("(Y-m-d H:i:s)"); ?>

-

getDescription(), "
"); ?>

+ text(implode("\n", $event->getDescription())); + ?>
diff --git a/www/admin/motd/index.php b/www/admin/motd/index.php index 704d162..141018a 100644 --- a/www/admin/motd/index.php +++ b/www/admin/motd/index.php @@ -53,7 +53,7 @@ $motd = $motdfetcher->getMOTD();

Ikke nødvendig


-

Innhold

+

Innhold (markdown)

diff --git a/www/admin/prosjekter/edit.php b/www/admin/prosjekter/edit.php index 486a0b8..c7e1ad1 100644 --- a/www/admin/prosjekter/edit.php +++ b/www/admin/prosjekter/edit.php @@ -87,7 +87,7 @@ foreach($members as $i => $data){

Tittel

getName() . '" class="boxinput">' ?>
-

Beskrivelse

+

Beskrivelse (markdown)

@@ -140,4 +140,4 @@ foreach($members as $i => $data){

- \ No newline at end of file + diff --git a/www/admin/prosjekter/index.php b/www/admin/prosjekter/index.php index 07a1f16..971f471 100644 --- a/www/admin/prosjekter/index.php +++ b/www/admin/prosjekter/index.php @@ -92,7 +92,10 @@ $projects = array_values(array_filter(

getName() . " (ID: " . $projectID . ")"; ?>

-

getDescription(), "
"); ?>

+ text(implode("\n", $project->getDescription())); + ?>
@@ -137,4 +140,4 @@ $projects = array_values(array_filter(
- \ No newline at end of file + diff --git a/www/aktiviteter/index.php b/www/aktiviteter/index.php index 0e84225..43cb3f8 100644 --- a/www/aktiviteter/index.php +++ b/www/aktiviteter/index.php @@ -42,7 +42,7 @@ $day = (isset($_GET['day'])) $limit = 0; foreach($events as $event) { ?> -
+

getImageURL()) { ?> @@ -64,10 +64,12 @@ $day = (isset($_GET['day'])) getDescription(); ?> - ") ?> -

+ text(implode("\n", $description)); + ?> + - 4) {$limit = 4;} else $limit = 2; ?> diff --git a/www/anime/index.php b/www/anime/index.php index 52759c1..9062068 100755 --- a/www/anime/index.php +++ b/www/anime/index.php @@ -38,7 +38,10 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable); - getDescription(), "

\n

")?> + text(implode("\n", $nextEvent->getDescription())); + ?> diff --git a/www/brettspill/index.php b/www/brettspill/index.php index 65b15cb..9808fe4 100755 --- a/www/brettspill/index.php +++ b/www/brettspill/index.php @@ -46,7 +46,10 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable); - getDescription(), "

\n

")?> + text(implode("\n", $nextEvent->getDescription())); + ?> diff --git a/www/hendelser/index.php b/www/hendelser/index.php index 06954b0..8eef2af 100644 --- a/www/hendelser/index.php +++ b/www/hendelser/index.php @@ -42,7 +42,11 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden', getDescription(); ?> -

", $description) ?>

+ + text(implode("\n", $description)); + ?>
diff --git a/www/nerdepitsa/index.php b/www/nerdepitsa/index.php index fe9c073..de9183c 100755 --- a/www/nerdepitsa/index.php +++ b/www/nerdepitsa/index.php @@ -38,7 +38,10 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable); - getDescription(), "

\n

")?> + text(implode("\n", $nextEvent->getDescription())); + ?> diff --git a/www/prosjekt/edit.php b/www/prosjekt/edit.php index 94a3955..f65e2d3 100644 --- a/www/prosjekt/edit.php +++ b/www/prosjekt/edit.php @@ -71,7 +71,7 @@ if($new == 0){

Gi prosjektet ditt et passende navn


-

Beskrivelse

+

Beskrivelse (markdown)

Hva går prosjektet ditt ut på?

De første to linjene blir vist på prosjektkortet, prøv å gjøre de til et fint sammendrag eller intro!

diff --git a/www/prosjekt/index.php b/www/prosjekt/index.php index f4a922a..ba35d82 100644 --- a/www/prosjekt/index.php +++ b/www/prosjekt/index.php @@ -93,7 +93,10 @@ $projects = $projectManager->getAll();

getName(); ?>

-

',array_slice($project->getDescription(), 0, 2)); ?>

+ text(implode("\n", array_slice($project->getDescription(), 0, 2))); + ?>

Organisert av

diff --git a/www/prosjekt/info.php b/www/prosjekt/info.php index 2746c21..037d612 100644 --- a/www/prosjekt/info.php +++ b/www/prosjekt/info.php @@ -56,7 +56,10 @@ if ($attrs){

getName(); ?>

-

getDescription(), "
"); ?>

+ text(implode("\n", $project->getDescription())); + ?>