Skip to content
Snippets Groups Projects
Commit 2c9642d7 authored by Goik Martin's avatar Goik Martin
Browse files

First working NodeBB forum integration

parent 40d03d3a
No related branches found
No related tags found
No related merge requests found
/* Local modifications by positioning.supp.css */
/* ------------------------------------------------------------------------
| Syntax highlighting
+------------------------------------------------------------------------- */
......@@ -52,4 +54,15 @@
.hl-doctype {
color: #008080;
}
\ No newline at end of file
}
/* NodeBB forum support */
div.bbForum > p:before {
background-image: url("../images/comment.svg");
opacity: 0.5;
background-repeat: no-repeat;
display: inline-block;
width: 30px;
height: 20px;
content:"";
}
<svg preserveAspectRatio="xMinYMin" version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="#999" d="M20 3H0v11h4v4l4-4h12"/></svg>
\ No newline at end of file
......@@ -3,11 +3,13 @@
xmlns:d="http://docbook.org/ns/docbook"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="d"
exclude-result-prefixes="d m"
version="1.1">
<xsl:import href="../Common/common.xsl"/>
<xsl:variable name="topicLookup" select="document('topics.tid.xml', .)"/>
<xsl:template name="user.webhelp.head.content">
<xsl:param name="node"/>
......@@ -28,7 +30,7 @@
src='{$webhelp.common.dir}images/hdmlogo.svg' alt="{$brandname} Documentation"/>
</a>
</xsl:template>
<!-- copy mathml to output -->
<xsl:template match="m:*">
<xsl:element name="{local-name()}">
......@@ -55,4 +57,53 @@
</video>
</xsl:template>
<!-- Modifying Docbooc's standard -->
<xsl:template match="d:qandaset">
<xsl:variable name="title" select="(d:blockinfo/d:title|d:info/d:title|d:title)[1]"/>
<xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
<xsl:variable name="toc">
<xsl:call-template name="pi.dbhtml_toc"/>
</xsl:variable>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$title"/>
<xsl:if test="not($title)">
<!-- andhor is output on title if there is one -->
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="((contains($toc.params, 'toc') and $toc != '0') or $toc = '1') and not(ancestor::d:answer and not($qanda.nested.in.toc=0))">
<xsl:call-template name="process.qanda.toc"/>
</xsl:if>
<xsl:apply-templates select="$preamble"/>
<xsl:call-template name="process.qandaset"/>
</div>
<xsl:variable name="qandaId" select="@xml:id"/>
<xsl:variable name="tid" select="$topicLookup/map/entry[@id = $qandaId]/@tid"/>
<div class="bbForum" data-tid="{$tid}">
<p>
<a target="_blank">
<xsl:attribute name="href">
<xsl:text>https://bb.mi.hdm-stuttgart.de/topic/</xsl:text>
<xsl:value-of select="$tid"/>
</xsl:attribute>
<xsl:text>Create comment</xsl:text>
</a>
</p>
</div>
</xsl:template>
</xsl:stylesheet>
......@@ -19,8 +19,33 @@ jQuery.fn.extend({
}
});
function initBbPost(index, bbForumElement) {
var postingsUrl = "https://bb.mi.hdm-stuttgart.de/api/topic/" + bbForumElement.getAttribute("data-tid");
$.ajax({
type: 'GET',
url: postingsUrl,
dataType: "json",
success: function (data) {
var postcount = data.postcount - 1;
var p = bbForumElement.getElementsByTagName("p")[0];
var a = p.getElementsByTagName("a")[0];
var text;
if (0 == postcount) {
text = "Create comment";
a.setAttribute("style", "color: red");
} else {
text = "Read comments (" + postcount + ((1 == postcount) ? " posting" : " postings") + ")";
a.setAttribute("style", "color: green");
}
a.innerHTML = text;
}
});
}
$(document).ready(
function () {
$(".bbForum").each(initBbPost);
$(".hideSolution").next().toggle(0); // Show or hide first following sibling
$(".hideSolution").toggleVisibilityState(); // Initialization
......
......@@ -78,8 +78,8 @@ SAXONCMD=java -cp "${DBOOK_XSL}/tools/lib/saxon9he.jar:/usr/share/java/xercesImp
${SAXONCMD} -s:$(<F) \
-xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2docbook.xsl > ${*}.xml
${SAXONCMD} -s:$*.xml \
-xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2topics.xsl ${dbookXslWebhelpParam} > ${*}.topics.xml
${CMDID2TOPIC} ${*}.topics # Only basename without .xml extension
-xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2topics.xsl ${dbookXslWebhelpParam} > ${@D}/topics.xml
${CMDID2TOPIC} ${@D}/topics # Only basename without .xml extension
${SAXONCMD} -s:$*.xml \
-xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2html.xsl > ${*}.html.xml
${SAXONCMD} -s:$*.xml \
......@@ -96,7 +96,7 @@ SAXONCMD=java -cp "${DBOOK_XSL}/tools/lib/saxon9he.jar:/usr/share/java/xercesImp
${SAXON6CMD} $< ${DBOOK_XSL_CUSTOM}/webhelp/webhelpHdm.xsl ${dbookXslWebhelpParam}
rsync -a ${DBOOK_XSL}/webhelp/template/* . # Images, Css
cat ${DBOOK_XSL_CUSTOM}/webhelp/common/css/positioning.supp.css >> common/css/positioning.css # highlighting supplements
cp ${DBOOK_XSL_CUSTOM}/webhelp/common/images/hdmlogo.svg common/images
cp ${DBOOK_XSL_CUSTOM}/webhelp/common/images/*.svg common/images
cp ${DBOOK_XSL_CUSTOM}/webhelp/common/images/favicon.ico .
rsync -a --exclude='.git' /usr/share/hdmwebhelp/extern/libs/mathjax .
cd ${DBOOK_XSL}/webhelp/template/search; \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment