[libvirt PATCH] docs: add 'edit this page' link to footer of every page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To encourage contributors to make changes to the main website, add a
footer link to every page which links to the corresponding source file
in git. With gitlab, they are able to edit content directly in the web
browser and then submit a merge request. This gives a way to contribute
content that is arguably easier than our wiki which requires manual
account creation, while this will also benefit from maintainer review.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 docs/Makefile.am | 5 +++++
 docs/page.xsl    | 7 +++++++
 docs/site.xsl    | 1 +
 docs/subsite.xsl | 1 +
 4 files changed, 14 insertions(+)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index 61862c4ab7..483414105d 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -429,6 +429,10 @@ manpages/%.html.in: manpages/%.rst
 %.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \
 		$(acl_generated)
 	$(AM_V_GEN)name=`echo $@ | sed -e 's/.tmp//'`; \
+          genhtmlin=`echo $@ | sed -e 's/.tmp/.in/'`; \
+          rst=`echo $@ | sed -e 's/.html.tmp/.rst/'`; \
+          src="$$genhtmlin"; \
+          test -f "$$genhtmlin" && src="$$rst"; \
 	  dir=`dirname $@` ; \
 	  if test "$$dir" = "."; \
 	  then \
@@ -438,6 +442,7 @@ manpages/%.html.in: manpages/%.rst
 	    style=subsite.xsl; \
 	  fi; \
 	  $(XSLTPROC) --stringparam pagename $$name \
+            --stringparam pagesrc $$src \
 	    --stringparam builddir '$(abs_top_builddir)' \
 	    --stringparam timestamp $(timestamp) --nonet \
 	    $(top_srcdir)/docs/$$style $< > $@ \
diff --git a/docs/page.xsl b/docs/page.xsl
index ddae5ab508..6e3ed6c688 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -77,6 +77,7 @@
   <!-- This is the master page structure -->
   <xsl:template match="/" mode="page">
     <xsl:param name="pagename"/>
+    <xsl:param name="pagesrc"/>
     <xsl:param name="timestamp"/>
     <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;
 </xsl:text>
@@ -150,6 +151,12 @@
           </div>
         </div>
         <div id="footer">
+          <div id="contact">
+            <h3>Contribute</h3>
+            <ul>
+              <li><a href="https://gitlab.com/libvirt/libvirt/-/blob/master/docs/{$pagesrc}";>edit this page</a></li>
+            </ul>
+          </div>
           <div id="contact">
             <h3>Contact</h3>
             <ul>
diff --git a/docs/site.xsl b/docs/site.xsl
index c9d41f2c93..73ddd8ca6b 100644
--- a/docs/site.xsl
+++ b/docs/site.xsl
@@ -27,6 +27,7 @@
   <xsl:template match="/">
     <xsl:apply-templates select="." mode="page">
       <xsl:with-param name="pagename" select="$pagename"/>
+      <xsl:with-param name="pagesrc" select="$pagesrc"/>
       <xsl:with-param name="timestamp" select="$timestamp"/>
     </xsl:apply-templates>
   </xsl:template>
diff --git a/docs/subsite.xsl b/docs/subsite.xsl
index f56ac0491c..bfd34eebd2 100644
--- a/docs/subsite.xsl
+++ b/docs/subsite.xsl
@@ -17,6 +17,7 @@
   <xsl:template match="/">
     <xsl:apply-templates select="." mode="page">
       <xsl:with-param name="pagename" select="$pagename"/>
+      <xsl:with-param name="pagesrc" select="$pagesrc"/>
       <xsl:with-param name="timestamp" select="$timestamp"/>
     </xsl:apply-templates>
   </xsl:template>
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux