Commit f86fba79 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 50c1dafa
...@@ -298,29 +298,29 @@ ...@@ -298,29 +298,29 @@
{#- jcell_ru_ref returns RU reference linked from a cell. {#- jcell_ru_ref returns RU reference linked from a cell.
if the cell embeds RU definition, its reference comes as `_<cell_ref>_ru`. #} if the cell embeds RU definition, its reference comes as `_<cell_ref>_ru`. #}
{%- macro jcell_ru_ref(icell, icell_dict) %} {%- macro jcell_ru_ref(icell, icell_dict) %}
{{- _jcell_ru_ref(icell, icell_dict, []) }} {{- _jcell_ru_ref(icell, icell_dict, []) }}
{%- endmacro %} {%- endmacro %}
{%- macro _jcell_ru_ref(icell, icell_dict, seen) %} {%- macro _jcell_ru_ref(icell, icell_dict, seen) %}
{%- set cell_ref = J(jref_of_shared(icell)) %} {%- set cell_ref = J(jref_of_shared(icell)) %}
{%- if cell_ref in seen %} {%- if cell_ref in seen %}
{%- for x in seen %} {%- for x in seen %}
{%- do ierror(x, "%s form a cycle via RU references" % seen) %} {%- do ierror(x, "%s form a cycle via RU references" % seen) %}
{%- endfor %} {%- endfor %}
{#- XXX what to return ? #} {{- None | tojson }}
{%- else %} {%- else %}
{%- do seen.append(cell_ref) %} {%- do seen.append(cell_ref) %}
{%- set ru = icell['_']['ru'] %} {%- set ru = icell['_']['ru'] %}
{%- if ru.ru_type == 'ru_ref' %} {%- if ru.ru_type == 'ru_ref' %}
{{- ru.ru_ref | tojson }} {{- ru.ru_ref | tojson }}
{%- elif ru.ru_type == 'ruincell_ref' %} {%- elif ru.ru_type == 'ruincell_ref' %}
{{- _jcell_ru_ref(icell_dict[ru.ruincell_ref], icell_dict, seen) }} {{- _jcell_ru_ref(icell_dict[ru.ruincell_ref], icell_dict, seen) }}
{%- else %} {%- else %}
{#- ru definition is embedded into cell #} {#- ru definition is embedded into cell #}
{{- ('_%s_ru' % J(jref_of_shared(icell))) | tojson }} {{- ('_%s_ru' % J(jref_of_shared(icell))) | tojson }}
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- endmacro %} {%- endmacro %}
{#- jref_of_shared returns original reference used to request shared instance. {#- jref_of_shared returns original reference used to request shared instance.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment