Linked online documentation now opens a browser window to the exact function reference using div tags

This commit is contained in:
hbristow 2013-08-07 19:28:58 +10:00
parent 3483bf14b9
commit f705020348
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
from textwrap import TextWrapper
from string import split, join
import re
import re, os
def inputs(args):
'''Keeps only the input arguments in a list of elements.
@ -93,6 +93,12 @@ def stripTags(text):
def qualify(text, name):
return re.sub(name.upper(), 'CV.'+name.upper(), text)
def slugify(text):
return text.lower().replace('_', '-')
def filename(fullpath):
return os.path.splitext(os.path.basename(fullpath))[0]
def comment(text, wrap=80, escape='% ', escape_first='', escape_last=''):
'''comment filter
Takes a string in text, and wraps it to wrap characters in length with

View File

@ -46,12 +46,14 @@ class MatlabWrapperGenerator(object):
jtemplate.filters['toLowerCamelCase'] = toLowerCamelCase
jtemplate.filters['toUnderCase'] = toUnderCase
jtemplate.filters['stripTags'] = stripTags
jtemplate.filters['filename'] = filename
jtemplate.filters['comment'] = comment
jtemplate.filters['inputs'] = inputs
jtemplate.filters['ninputs'] = ninputs
jtemplate.filters['outputs'] = outputs
jtemplate.filters['noutputs'] = noutputs
jtemplate.filters['qualify'] = qualify
jtemplate.filters['slugify'] = slugify
jtemplate.filters['only'] = only
jtemplate.filters['void'] = void
jtemplate.filters['not'] = flip

View File

@ -52,6 +52,7 @@ cv.{{ item }}{% if not loop.last %}, {% endif %}
%
{% endif %}
% Official documentation: http://docs.opencv.org
{% set url = 'http://docs.opencv.org/modules/' + doc.module + '/doc/' + (doc.file|filename) + '.html#' + (fun.name|slugify) %}
% Online docs: <a href="matlab: web('{{url}}', '-browser')">{{url}}</a>
% Copyright {{ time.strftime("%Y", time.localtime()) }} The OpenCV Foundation
%