template_doc_base.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {% import 'functional.cpp' as functional %}
  2. {{ ('CV.' + fun.name | upper + ' ' + doc.brief | stripTags) | comment(75, '%') | matlabURL }}
  3. %
  4. % {{ functional.composeMatlab(fun) | upper }}
  5. {% if doc.long %}
  6. {{ doc.long | stripTags | qualify(fun.name) | comment(75, '% ') | matlabURL }}
  7. {% endif %}
  8. %
  9. {# ----------------------- Returns --------------------- #}
  10. {% if fun.rtp|void|not or fun.req|outputs|length or fun.opt|outputs|length %}
  11. % Returns:
  12. {% if fun.rtp|void|not %}
  13. % LVALUE
  14. {% endif %}
  15. {% for arg in fun.req|outputs + fun.opt|outputs %}
  16. {% set uname = arg.name | upper + ('_OUT' if arg.I else '') %}
  17. {% if arg.name in doc.params %}
  18. {{ (uname + ' ' + doc.params[arg.name]) | stripTags | comment(75, '% ') }}
  19. {% else %}
  20. {{ uname }}
  21. {% endif %}
  22. {% endfor %}
  23. %
  24. {% endif %}
  25. {# ----------------- Required Inputs ------------------- #}
  26. {% if fun.req|inputs|length %}
  27. % Required Inputs:
  28. {% for arg in fun.req|inputs %}
  29. {% set uname = arg.name | upper + ('_IN' if arg.O else '') %}
  30. {% if arg.name in doc.params %}
  31. {{ (uname + ' ' + doc.params[arg.name]) | stripTags | comment(75, '% ') }}
  32. {% else %}
  33. {% endif %}
  34. {% endfor %}
  35. %
  36. {% endif %}
  37. {# ------------------ Optional Inputs ------------------- #}
  38. {% if fun.opt|inputs|length %}
  39. % Optional Inputs:
  40. {% for arg in fun.opt|inputs %}
  41. {% set uname = arg.name | upper + ('_IN' if arg.O else '') + ' (default: ' + arg.default + ')' %}
  42. {% if arg.name in doc.params %}
  43. {{ (uname + ' ' + doc.params[arg.name]) | stripTags | comment(75, '% ') }}
  44. {% else %}
  45. {{ uname }}
  46. {% endif %}
  47. {% endfor %}
  48. %
  49. {% endif %}
  50. {# ---------------------- See also --------------------- #}
  51. {% if 'seealso' in doc %}
  52. % See also: {% for item in doc['seealso'] %}
  53. cv.{{ item }}{% if not loop.last %}, {% endif %}
  54. {% endfor %}
  55. %
  56. {% endif %}
  57. {# ----------------------- Online ---------------------- #}
  58. {% set url = 'http://docs.opencv.org/modules/' + doc.module + '/doc/' + (doc.file|filename) + '.html#' + (fun.name|slugify) %}
  59. % Online docs: {{ url | matlabURL }}
  60. % Copyright {{ time.strftime("%Y", time.localtime()) }} The OpenCV Foundation
  61. %