From 743e96866e0203816e20bbfc792f6f1473906c7d Mon Sep 17 00:00:00 2001
From: John
Date: Mon, 19 Feb 2018 23:02:20 +0200
Subject: [PATCH] markdown filter added as twig extension
---
app/Speaker.php | 2 +-
composer.json | 1 +
composer.lock | 86 ++++++++++++++++++++++++++++++-
config/active.php | 17 ++++++
config/twigbridge.php | 2 +
database/seeds/DatabaseSeeder.php | 2 +
database/seeds/SpeakersSeeder.php | 35 +++++++++++++
resources/views/speakers.twig | 2 +-
8 files changed, 144 insertions(+), 3 deletions(-)
create mode 100644 config/active.php
create mode 100644 database/seeds/SpeakersSeeder.php
diff --git a/app/Speaker.php b/app/Speaker.php
index 8e1fff7..bb5cbbb 100644
--- a/app/Speaker.php
+++ b/app/Speaker.php
@@ -9,7 +9,7 @@ class Speaker extends Model
{
// other fields: id,img_src,schedule_id;
use HasTranslations;
- public $translatable = ['name','bio'];
+ public $translatable = ['name','bio','talk_title','talk_prev'];
public $timestamps = false;
public function talk() {
diff --git a/composer.json b/composer.json
index 5492231..29ab794 100644
--- a/composer.json
+++ b/composer.json
@@ -8,6 +8,7 @@
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
+ "jralph/twig-markdown": "1.0.1",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"mcamara/laravel-localization": "^1.3",
diff --git a/composer.lock b/composer.lock
index 63ae01a..b890d55 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "73d163ddbcd66462d15a41baa1707df3",
+ "content-hash": "e2165bc60792446ac1232a06233d30d2",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@@ -262,6 +262,50 @@
],
"time": "2017-11-14T20:44:03+00:00"
},
+ {
+ "name": "erusev/parsedown-extra",
+ "version": "0.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/erusev/parsedown-extra.git",
+ "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c",
+ "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c",
+ "shasum": ""
+ },
+ "require": {
+ "erusev/parsedown": "~1.4"
+ },
+ "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": "2015-11-01T10:19:22+00:00"
+ },
{
"name": "fideloper/proxy",
"version": "3.3.4",
@@ -587,6 +631,46 @@
],
"time": "2015-04-20T18:58:01+00:00"
},
+ {
+ "name": "jralph/twig-markdown",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/jralph/Twig-Markdown.git",
+ "reference": "d4460e29997be9ac41e8d44ee936f034646e1f84"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/jralph/Twig-Markdown/zipball/d4460e29997be9ac41e8d44ee936f034646e1f84",
+ "reference": "d4460e29997be9ac41e8d44ee936f034646e1f84",
+ "shasum": ""
+ },
+ "require": {
+ "erusev/parsedown-extra": "0.*",
+ "twig/twig": "~1.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "~0.9",
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Jralph\\Twig\\Markdown\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "A simple twig markdown extension.",
+ "keywords": [
+ "markdown",
+ "parsedown",
+ "twig"
+ ],
+ "time": "2015-09-27T11:52:17+00:00"
+ },
{
"name": "laravel/framework",
"version": "v5.5.34",
diff --git a/config/active.php b/config/active.php
new file mode 100644
index 0000000..d505f41
--- /dev/null
+++ b/config/active.php
@@ -0,0 +1,17 @@
+ 'active',
+
+];
diff --git a/config/twigbridge.php b/config/twigbridge.php
index c38b9e0..0f0284a 100644
--- a/config/twigbridge.php
+++ b/config/twigbridge.php
@@ -118,6 +118,8 @@
'App\TwigLocaleHelper',
'App\TwigEnvHelper',
+ new Jralph\Twig\Markdown\Extension(
+ new Jralph\Twig\Markdown\Parsedown\ParsedownExtraMarkdown),
],
/*
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index b3ef7a3..977e3fc 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -13,5 +13,7 @@ public function run()
{
/* Speakers are seeded through the Schedule seeder */
$this->call(ScheduleSeeder::class);
+ $this->call(PeopleTableSeeder::class);
+ $this->call(SpeakersSeeder::class);
}
}
diff --git a/database/seeds/SpeakersSeeder.php b/database/seeds/SpeakersSeeder.php
new file mode 100644
index 0000000..d124e09
--- /dev/null
+++ b/database/seeds/SpeakersSeeder.php
@@ -0,0 +1,35 @@
+insert([
+ 'name'=>json_encode([
+ 'en'=> 'Michail Styllas',
+ 'el'=> 'Μιχάλης Στύλας'
+ ]),
+ 'id'=>'styllas',
+ 'img_src'=>'styllas.jpeg',
+ 'talk_title'=>json_encode([
+ 'en'=>'Everest, the end of chaos!',
+ 'el'=> 'Το τέλος του χάους στο everest!',
+ ]),
+ 'talk_prev'=>json_encode([
+ 'en'=>'Chaos is ** extreme weather **, chaos is extreme love!',
+ 'el'=>'Χάος είναι ο ακραίος καιρός του έβερεστ, χάος είναι η αγάπη'
+ ]),
+ 'bio'=>json_encode([
+ 'en'=>'dede',
+ 'el'=>'δεδεδ'
+ ])
+ ]);
+ }
+}
diff --git a/resources/views/speakers.twig b/resources/views/speakers.twig
index caf9d8a..f7b06ad 100644
--- a/resources/views/speakers.twig
+++ b/resources/views/speakers.twig
@@ -43,7 +43,7 @@
-
{{ trans('general.speakers.talk') }}: {{ speaker.talk.event_prev }}
+
{{ trans('general.speakers.talk') }}: {{ speaker.talk_prev|markdown }}
{{ speaker.talk.subtitle }}