1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Restore some linefeed rendering behavior from before def7d513.

The new rendering behavior is correct in normal cases, but for the pre-rendered HTML blocks in the command and configuration references it causes a lot of churn. This would be OK if the new HTML was diff-able, but it is not.

Go back to the old behavior of using br tags for this case to reduce churn until a more permanent solution is found.
This commit is contained in:
David Steele
2021-10-29 10:35:56 -04:00
parent c32e000ab9
commit 1336657326
3 changed files with 20 additions and 3 deletions

View File

@ -118,7 +118,7 @@ my $oRenderTag =
'quote' => ['<q>', '</q>'], 'quote' => ['<q>', '</q>'],
'b' => ['<b>', '</b>'], 'b' => ['<b>', '</b>'],
'i' => ['<i>', '</i>'], 'i' => ['<i>', '</i>'],
'p' => ['<div class="section-body-text">', '</div>'], 'p' => ['', ''],
# 'bi' => ['<i><b>', '</b></i>'], # 'bi' => ['<i><b>', '</b></i>'],
'list' => ['<ul class="list-unordered">', '</ul>'], 'list' => ['<ul class="list-unordered">', '</ul>'],
'list-item' => ['<li class="list-unordered">', '</li>'], 'list-item' => ['<li class="list-unordered">', '</li>'],
@ -986,6 +986,7 @@ sub processText
my $strType = $self->{strType}; my $strType = $self->{strType};
my $strBuffer = ''; my $strBuffer = '';
my $strLastTag = 'body';
foreach my $oNode ($oText->nodeList(undef, false)) foreach my $oNode ($oText->nodeList(undef, false))
{ {
@ -1004,7 +1005,22 @@ sub processText
} }
else else
{ {
# Add br tags to separate paragraphs and linefeeds to make the output more diffable. This is needed because of the hacky
# way config text is being rendered in the final document, i.e. by passing rendered HTML into divs rather than XML to be
# rendered at that time.
if ($strLastTag eq 'p' && $strType eq 'html')
{
$strBuffer .= "<br/>\n";
if ($oNode->nameGet() eq 'p')
{
$strBuffer .= "<br/>\n";
}
}
$strBuffer .= $self->processTag($oNode); $strBuffer .= $self->processTag($oNode);
$strLastTag = $oNode->nameGet();
} }
} }
# #

View File

@ -625,7 +625,7 @@ sub backrestConfigProcess
# {strContent => "${strFile}:"}); # {strContent => "${strFile}:"});
# Convert linefeeds to br tags # Convert linefeeds to br tags
$strConfig =~ s/\n/<\/br>/g; $strConfig =~ s/\n/<br\/>\n/g;
$oConfigBodyElement-> $oConfigBodyElement->
addNew(HTML_DIV, "config-body-output", addNew(HTML_DIV, "config-body-output",
@ -685,7 +685,7 @@ sub postgresConfigProcess
# {strContent => "append to ${strFile}:"}); # {strContent => "append to ${strFile}:"});
# Convert linefeeds to br tags # Convert linefeeds to br tags
$strConfig =~ s/\n/<\/br>/g; $strConfig =~ s/\n/<br\/>\n/g;
$oConfigBodyElement-> $oConfigBodyElement->
addNew(HTML_DIV, "config-body-output", addNew(HTML_DIV, "config-body-output",

View File

@ -200,6 +200,7 @@
<commit subject="Add missing paragraph tag in user guide."/> <commit subject="Add missing paragraph tag in user guide."/>
<commit subject="Add br tags for HTML documentation rendering missed in def7d513."/> <commit subject="Add br tags for HTML documentation rendering missed in def7d513."/>
<commit subject="Add missing paragraph tags in coding standards."/> <commit subject="Add missing paragraph tags in coding standards."/>
<commit subject="Restore some linefeed rendering behavior from before def7d513."/>
<release-item-contributor-list> <release-item-contributor-list>
<release-item-contributor id="david.steele"/> <release-item-contributor id="david.steele"/>