Implemented dynamic loading of the Wiki in the online documentation.

This commit is contained in:
Ilya Lysenkov 2010-10-25 09:54:47 +00:00
parent f27a54be97
commit 0886177c5a
4 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,17 @@
function insertIframe (elementId, iframeSrc)
{
var iframe;
if (document.createElement && (iframe = document.createElement('iframe')))
{
iframe.src = iframeSrc;
iframe.width = "100%";
iframe.height = "511px";
var element = document.getElementById(elementId);
element.parentNode.replaceChild(iframe, element);
}
}

View File

@ -1,5 +1,7 @@
{% extends "basic/layout.html" %}
{% set script_files = script_files + [pathto("_static/insertIframe.js", 1)] %}
{% block document %}
<div class="documentwrapper">
{%- if not embedded %}{% if not theme_nosidebar|tobool %}

View File

@ -12,4 +12,13 @@ do
mkdir -p $D
cp conf.py $D
TEXINPUTS=$PWD: sphinx-build -w $D/sphinx.errors -D "lang=$D" -b html -d _build/doctrees/$D $D _build/html/$D
#Insert javascript links to load the Wiki in a frame
for file in `ls _build/html/$D/*.html`
do
cat $file | sed "/Comments from the Wiki/s/href=\"\(.*\)\">id=0.\([0-9]*\) /href=\"javascript:void\(0\)\" onclick=\"insertIframe\('\2', '\1'\)\" id=\"\2\">/" > tmp.html
mv 'tmp.html' "$file"
done
done

View File

@ -7,6 +7,7 @@ import pyparsing as pp
import StringIO
from qfile import QOpen
from string import Template
from random import random
# useful things for pyparsing
def returnList(x):
@ -152,7 +153,7 @@ class SphinxWriter:
self.cur_module = self.render(c.params[1].str)
def wikiLink(self, name):
return '*Comments on* `wiki <http://opencv.willowgarage.com/wiki/documentation/%s/%s/%s>`__' % (self.language, self.cur_module, name)
return '`id=%s Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/%s/%s/%s>`__' % (random(), self.language, self.cur_module, name)
def cmd_cvCppCross(self, c):
self.write(":func:`%s`" % str(c.params[0]))