ConfluenceWiki_Utilities.jinja 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {####
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. ####-#}
  8. {% macro Sanitize(text) -%}
  9. {{text|replace('{', '{')|replace('}', '}')|replace('[', '[')|replace(']', ']')}}
  10. {%- endmacro -%}
  11. {% macro ClearBraces(text) -%}
  12. {{text|replace('{', '')|replace('}', '')}}
  13. {%- endmacro -%}
  14. {%- macro LinkParent(context, isSplit, parentDoc, alias, uuid) -%}
  15. {%- if context[uuid] is defined -%}
  16. {%- if isSplit -%}
  17. [{{ alias }}|{{ parentDoc }} {{ context[uuid].Name[0]|upper }}#{{ ClearBraces(uuid) }}]
  18. {%- else -%}
  19. [{{ alias }}|{{ parentDoc }}#{{ ClearBraces(uuid) }}]
  20. {%- endif -%}
  21. {%- else -%}
  22. {{ alias }}
  23. {%- endif -%}
  24. {%- endmacro -%}
  25. {%- macro Link(context, config, alias, uuid) -%}
  26. {%- if config.Filter is defined -%}
  27. {%- set isSplit = true -%}
  28. {%- else -%}
  29. {%- set isSplit = false -%}
  30. {%- endif -%}
  31. {{- LinkParent(context, isSplit, config.Document, alias, uuid) -}}
  32. {%- endmacro -%}
  33. {%- macro PrintNamedLink(context, uuid, class, isSplit, parentDoc) -%}
  34. {% if class.Namespace is defined -%}
  35. {% set className = "{0}::{1}".format(class.Namespace, class.Name) %}
  36. {% else -%}
  37. {% set className = class.Name %}
  38. {% endif -%}
  39. {% if class.Id == className -%}
  40. {{ LinkParent(context, isSplit, parentDoc, Sanitize(className), uuid) }}
  41. {% else -%}
  42. {{ LinkParent(context, isSplit, parentDoc, Sanitize(className), uuid) }} - {{ Sanitize(class.Id) }}
  43. {% endif -%}
  44. {%- endmacro -%}