You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Make analytics optional for HTML documentation.
Analytics should only be added to the current HTML documentation on the website, so exclude them by default.
This commit is contained in:
		| @@ -225,7 +225,16 @@ sub htmlGet | ||||
|     my $self = shift; | ||||
|  | ||||
|     # Assign function parameters, defaults, and log debug info | ||||
|     my ($strOperation) = logDebugParam(__PACKAGE__ . '->htmlGet'); | ||||
|     my | ||||
|     ( | ||||
|         $strOperation, | ||||
|         $bAnalytics, | ||||
|     ) = | ||||
|         logDebugParam | ||||
|         ( | ||||
|             __PACKAGE__ . '->htmlGet', \@_, | ||||
|             {name => 'bAnalytics', optional => true, default => false, trace => true}, | ||||
|         ); | ||||
|  | ||||
|     # Build the header | ||||
|     my $strHtml = | ||||
| @@ -286,10 +295,13 @@ sub htmlGet | ||||
|             $self->indent(1) . "<link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\"></link>\n"; | ||||
|     } | ||||
|  | ||||
|     $strHtml .= | ||||
|         $self->indent(1) . "<script async src=\"https://www.googletagmanager.com/gtag/js?id=G-VKCRNV73H1\"></script>\n" . | ||||
|         $self->indent(1) . "<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}" . | ||||
|             "gtag('js',new Date());gtag('config','G-VKCRNV73H1');</script>\n"; | ||||
|     if ($bAnalytics) | ||||
|     { | ||||
|         $strHtml .= | ||||
|             $self->indent(1) . "<script async src=\"https://www.googletagmanager.com/gtag/js?id=G-VKCRNV73H1\"></script>\n" . | ||||
|             $self->indent(1) . "<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}" . | ||||
|                 "gtag('js',new Date());gtag('config','G-VKCRNV73H1');</script>\n"; | ||||
|     } | ||||
|  | ||||
|     $strHtml .= | ||||
|         $self->indent(0) . "</head>" . $self->lf() . | ||||
|   | ||||
| @@ -186,7 +186,11 @@ sub process | ||||
|     return logDebugReturn | ||||
|     ( | ||||
|         $strOperation, | ||||
|         {name => 'strHtml', value => $oHtmlBuilder->htmlGet(), trace => true} | ||||
|         {name => 'strHtml', | ||||
|             value => $oHtmlBuilder->htmlGet( | ||||
|                 {bAnalytics => defined($self->{oManifest}->variableGet('analytics')) && | ||||
|                     $self->{oManifest}->variableGet('analytics') eq 'y'}), | ||||
|             trace => true} | ||||
|     ); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -23,6 +23,9 @@ | ||||
|         <variable key="dev">n</variable> | ||||
|         <variable key="debug">n</variable> | ||||
|  | ||||
|         <!-- Add analytics to the HTML documentation? --> | ||||
|         <variable key="analytics">n</variable> | ||||
|  | ||||
|         <!-- Release date - static allows for reproducible builds --> | ||||
|         <variable key="release-date-static">n</variable> | ||||
|         <variable key="release-date" eval="y"> | ||||
|   | ||||
| @@ -297,9 +297,9 @@ eval | ||||
|         { | ||||
|             &log(INFO, "Generate website documentation"); | ||||
|  | ||||
|             executeTest("${strDocExe} --deploy --cache-only --key-var=os-type=rhel --out=html"); | ||||
|             executeTest("${strDocExe} --var=analytics=y --deploy --cache-only --key-var=os-type=rhel --out=html"); | ||||
|             $oStorageDoc->move("$strDocHtml/user-guide.html", "$strDocHtml/user-guide-rhel.html"); | ||||
|             executeTest("${strDocExe} --deploy --out-preserve --cache-only --out=html"); | ||||
|             executeTest("${strDocExe} --var=analytics=y --deploy --out-preserve --cache-only --out=html"); | ||||
|  | ||||
|             # Deploy to repository | ||||
|             &log(INFO, '...Deploy to repository'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user