From 13366573261bf2562bc93ef77014f7d16b815e5b Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 29 Oct 2021 10:35:56 -0400 Subject: [PATCH] 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. --- doc/lib/pgBackRestDoc/Common/DocRender.pm | 18 +++++++++++++++++- doc/lib/pgBackRestDoc/Html/DocHtmlPage.pm | 4 ++-- doc/xml/release.xml | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/lib/pgBackRestDoc/Common/DocRender.pm b/doc/lib/pgBackRestDoc/Common/DocRender.pm index 8332e4d5c..8a6d74e63 100644 --- a/doc/lib/pgBackRestDoc/Common/DocRender.pm +++ b/doc/lib/pgBackRestDoc/Common/DocRender.pm @@ -118,7 +118,7 @@ my $oRenderTag = 'quote' => ['', ''], 'b' => ['', ''], 'i' => ['', ''], - 'p' => ['
', '
'], + 'p' => ['', ''], # 'bi' => ['', ''], 'list' => [''], 'list-item' => ['
  • ', '
  • '], @@ -986,6 +986,7 @@ sub processText my $strType = $self->{strType}; my $strBuffer = ''; + my $strLastTag = 'body'; foreach my $oNode ($oText->nodeList(undef, false)) { @@ -1004,7 +1005,22 @@ sub processText } 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 .= "
    \n"; + + if ($oNode->nameGet() eq 'p') + { + $strBuffer .= "
    \n"; + } + } + $strBuffer .= $self->processTag($oNode); + + $strLastTag = $oNode->nameGet(); } } # diff --git a/doc/lib/pgBackRestDoc/Html/DocHtmlPage.pm b/doc/lib/pgBackRestDoc/Html/DocHtmlPage.pm index c6407d0bc..fd2795a19 100644 --- a/doc/lib/pgBackRestDoc/Html/DocHtmlPage.pm +++ b/doc/lib/pgBackRestDoc/Html/DocHtmlPage.pm @@ -625,7 +625,7 @@ sub backrestConfigProcess # {strContent => "${strFile}:"}); # Convert linefeeds to br tags - $strConfig =~ s/\n/<\/br>/g; + $strConfig =~ s/\n/\n/g; $oConfigBodyElement-> addNew(HTML_DIV, "config-body-output", @@ -685,7 +685,7 @@ sub postgresConfigProcess # {strContent => "append to ${strFile}:"}); # Convert linefeeds to br tags - $strConfig =~ s/\n/<\/br>/g; + $strConfig =~ s/\n/\n/g; $oConfigBodyElement-> addNew(HTML_DIV, "config-body-output", diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 1f5a7ab66..00d83c710 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -200,6 +200,7 @@ +