@@ -125,7 +125,7 @@ |
||
125 | 125 | if ($inner[0] === '#') { |
126 | 126 | return dokuwiki\plugin\prosemirror\parser\LocalLinkNode::resolveLocalLink($inner, $curId); |
127 | 127 | } |
128 | - return \dokuwiki\plugin\prosemirror\parser\InternalLinkNode::resolveLink($inner, $curId); |
|
128 | + return \dokuwiki\plugin\prosemirror\parser\InternalLinkNode::resolveLink($inner, $curId); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** @var Doku_Form $form */ |
63 | - $form =& $event->data; |
|
63 | + $form = & $event->data; |
|
64 | 64 | $useWYSIWYG = get_doku_pref('plugin_prosemirror_useWYSIWYG', false); |
65 | 65 | |
66 | 66 | $prosemirrorJSON = ''; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $form->addElement($this->buildToggleButton()); |
87 | 87 | |
88 | 88 | // output data and editor field |
89 | - $form->addHidden('prosemirror_json',$prosemirrorJSON); |
|
89 | + $form->addHidden('prosemirror_json', $prosemirrorJSON); |
|
90 | 90 | $form->insertElement(1, '<div class="prosemirror_wrapper" id="prosemirror__editor"></div>'); |
91 | 91 | } |
92 | 92 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | 'id' => 'prosemirror-linkform', |
147 | 147 | 'style' => 'display: none;', |
148 | 148 | ]); |
149 | - $linkForm->addFieldsetOpen('Links')->addClass('js-link-fieldset');; |
|
149 | + $linkForm->addFieldsetOpen('Links')->addClass('js-link-fieldset'); ; |
|
150 | 150 | $iwOptions = array_keys(getInterwiki()); |
151 | 151 | $linkForm->addDropdown('iwshortcut', $iwOptions, 'InterWiki')->attr('required', 'required'); |
152 | 152 |
@@ -342,35 +342,35 @@ |
||
342 | 342 | $node->attr('class', 'code ' . $lang); |
343 | 343 | $node->attr('data-language', $lang); |
344 | 344 | $node->attr('data-filename', rtrim($file)); |
345 | - if ($ext) |
|
346 | - { |
|
347 | - if (isset($ext['start_line_numbers_at'])) |
|
348 | - { |
|
349 | - $start_line_numbers_at = $ext['start_line_numbers_at']; |
|
350 | - if (isset($ext['enable_line_numbers']) && ($ext['enable_line_numbers'] === false)) |
|
351 | - { |
|
352 | - $start_line_numbers_at = -$start_line_numbers_at; |
|
353 | - } |
|
354 | - $node->attr('data-sln', $start_line_numbers_at); |
|
355 | - $node->attr('data-sln-old', $start_line_numbers_at); |
|
356 | - } |
|
357 | - else |
|
358 | - { |
|
359 | - $node->attr('data-sln-old', '1'); |
|
360 | - } |
|
361 | - if (isset($ext['highlight_lines_extra'])) |
|
362 | - { |
|
363 | - $str = ''; |
|
364 | - asort($ext['highlight_lines_extra']); |
|
365 | - foreach($ext['highlight_lines_extra'] as $hle) |
|
366 | - { |
|
367 | - if ($str) $str .= ','; |
|
368 | - if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
|
369 | - $str .= $hle; |
|
370 | - } |
|
371 | - $node->attr('data-hle', $str); |
|
372 | - } |
|
373 | - } |
|
345 | + if ($ext) |
|
346 | + { |
|
347 | + if (isset($ext['start_line_numbers_at'])) |
|
348 | + { |
|
349 | + $start_line_numbers_at = $ext['start_line_numbers_at']; |
|
350 | + if (isset($ext['enable_line_numbers']) && ($ext['enable_line_numbers'] === false)) |
|
351 | + { |
|
352 | + $start_line_numbers_at = -$start_line_numbers_at; |
|
353 | + } |
|
354 | + $node->attr('data-sln', $start_line_numbers_at); |
|
355 | + $node->attr('data-sln-old', $start_line_numbers_at); |
|
356 | + } |
|
357 | + else |
|
358 | + { |
|
359 | + $node->attr('data-sln-old', '1'); |
|
360 | + } |
|
361 | + if (isset($ext['highlight_lines_extra'])) |
|
362 | + { |
|
363 | + $str = ''; |
|
364 | + asort($ext['highlight_lines_extra']); |
|
365 | + foreach($ext['highlight_lines_extra'] as $hle) |
|
366 | + { |
|
367 | + if ($str) $str .= ','; |
|
368 | + if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
|
369 | + $str .= $hle; |
|
370 | + } |
|
371 | + $node->attr('data-hle', $str); |
|
372 | + } |
|
373 | + } |
|
374 | 374 | $this->nodestack->addTop($node); |
375 | 375 | $this->cdata(trim($text, "\n")); |
376 | 376 | $this->nodestack->drop('code_block'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | { |
363 | 363 | $str = ''; |
364 | 364 | asort($ext['highlight_lines_extra']); |
365 | - foreach($ext['highlight_lines_extra'] as $hle) |
|
365 | + foreach ($ext['highlight_lines_extra'] as $hle) |
|
366 | 366 | { |
367 | 367 | if ($str) $str .= ','; |
368 | 368 | if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
@@ -428,17 +428,17 @@ discard block |
||
428 | 428 | $node = new Node('rss'); |
429 | 429 | $node->attr('url', hsc($url)); |
430 | 430 | $node->attr('max', $params['max']); |
431 | - $node->attr('reverse', (bool)$params['reverse']); |
|
432 | - $node->attr('author', (bool)$params['author']); |
|
433 | - $node->attr('date', (bool)$params['date']); |
|
434 | - $node->attr('details', (bool)$params['details']); |
|
431 | + $node->attr('reverse', (bool) $params['reverse']); |
|
432 | + $node->attr('author', (bool) $params['author']); |
|
433 | + $node->attr('date', (bool) $params['date']); |
|
434 | + $node->attr('details', (bool) $params['details']); |
|
435 | 435 | |
436 | 436 | if ($params['refresh'] % 86400 === 0) { |
437 | - $refresh = $params['refresh']/86400 . 'd'; |
|
437 | + $refresh = $params['refresh'] / 86400 . 'd'; |
|
438 | 438 | } else if ($params['refresh'] % 3600 === 0) { |
439 | - $refresh = $params['refresh']/3600 . 'h'; |
|
439 | + $refresh = $params['refresh'] / 3600 . 'h'; |
|
440 | 440 | } else { |
441 | - $refresh = $params['refresh']/60 . 'm'; |
|
441 | + $refresh = $params['refresh'] / 60 . 'm'; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | $node->attr('refresh', trim($refresh)); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | |
590 | 590 | public function smiley($smiley) |
591 | 591 | { |
592 | - if(array_key_exists($smiley, $this->smileys)) { |
|
592 | + if (array_key_exists($smiley, $this->smileys)) { |
|
593 | 593 | $node = new Node('smiley'); |
594 | 594 | $node->attr('icon', $this->smileys[$smiley]); |
595 | 595 | $node->attr('syntax', $smiley); |
@@ -353,8 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | $node->attr('data-sln', $start_line_numbers_at); |
355 | 355 | $node->attr('data-sln-old', $start_line_numbers_at); |
356 | - } |
|
357 | - else |
|
356 | + } else |
|
358 | 357 | { |
359 | 358 | $node->attr('data-sln-old', '1'); |
360 | 359 | } |
@@ -364,8 +363,12 @@ discard block |
||
364 | 363 | asort($ext['highlight_lines_extra']); |
365 | 364 | foreach($ext['highlight_lines_extra'] as $hle) |
366 | 365 | { |
367 | - if ($str) $str .= ','; |
|
368 | - if ($start_line_numbers_at > 0) $hle += $start_line_numbers_at - 1; |
|
366 | + if ($str) { |
|
367 | + $str .= ','; |
|
368 | + } |
|
369 | + if ($start_line_numbers_at > 0) { |
|
370 | + $hle += $start_line_numbers_at - 1; |
|
371 | + } |
|
369 | 372 | $str .= $hle; |
370 | 373 | } |
371 | 374 | $node->attr('data-hle', $str); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function toSyntax() |
18 | 18 | { |
19 | 19 | // 555 |
20 | - $TAG = $this->data['attrs']; |
|
20 | + $TAG = $this->data['attrs']; |
|
21 | 21 | $openingTag = '<code'; |
22 | 22 | if (!empty($TAG['data-language'])) { |
23 | 23 | $openingTag .= ' ' . $TAG['data-language']; |
@@ -27,65 +27,65 @@ discard block |
||
27 | 27 | if (!empty($TAG['data-filename'])) { |
28 | 28 | $openingTag .= ' ' . $TAG['data-filename']; |
29 | 29 | } |
30 | - $extraTag = ''; |
|
31 | - if (isset($TAG['data-sln-old'])) |
|
32 | - { |
|
33 | - $sln_old = $TAG['data-sln-old']; |
|
34 | - if (is_numeric($sln_old)) |
|
35 | - { |
|
36 | - $sln_old = (int) $sln_old; |
|
37 | - } |
|
38 | - else |
|
39 | - { |
|
40 | - $sln_old = 1; |
|
41 | - } |
|
42 | - } |
|
43 | - if (isset($TAG['data-sln'])) |
|
44 | - { |
|
45 | - $start_line_numbers_at = $TAG['data-sln']; |
|
46 | - if (is_numeric($start_line_numbers_at)) |
|
47 | - { |
|
48 | - $start_line_numbers_at = (int) $start_line_numbers_at; |
|
49 | - if (!$extraTag) $extraTag = '['; |
|
50 | - if ($start_line_numbers_at > 0) |
|
51 | - $extraTag .= 'enable_line_numbers="true", '; |
|
52 | - else |
|
53 | - $extraTag .= 'enable_line_numbers="false", '; |
|
54 | - $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
|
55 | - } |
|
56 | - else |
|
57 | - { |
|
58 | - $extraTag = '[enable_line_numbers="false"'; |
|
59 | - } |
|
60 | - } |
|
61 | - if (isset($TAG['data-hle'])) |
|
62 | - { |
|
63 | - $highlight_lines_extra = $TAG['data-hle']; |
|
64 | - $arr = explode(',', $highlight_lines_extra); |
|
65 | - $str = ''; |
|
66 | - foreach($arr as $val) |
|
67 | - { |
|
68 | - if ($str) $str .= ','; |
|
69 | - if (is_numeric($val)) |
|
70 | - { |
|
71 | - $ival = (int) $val; |
|
72 | - if ($sln_old > 0 && $ival > 0) |
|
73 | - $str .= $ival - $sln_old + 1; |
|
74 | - else |
|
75 | - $str .= abs($ival); |
|
76 | - } |
|
77 | - } |
|
78 | - if ($str) |
|
79 | - { |
|
80 | - if (!$extraTag) |
|
81 | - $extraTag = '['; |
|
82 | - else |
|
83 | - $extraTag .= ', '; |
|
84 | - $extraTag .= 'highlight_lines_extra="' . $str . '"]'; |
|
85 | - } |
|
86 | - elseif ($extraTag) $extraTag .= ']'; |
|
87 | - } |
|
88 | - if ($extraTag) $openingTag .= ' ' . $extraTag; |
|
30 | + $extraTag = ''; |
|
31 | + if (isset($TAG['data-sln-old'])) |
|
32 | + { |
|
33 | + $sln_old = $TAG['data-sln-old']; |
|
34 | + if (is_numeric($sln_old)) |
|
35 | + { |
|
36 | + $sln_old = (int) $sln_old; |
|
37 | + } |
|
38 | + else |
|
39 | + { |
|
40 | + $sln_old = 1; |
|
41 | + } |
|
42 | + } |
|
43 | + if (isset($TAG['data-sln'])) |
|
44 | + { |
|
45 | + $start_line_numbers_at = $TAG['data-sln']; |
|
46 | + if (is_numeric($start_line_numbers_at)) |
|
47 | + { |
|
48 | + $start_line_numbers_at = (int) $start_line_numbers_at; |
|
49 | + if (!$extraTag) $extraTag = '['; |
|
50 | + if ($start_line_numbers_at > 0) |
|
51 | + $extraTag .= 'enable_line_numbers="true", '; |
|
52 | + else |
|
53 | + $extraTag .= 'enable_line_numbers="false", '; |
|
54 | + $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
|
55 | + } |
|
56 | + else |
|
57 | + { |
|
58 | + $extraTag = '[enable_line_numbers="false"'; |
|
59 | + } |
|
60 | + } |
|
61 | + if (isset($TAG['data-hle'])) |
|
62 | + { |
|
63 | + $highlight_lines_extra = $TAG['data-hle']; |
|
64 | + $arr = explode(',', $highlight_lines_extra); |
|
65 | + $str = ''; |
|
66 | + foreach($arr as $val) |
|
67 | + { |
|
68 | + if ($str) $str .= ','; |
|
69 | + if (is_numeric($val)) |
|
70 | + { |
|
71 | + $ival = (int) $val; |
|
72 | + if ($sln_old > 0 && $ival > 0) |
|
73 | + $str .= $ival - $sln_old + 1; |
|
74 | + else |
|
75 | + $str .= abs($ival); |
|
76 | + } |
|
77 | + } |
|
78 | + if ($str) |
|
79 | + { |
|
80 | + if (!$extraTag) |
|
81 | + $extraTag = '['; |
|
82 | + else |
|
83 | + $extraTag .= ', '; |
|
84 | + $extraTag .= 'highlight_lines_extra="' . $str . '"]'; |
|
85 | + } |
|
86 | + elseif ($extraTag) $extraTag .= ']'; |
|
87 | + } |
|
88 | + if ($extraTag) $openingTag .= ' ' . $extraTag; |
|
89 | 89 | // 555--- |
90 | 90 | $openingTag .= '>'; |
91 | 91 | return $openingTag . "\n" . $this->data['content'][0]['text'] . "\n</code>"; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $extraTag .= 'enable_line_numbers="true", '; |
52 | 52 | else |
53 | 53 | $extraTag .= 'enable_line_numbers="false", '; |
54 | - $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
|
54 | + $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) . '"'; |
|
55 | 55 | } |
56 | 56 | else |
57 | 57 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $highlight_lines_extra = $TAG['data-hle']; |
64 | 64 | $arr = explode(',', $highlight_lines_extra); |
65 | 65 | $str = ''; |
66 | - foreach($arr as $val) |
|
66 | + foreach ($arr as $val) |
|
67 | 67 | { |
68 | 68 | if ($str) $str .= ','; |
69 | 69 | if (is_numeric($val)) |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | if (is_numeric($sln_old)) |
35 | 35 | { |
36 | 36 | $sln_old = (int) $sln_old; |
37 | - } |
|
38 | - else |
|
37 | + } else |
|
39 | 38 | { |
40 | 39 | $sln_old = 1; |
41 | 40 | } |
@@ -46,14 +45,16 @@ discard block |
||
46 | 45 | if (is_numeric($start_line_numbers_at)) |
47 | 46 | { |
48 | 47 | $start_line_numbers_at = (int) $start_line_numbers_at; |
49 | - if (!$extraTag) $extraTag = '['; |
|
50 | - if ($start_line_numbers_at > 0) |
|
51 | - $extraTag .= 'enable_line_numbers="true", '; |
|
52 | - else |
|
53 | - $extraTag .= 'enable_line_numbers="false", '; |
|
48 | + if (!$extraTag) { |
|
49 | + $extraTag = '['; |
|
50 | + } |
|
51 | + if ($start_line_numbers_at > 0) { |
|
52 | + $extraTag .= 'enable_line_numbers="true", '; |
|
53 | + } else { |
|
54 | + $extraTag .= 'enable_line_numbers="false", '; |
|
55 | + } |
|
54 | 56 | $extraTag .= 'start_line_numbers_at="' . abs($start_line_numbers_at) .'"'; |
55 | - } |
|
56 | - else |
|
57 | + } else |
|
57 | 58 | { |
58 | 59 | $extraTag = '[enable_line_numbers="false"'; |
59 | 60 | } |
@@ -65,28 +66,35 @@ discard block |
||
65 | 66 | $str = ''; |
66 | 67 | foreach($arr as $val) |
67 | 68 | { |
68 | - if ($str) $str .= ','; |
|
69 | + if ($str) { |
|
70 | + $str .= ','; |
|
71 | + } |
|
69 | 72 | if (is_numeric($val)) |
70 | 73 | { |
71 | 74 | $ival = (int) $val; |
72 | - if ($sln_old > 0 && $ival > 0) |
|
73 | - $str .= $ival - $sln_old + 1; |
|
74 | - else |
|
75 | - $str .= abs($ival); |
|
75 | + if ($sln_old > 0 && $ival > 0) { |
|
76 | + $str .= $ival - $sln_old + 1; |
|
77 | + } else { |
|
78 | + $str .= abs($ival); |
|
79 | + } |
|
76 | 80 | } |
77 | 81 | } |
78 | 82 | if ($str) |
79 | 83 | { |
80 | - if (!$extraTag) |
|
81 | - $extraTag = '['; |
|
82 | - else |
|
83 | - $extraTag .= ', '; |
|
84 | + if (!$extraTag) { |
|
85 | + $extraTag = '['; |
|
86 | + } else { |
|
87 | + $extraTag .= ', '; |
|
88 | + } |
|
84 | 89 | $extraTag .= 'highlight_lines_extra="' . $str . '"]'; |
90 | + } elseif ($extraTag) { |
|
91 | + $extraTag .= ']'; |
|
85 | 92 | } |
86 | - elseif ($extraTag) $extraTag .= ']'; |
|
87 | 93 | } |
88 | - if ($extraTag) $openingTag .= ' ' . $extraTag; |
|
89 | -// 555--- |
|
94 | + if ($extraTag) { |
|
95 | + $openingTag .= ' ' . $extraTag; |
|
96 | + } |
|
97 | + // 555--- |
|
90 | 98 | $openingTag .= '>'; |
91 | 99 | return $openingTag . "\n" . $this->data['content'][0]['text'] . "\n</code>"; |
92 | 100 | } |