{% set nColNum = 0 %}{% set bOnMobile = app.session.get('is_on_mobile') %}{#
#}{% set nTargetColNum = 2 %}{#
#}{% if column_num is defined %}{#
#}{% set nColNum = column_num %}{#
#}{% if bHas2Columns %}{#
#}{% set nTargetColNum = 3 %}{#
#}{% endif %}{#
#}{% endif %}{#
#}{% set multi_column_spec = '' %}{% set link_target = '' %}{% set aRefInfo = null %}{% if passage_multilink is defined and passage_multilink is not null and passage_multilink[item.ref.id] is defined %}{% set aRefInfo = passage_multilink[item.ref.id] %}{% if bOnMobile %}{% set link_target = aRefInfo['singlelink'] %}{% endif %}{% set multi_column_spec = aRefInfo['multilink'] %}{% endif %}{#
#}{% if not bOnMobile %}{% if explanation_col1_ref is defined and explanation_col2_ref is defined and multi_column_spec != '' %}{% set link_target = path('arbitrary_three_column', {'column1Details': explanation_col1_ref, 'column2Details': explanation_col2_ref, 'column3Details': multi_column_spec}) %}{% elseif bHas2Columns and multi_column_spec != '' %}{#
#}{% set link_target = path('arbitrary_three_column', multicolumn_route_params|merge({('column3Details'): multi_column_spec}) ) %}{#
#}{% elseif compare_to is defined and compare_to is not null and multi_column_spec != '' and (aColumn1|length == 3)%}{#
#}{% set sTransUrl = compare_to.getUrl() %}{#
#}{% set ref_column_spec2 = aColumn1[0] ~ '_' ~ sTransUrl ~ '_' ~ aColumn1[2] %}{#
#}{% set link_target = path('arbitrary_three_column', {'column1Details': ref_column_spec, 'column2Details': ref_column_spec2, 'column3Details': multi_column_spec}) %}{#
#}{% elseif route_story is defined and route_story is not null and route_story.getLevelId() == 1 and ref_column_spec != '' and multi_column_spec != '' %}{#
#}{% set link_target = path('arbitrary_three_column', {'column1Details': 'biblestory_'~route_story.url~'_'~story_translation_url, 'column2Details': ref_column_spec, 'column3Details': multi_column_spec}) %}{#
#}{% elseif ref_column_spec != '' and multi_column_spec != '' %}{#
#}{% if bible_col_spec is defined and bible_col_spec != '' %}{% set link_target = path('arbitrary_three_column', {'column1Details': bible_col_spec, 'column2Details': ref_column_spec, 'column3Details': multi_column_spec}) %}{% else %}{% set link_target = path('arbitrary_two_column', {'column1Details': ref_column_spec, 'column2Details': multi_column_spec}) %}{% endif %}{#
#}{% else %}{#
#}{% set link_target = uri(item.ref) %}{#
#}{% endif %}{% endif %}{#
#}{% if aRefInfo != null and not aRefInfo["is_bibleref"] and aRefInfo["section_order"] > 1 %}{#
#}{% set link_target = link_target ~ '#subsection-' ~ nTargetColNum ~ '-' ~ aRefInfo["section_order"] %}{% endif %}<a href="{{ link_target }}" target={% if in_frame is defined and in_frame %}_blank{% else %}_top{% endif %} >{% if item.text is not empty %}{{ item.text|nl2br }}{% else %}{{ item.ref.buildLinkText() }}{% endif %}</a>