Skip to content

Commit 6a5cf66

Browse files
author
Phillip Weller
committed
Production rollout of markdown support
1 parent 36545a1 commit 6a5cf66

5 files changed

Lines changed: 270 additions & 8 deletions

File tree

app/Traits/Scores.php

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,20 @@ public function getSop7FinalClassificationNotesAttribute()
9090
$j = json_decode($this->legacy_json);
9191

9292
if (isset($j->scoreJson))
93-
return $j->scoreJson->summary->FinalClassificationNotes ?? null;
93+
{
94+
$k = $j->scoreJson->summary->FinalClassificationNotes;
95+
}
9496
else
95-
return $j->summary->FinalClassificationNotes ?? null;
97+
{
98+
$k = $j->summary->FinalClassificationNotes ?? null;
99+
}
100+
101+
if (empty($k))
102+
return $k;
103+
104+
$k = str_replace("\n", "\n\n", $k);
105+
106+
return $k;
96107

97108
}
98109

@@ -461,12 +472,24 @@ public function getSop8ContributorsAttribute()
461472
*/
462473
public function getSop8FinalClassificationNotesAttribute()
463474
{
464-
$j = json_decode($this->legacy_json);
475+
476+
$j = json_decode($this->legacy_json);
465477

466478
if (isset($j->scoreJson))
467-
return $j->scoreJson->summary->FinalClassificationNotes ?? null;
479+
{
480+
$k = $j->scoreJson->summary->FinalClassificationNotes;
481+
}
468482
else
469-
return $j->summary->FinalClassificationNotes ?? null;
483+
{
484+
$k = $j->summary->FinalClassificationNotes ?? null;
485+
}
486+
487+
if (empty($k))
488+
return $k;
489+
490+
$k = str_replace("\n", "\n\n", $k);
491+
492+
return $k;
470493
}
471494

472495

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"doctrine/dbal": "^3.0",
1515
"fideloper/proxy": "^4.4",
1616
"fruitcake/laravel-cors": "^2.0",
17+
"graham-campbell/markdown": "^13.1",
1718
"guzzlehttp/guzzle": "^6.5.5|^7.0.1",
1819
"jenssegers/model": "^1.4",
1920
"kyslik/column-sortable": "^6.4",

composer.lock

Lines changed: 82 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/markdown.php

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Laravel Markdown.
7+
*
8+
* (c) Graham Campbell <hello@gjcampbell.co.uk>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
return [
15+
16+
/*
17+
|--------------------------------------------------------------------------
18+
| Enable View Integration
19+
|--------------------------------------------------------------------------
20+
|
21+
| This option specifies if the view integration is enabled so you can write
22+
| markdown views and have them rendered as html. The following extensions
23+
| are currently supported: ".md", ".md.php", and ".md.blade.php". You may
24+
| disable this integration if it is conflicting with another package.
25+
|
26+
| Default: true
27+
|
28+
*/
29+
30+
'views' => true,
31+
32+
/*
33+
|--------------------------------------------------------------------------
34+
| CommonMark Extensions
35+
|--------------------------------------------------------------------------
36+
|
37+
| This option specifies what extensions will be automatically enabled.
38+
| Simply provide your extension class names here.
39+
|
40+
| Default: []
41+
|
42+
*/
43+
44+
'extensions' => [],
45+
46+
/*
47+
|--------------------------------------------------------------------------
48+
| Renderer Configuration
49+
|--------------------------------------------------------------------------
50+
|
51+
| This option specifies an array of options for rendering HTML.
52+
|
53+
| Default: [
54+
| 'block_separator' => "\n",
55+
| 'inner_separator' => "\n",
56+
| 'soft_break' => "\n",
57+
| ]
58+
|
59+
*/
60+
61+
'renderer' => [
62+
'block_separator' => "\n",
63+
'inner_separator' => "\n",
64+
'soft_break' => "\n",
65+
],
66+
67+
/*
68+
|--------------------------------------------------------------------------
69+
| Enable Em Tag Parsing
70+
|--------------------------------------------------------------------------
71+
|
72+
| This option specifies if `<em>` parsing is enabled.
73+
|
74+
| Default: true
75+
|
76+
*/
77+
78+
'enable_em' => true,
79+
80+
/*
81+
|--------------------------------------------------------------------------
82+
| Enable Strong Tag Parsing
83+
|--------------------------------------------------------------------------
84+
|
85+
| This option specifies if `<strong>` parsing is enabled.
86+
|
87+
| Default: true
88+
|
89+
*/
90+
91+
'enable_strong' => true,
92+
93+
/*
94+
|--------------------------------------------------------------------------
95+
| Enable Asterisk Parsing
96+
|--------------------------------------------------------------------------
97+
|
98+
| This option specifies if `*` should be parsed for emphasis.
99+
|
100+
| Default: true
101+
|
102+
*/
103+
104+
'use_asterisk' => true,
105+
106+
/*
107+
|--------------------------------------------------------------------------
108+
| Enable Underscore Parsing
109+
|--------------------------------------------------------------------------
110+
|
111+
| This option specifies if `_` should be parsed for emphasis.
112+
|
113+
| Default: true
114+
|
115+
*/
116+
117+
'use_underscore' => true,
118+
119+
/*
120+
|--------------------------------------------------------------------------
121+
| HTML Input
122+
|--------------------------------------------------------------------------
123+
|
124+
| This option specifies how to handle untrusted HTML input.
125+
|
126+
| Default: 'strip'
127+
|
128+
*/
129+
130+
'html_input' => 'strip',
131+
132+
/*
133+
|--------------------------------------------------------------------------
134+
| Allow Unsafe Links
135+
|--------------------------------------------------------------------------
136+
|
137+
| This option specifies whether to allow risky image URLs and links.
138+
|
139+
| Default: true
140+
|
141+
*/
142+
143+
'allow_unsafe_links' => true,
144+
145+
/*
146+
|--------------------------------------------------------------------------
147+
| Maximum Nesting Level
148+
|--------------------------------------------------------------------------
149+
|
150+
| This option specifies the maximum permitted block nesting level.
151+
|
152+
| Default: INF
153+
|
154+
*/
155+
156+
'max_nesting_level' => INF,
157+
158+
];

resources/views/gene-validity/partial/report-heading.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<tr style="font-size:14px">
5858
<td style="vertical-align:top" nowrap class="text-left">Evidence Summary:</td>
5959
<td colspan="3" style="">
60-
{{ $record->sop7_final_classification_notes ?? null }}
60+
@markdown{{ $record->sop7_final_classification_notes ?? null }}@endmarkdown
6161
<div><a style="color:#000" href="https://www.clinicalgenome.org/curation-activities/gene-disease-validity/educational-and-training-materials/standard-operating-procedures/">
6262
Gene Clinical Validity Standard Operating Procedures (SOP) -
6363
{{ App\GeneLib::validityCriteriaString($record->specified_by->label ?? null) }}

0 commit comments

Comments
 (0)