1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Lists can now be used outside of p and text tags.

This allows for more flexible document structuring.
This commit is contained in:
David Steele 2016-05-26 09:34:03 -04:00
parent 5a85122841
commit 0fb8bcbfb7
9 changed files with 80 additions and 27 deletions

View File

@ -7,8 +7,6 @@ use strict;
use warnings FATAL => qw(all); use warnings FATAL => qw(all);
use Carp qw(confess); use Carp qw(confess);
# use Exporter qw(import);
# our @EXPORT = qw();
use File::Basename qw(dirname); use File::Basename qw(dirname);
use Scalar::Util qw(blessed); use Scalar::Util qw(blessed);
@ -124,7 +122,7 @@ sub parse
my %oOut; my %oOut;
my $iIndex = 0; my $iIndex = 0;
my $bText = $strName eq 'text' || $strName eq 'li' || $strName eq 'p' || $strName eq 'title' || my $bText = $strName eq 'text' || $strName eq 'li' || $strName eq 'p' || $strName eq 'title' ||
$strName eq 'summary' || $strName eq 'table-cell' || $strName eq 'table-column'; $strName eq 'summary' || $strName eq 'table-cell' || $strName eq 'table-column' || $strName eq 'list-item';
# Store the node name # Store the node name
$oOut{name} = $strName; $oOut{name} = $strName;
@ -239,7 +237,7 @@ sub build
} }
if ($$oDoc{name} eq 'p' || $$oDoc{name} eq 'title' || $$oDoc{name} eq 'summary' || if ($$oDoc{name} eq 'p' || $$oDoc{name} eq 'title' || $$oDoc{name} eq 'summary' ||
$$oDoc{name} eq 'table-cell' || $$oDoc{name} eq 'table-column') $$oDoc{name} eq 'table-cell' || $$oDoc{name} eq 'table-column' || $$oDoc{name} eq 'list-item')
{ {
$$oOut{field}{text} = $oDoc; $$oOut{field}{text} = $oDoc;
} }

View File

@ -584,7 +584,7 @@ sub helpCommandDocGet
$oSectionElement->textSet($$oCommandHash{&CONFIG_HELP_DESCRIPTION}); $oSectionElement->textSet($$oCommandHash{&CONFIG_HELP_DESCRIPTION});
# use Data::Dumper; # use Data::doc;
# confess Dumper($oDoc->{oDoc}); # confess Dumper($oDoc->{oDoc});
if (defined($$oCommandHash{&CONFIG_HELP_OPTION})) if (defined($$oCommandHash{&CONFIG_HELP_OPTION}))

View File

@ -29,6 +29,10 @@ use constant HTML_DIV => 'div';
push @EXPORT, qw(HTML_DIV); push @EXPORT, qw(HTML_DIV);
use constant HTML_SPAN => 'span'; use constant HTML_SPAN => 'span';
push @EXPORT, qw(HTML_SPAN); push @EXPORT, qw(HTML_SPAN);
use constant HTML_UL => 'ul';
push @EXPORT, qw(HTML_UL);
use constant HTML_LI => 'li';
push @EXPORT, qw(HTML_LI);
#################################################################################################################################### ####################################################################################################################################
# CONSTRUCTOR # CONSTRUCTOR

View File

@ -399,6 +399,16 @@ sub sectionProcess
$oSectionBodyElement->add($oConfigElement); $oSectionBodyElement->add($oConfigElement);
} }
} }
# Add a list
elsif ($oChild->nameGet() eq 'list')
{
my $oList = $oSectionBodyElement->addNew(HTML_UL, 'list-unordered');
foreach my $oListItem ($oChild->nodeList())
{
$oList->addNew(HTML_LI, 'list-unordered', {strContent => $self->processText($oListItem->textGet())});
}
}
# Add a subsection # Add a subsection
elsif ($oChild->nameGet() eq 'section') elsif ($oChild->nameGet() eq 'section')
{ {

View File

@ -331,6 +331,16 @@ sub sectionProcess
# $oSectionBodyElement->add($oConfigElement); # $oSectionBodyElement->add($oConfigElement);
# } # }
} }
# Add a list
elsif ($oChild->nameGet() eq 'list')
{
$strMarkdown .= "\n";
foreach my $oListItem ($oChild->nodeList())
{
$strMarkdown .= "\n- " . $self->processText($oListItem->textGet());
}
}
# Add a subsection # Add a subsection
elsif ($oChild->nameGet() eq 'section') elsif ($oChild->nameGet() eq 'section')
{ {

View File

@ -350,6 +350,19 @@ pre
/*.section-body-execute-output*/ /*.section-body-execute-output*/
/*******************************************************************************
Lists
*******************************************************************************/
ul.list-unordered
{
margin-top: .5em;
}
li.list-unordered
{
margin-top: .5em;
}
/******************************************************************************* /*******************************************************************************
Keywords Keywords
*******************************************************************************/ *******************************************************************************/

View File

@ -79,9 +79,12 @@
<p><link url="{[github-url-issues]}/105">Github Issue</link></p> <p><link url="{[github-url-issues]}/105">Github Issue</link></p>
<p>Formalize this process and allow upgrades to new database versions.<ul> <p>Formalize this process and allow upgrades to new database versions:</p>
<li>Make sure that restore and expiration still work - perhaps new unit tests.</li>
<li>Add db-id param to restore and archive-get to specify a database.</li></ul></p> <list>
<list-item>Make sure that restore and expiration still work - perhaps new unit tests.</list-item>
<list-item>Add db-id param to restore and archive-get to specify a database.</list-item>
</list>
<p>This should also make it easy to throw a <quote>stanza does not exist</quote> error.</p> <p>This should also make it easy to throw a <quote>stanza does not exist</quote> error.</p>
</section> </section>
@ -99,9 +102,12 @@
<p><link url="{[github-url-issues]}/63">Github Issue</link></p> <p><link url="{[github-url-issues]}/63">Github Issue</link></p>
<p>Two improvements:<ul> <p>Two improvements:</p>
<li>Make sure recovery.conf has same ownership/mode as base path</li>
<li>Make sure base path has original ownership/permissions.</li></ul></p> <list>
<list-item>Make sure recovery.conf has same ownership/mode as base path</list-item>
<list-item>Make sure base path has original ownership/permissions.</list-item>
</list>
</section> </section>
<section id="pull-remote-options"> <section id="pull-remote-options">
@ -117,9 +123,12 @@
<p><link url="{[github-url-issues]}/134">Github Issue</link></p> <p><link url="{[github-url-issues]}/134">Github Issue</link></p>
<p>It's possible to have bogus settings in the configuration file since it is only checked for certain values.<ul> <p>It's possible to have bogus settings in the configuration file since it is only checked for certain values:</p>
<li>Detect options that are placed in the wrong sections.</li>
<li>Detect options that do not exist.</li></ul></p> <list>
<list-item>Detect options that are placed in the wrong sections.</list-item>
<list-item>Detect options that do not exist.</list-item>
</list>
</section> </section>
<section id="repo-owner-option"> <section id="repo-owner-option">
@ -294,11 +303,15 @@
<p><link url="{[github-url-issues]}/140">Github Issue</link></p> <p><link url="{[github-url-issues]}/140">Github Issue</link></p>
<p>There are some use cases where would be valuable to use relative paths. However to avoid confusion it might be best to implement it like so: <p>There are some use cases where would be valuable to use relative paths. However to avoid confusion it might be best to implement it like so:</p>
<ul>
<li>relative paths would need to being with ./</li> <list>
<li>--config would always be allowed to be relative</li> <list-item>relative paths would need to being with ./</list-item>
<li>In the config file a new option 'relative-path' would enable relative paths for all other path options.</li></ul>This would avoid strange effects for users who do not need this feature.</p> <list-item>--config would always be allowed to be relative</list-item>
<list-item>In the config file a new option 'relative-path' would enable relative paths for all other path options.</list-item>
</list>
<p>This would avoid strange effects for users who do not need this feature.</p>
</section> </section>
<section id="verify-pg-checksums"> <section id="verify-pg-checksums">

View File

@ -105,8 +105,8 @@
<!ATTLIST option-description key CDATA #REQUIRED> <!ATTLIST option-description key CDATA #REQUIRED>
<!ELEMENT section (title, <!ELEMENT section (title,
((p|table|host-add|execute-list|backrest-config|postgres-config|option-description|code-block)+| ((p|list|table|host-add|execute-list|backrest-config|postgres-config|option-description|code-block)+|
(p*, section+)|p*))> ((p|list)*, section+)|(p|list)*))>
<!ATTLIST section id CDATA #REQUIRED> <!ATTLIST section id CDATA #REQUIRED>
<!ATTLIST section keyword CDATA ""> <!ATTLIST section keyword CDATA "">
<!ATTLIST section depend CDATA ""> <!ATTLIST section depend CDATA "">
@ -163,7 +163,7 @@
<!-- Formatted elements --> <!-- Formatted elements -->
<!ELEMENT summary (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option| <!ELEMENT summary (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option|
br-setting|pg-option|pg-setting|link|user)*> br-setting|pg-option|pg-setting|link|user)*>
<!ELEMENT p (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option|br-setting| <!ELEMENT p (#PCDATA|quote|b|i|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option|br-setting|
pg-option|pg-setting|link|user)*> pg-option|pg-setting|link|user)*>
<!ATTLIST p keyword CDATA ""> <!ATTLIST p keyword CDATA "">
<!ELEMENT text (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option| <!ELEMENT text (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option|
@ -174,6 +174,9 @@
<!ELEMENT ol (li+)> <!ELEMENT ol (li+)>
<!ELEMENT li (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option| <!ELEMENT li (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option|
br-setting|pg-option|pg-setting|link|user)*> br-setting|pg-option|pg-setting|link|user)*>
<!ELEMENT list (list-item+)>
<!ELEMENT list-item (#PCDATA|quote|b|i|ul|ol|id|code|code-block|host|file|path|cmd|setting|exe|backrest|postgres|br-option|
br-setting|pg-option|pg-setting|link|user)*>
<!ELEMENT id (#PCDATA)> <!ELEMENT id (#PCDATA)>
<!ELEMENT code (#PCDATA)> <!ELEMENT code (#PCDATA)>
<!ELEMENT code-block (#PCDATA|exe)*> <!ELEMENT code-block (#PCDATA|exe)*>

View File

@ -122,11 +122,13 @@
<section id="getting-started"> <section id="getting-started">
<title>Getting Started</title> <title>Getting Started</title>
<p><backrest/> strives to be easy to configure and operate: <p><backrest/> strives to be easy to configure and operate:</p>
<ul>
<li><link page="{[backrest-page-user-guide]}">User guide</link> for Ubuntu 12.04 &amp; 14.04 / <postgres/> 9.4.</li> <list>
<li><link page="{[backrest-page-command]}">Command reference</link> for command-line operations.</li> <list-item><link page="{[backrest-page-user-guide]}">User guide</link> for Ubuntu 12.04 &amp; 14.04 / <postgres/> 9.4.</list-item>
<li><link page="{[backrest-page-configuration]}">Configuration reference</link> for creating <backrest/> configurations.</li></ul></p> <list-item><link page="{[backrest-page-command]}">Command reference</link> for command-line operations.</list-item>
<list-item><link page="{[backrest-page-configuration]}">Configuration reference</link> for creating <backrest/> configurations.</list-item>
</list>
</section> </section>
<section id="contributions"> <section id="contributions">