Skip to content
Snippets Groups Projects
Commit 98b7748d authored by Josef Glatz's avatar Josef Glatz Committed by Georg Ringer
Browse files

[TASK] Upgrade Documentation: add footer links

Add related links for each upgrade documentation file at the
end:
- link to forge issue
- link to rendered rST document

This makes it possible to
- read the documentation as rendered html with on click
- easily share an upgrade document with others
- open the related forge issue

Resolves: #90923
Releases: master, 9.5
Change-Id: Iedf874e31b7026a55275d6073d645e875dab1b6c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64044


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent c2244329
Branches
Tags
No related merge requests found
...@@ -151,6 +151,13 @@ ...@@ -151,6 +151,13 @@
} }
} }
.rst-links {
position: absolute;
bottom: 0.5em;
right: 1.2em;
padding-left: (($line-height-computed - 1) / 2);
}
pre { pre {
margin: 0; margin: 0;
border-radius: 0; border-radius: 0;
...@@ -160,6 +167,14 @@ ...@@ -160,6 +167,14 @@
word-break: normal; word-break: normal;
word-wrap: normal; word-wrap: normal;
} }
.rst-links + pre {
padding-bottom: (($line-height-computed - 1) * 3);
@media (min-width: $screen-sm-min) {
padding-bottom: (($line-height-computed - 1) * 2);
}
}
} }
.item { .item {
......
This diff is collapsed.
...@@ -132,6 +132,7 @@ class DocumentationFile ...@@ -132,6 +132,7 @@ class DocumentationFile
$entry['version'] = PathUtility::basename(PathUtility::dirname($file)); $entry['version'] = PathUtility::basename(PathUtility::dirname($file));
$entry['headline'] = $headline; $entry['headline'] = $headline;
$entry['filepath'] = $file; $entry['filepath'] = $file;
$entry['filename'] = pathinfo($file)['filename'];
$entry['tags'] = $this->extractTags($lines); $entry['tags'] = $this->extractTags($lines);
$entry['class'] = 'default'; $entry['class'] = 'default';
foreach ($entry['tags'] as $key => $tag) { foreach ($entry['tags'] as $key => $tag) {
...@@ -145,6 +146,17 @@ class DocumentationFile ...@@ -145,6 +146,17 @@ class DocumentationFile
$entry['content'] = file_get_contents($file); $entry['content'] = file_get_contents($file);
$entry['parsedContent'] = $this->parseContent($entry['content']); $entry['parsedContent'] = $this->parseContent($entry['content']);
$entry['file_hash'] = md5($entry['content']); $entry['file_hash'] = md5($entry['content']);
if ($entry['version'] !== '') {
$entry['url']['documentation'] = sprintf(
'https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/%s/%s.html',
$entry['version'],
$entry['filename']
);
}
$entry['url']['issue'] = sprintf(
'https://forge.typo3.org/issues/%s',
$this->parseIssueId($entry['filename'])
);
return [md5($file) => $entry]; return [md5($file) => $entry];
} }
...@@ -333,6 +345,16 @@ class DocumentationFile ...@@ -333,6 +345,16 @@ class DocumentationFile
return trim($content); return trim($content);
} }
/**
* @param string $filename
*
* @return string
*/
protected function parseIssueId(string $filename): string
{
return GeneralUtility::trimExplode('-', $filename)[1];
}
/** /**
* @return Finder * @return Finder
*/ */
......
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> <html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
data-namespace-typo3-fluid="true">
<div class="t3js-upgrade-doc panel panel-rst panel-{fileArray.class} risk-medium item" data-item-tags="{fileArray.tagList}" data-item-version="{fileArray.version}" data-item-state="{state}" id="heading{id}"> <div class="t3js-upgrade-doc panel panel-rst panel-{fileArray.class} risk-medium item" data-item-tags="{fileArray.tagList}" data-item-version="{fileArray.version}" data-item-state="{state}" id="heading{id}">
<div class="panel-heading" role="tab"> <div class="panel-heading" role="tab">
...@@ -25,6 +28,12 @@ ...@@ -25,6 +28,12 @@
</div> </div>
<div id="collapse{id}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{id}"> <div id="collapse{id}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{id}">
<div class="rst-tags t3js-tags"></div> <div class="rst-tags t3js-tags"></div>
<div class="rst-links">
<a href="{fileArray.url.issue}" target="_blank" rel="noreferrer" class="nowrap"><core:icon identifier="actions-window-open" /> Open issue</a>
<f:if condition="{fileArray.url.documentation}">
<a href="{fileArray.url.documentation}" target="_blank" rel="noreferrer" class="nowrap"><core:icon identifier="actions-window-open" /> Open rendered version</a>
</f:if>
</div>
<pre><f:format.raw>{fileArray.parsedContent}</f:format.raw></pre> <pre><f:format.raw>{fileArray.parsedContent}</f:format.raw></pre>
</div> </div>
</div> </div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment