@@ -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 | /** |
@@ -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'); |
@@ -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>"; |