processing gitlab image paths

This commit is contained in:
skyanth 2020-01-13 17:07:52 +01:00
parent e1df355415
commit 31619a4824

View File

@ -40,8 +40,12 @@
</p> </p>
</xsl:template> </xsl:template>
<!-- TODO: change <img src="/uploads/ac943b3c98d3630f7b1d787c00aa9417/file.png"/> to <!-- add .. to <img src="/uploads/[long code]/file.png"/> -->
<img src="../screenshots/file.png"/> --> <xsl:template match="img/@src">
<xsl:if test="starts-with(., '/uploads/')">
<xsl:attribute name="src" select="concat('..', .)"/>
</xsl:if>
</xsl:template>
<!-- get rid of superfluous breaks before images or h3 tags --> <!-- get rid of superfluous breaks before images or h3 tags -->
<!-- (not perfect, ideally post-process result later to flatten img or h3 out of p --> <!-- (not perfect, ideally post-process result later to flatten img or h3 out of p -->
@ -62,5 +66,8 @@
<xsl:apply-templates/> <xsl:apply-templates/>
</xsl:template> </xsl:template>
<xsl:template match="p[child::img[not(preceding-sibling::*)][not(following-sibling::*)]]">
<xsl:apply-templates select="@* | node()"/>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>