mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
docs: build: Use proper path to file in 'contribute' link
NEWS.rst is based in the root of the repository and 'hvsupport.html' doesn't have a backing file which can be edited since it's fully generated. Our 'contribute -> edit this page' link on the bottom of the page is wrong in those cases. Fix it by adding the contribute section only when there's a source and base the 'source' of a html file in the root of the repository. Along with that we need to modify the scripts/meson-html-gen.py script to accept optional 'pagesrc' and the XSL template to skip the 'contribute' section when we don't have a source. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
916e077551
commit
862cf2ace4
@ -197,7 +197,7 @@ docs_rst2html_gen = generator(
|
|||||||
# each entry is a dictionary with following items:
|
# each entry is a dictionary with following items:
|
||||||
# name - base file name (required)
|
# name - base file name (required)
|
||||||
# file - generated file (required)
|
# file - generated file (required)
|
||||||
# source - source filename (required)
|
# source - source filename relative to repository root (optional, if there is no source)
|
||||||
docs_html_in_gen = []
|
docs_html_in_gen = []
|
||||||
|
|
||||||
foreach name : docs_html_in_files
|
foreach name : docs_html_in_files
|
||||||
@ -205,7 +205,7 @@ foreach name : docs_html_in_files
|
|||||||
docs_html_in_gen += {
|
docs_html_in_gen += {
|
||||||
'name': name,
|
'name': name,
|
||||||
'file': html_in_file,
|
'file': html_in_file,
|
||||||
'source': html_in_file,
|
'source': 'docs' / html_in_file,
|
||||||
}
|
}
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ foreach name : docs_rst_files
|
|||||||
docs_html_in_gen += {
|
docs_html_in_gen += {
|
||||||
'name': name,
|
'name': name,
|
||||||
'file': docs_rst2html_gen.process(rst_file),
|
'file': docs_rst2html_gen.process(rst_file),
|
||||||
'source': rst_file,
|
'source': 'docs' / rst_file,
|
||||||
}
|
}
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
@ -242,7 +242,6 @@ hvsupport_html_in = custom_target(
|
|||||||
docs_html_in_gen += {
|
docs_html_in_gen += {
|
||||||
'name': 'hvsupport',
|
'name': 'hvsupport',
|
||||||
'file': hvsupport_html_in,
|
'file': hvsupport_html_in,
|
||||||
'source': 'hvsupport.html.in',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
news_html_in = docs_rst2html_gen.process(meson.source_root() / 'NEWS.rst')
|
news_html_in = docs_rst2html_gen.process(meson.source_root() / 'NEWS.rst')
|
||||||
@ -270,7 +269,7 @@ foreach data : docs_html_in_gen
|
|||||||
site_xsl,
|
site_xsl,
|
||||||
'@INPUT@',
|
'@INPUT@',
|
||||||
'@OUTPUT@',
|
'@OUTPUT@',
|
||||||
data['source'],
|
data.get('source', []),
|
||||||
],
|
],
|
||||||
depends: [ aclperms_gen ],
|
depends: [ aclperms_gen ],
|
||||||
depend_files: [ page_xsl ],
|
depend_files: [ page_xsl ],
|
||||||
|
@ -166,12 +166,14 @@
|
|||||||
<li><a href="http://serverfault.com/questions/tagged/libvirt">serverfault</a></li>
|
<li><a href="http://serverfault.com/questions/tagged/libvirt">serverfault</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="contribute">
|
<xsl:if test="$pagesrc != ''">
|
||||||
<h3>Contribute</h3>
|
<div id="contribute">
|
||||||
<ul>
|
<h3>Contribute</h3>
|
||||||
<li><a href="https://gitlab.com/libvirt/libvirt/-/blob/master/docs/{$pagesrc}">edit this page</a></li>
|
<ul>
|
||||||
</ul>
|
<li><a href="https://gitlab.com/libvirt/libvirt/-/blob/master/{$pagesrc}">edit this page</a></li>
|
||||||
</div>
|
</ul>
|
||||||
|
</div>
|
||||||
|
</xsl:if>
|
||||||
<div id="conduct">
|
<div id="conduct">
|
||||||
Participants in the libvirt project agree to abide by <a href="{$href_base}governance.html#codeofconduct">the project code of conduct</a>
|
Participants in the libvirt project agree to abide by <a href="{$href_base}governance.html#codeofconduct">the project code of conduct</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@ parser.add_argument("timestamp", type=str, help="docs timestamp")
|
|||||||
parser.add_argument("style", type=str, help="XSL stile file")
|
parser.add_argument("style", type=str, help="XSL stile file")
|
||||||
parser.add_argument("infile", type=str, help="path to source HTML file")
|
parser.add_argument("infile", type=str, help="path to source HTML file")
|
||||||
parser.add_argument("htmlfile", type=str, help="path to generated HTML file")
|
parser.add_argument("htmlfile", type=str, help="path to generated HTML file")
|
||||||
parser.add_argument("pagesrc", type=str, help="path to source file used for edit this page")
|
parser.add_argument("pagesrc", type=str, default="", nargs='?', help="(optional) path to source file used for edit this page")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
name = os.path.basename(args.htmlfile).replace('.html', '')
|
name = os.path.basename(args.htmlfile).replace('.html', '')
|
||||||
|
Loading…
Reference in New Issue
Block a user