Improved document structure

This commit is contained in:
Georgy Litvinov 2021-03-03 20:46:02 +01:00
parent bc426ec4a1
commit 6617262a81

View file

@ -53,34 +53,67 @@
</#macro>
<#macro arrangeDocumentParts >
<div class="articleParts" style="display:block;">
<div class="complexDocument articleParts" style="display:block;">
<#assign lastLevel = 0 >
<#list paths as order>
<div class = "articleExcerpt">
<#-- ${order.path} -->
<#list excerpts as excerptProperties>
<#if order.elenphExcerpt?has_content && excerptProperties.elenphExcerpt == order.elenphExcerpt>
<#assign excerptText = excerptProperties.htmlContent >
<#assign excerptTextName = excerptProperties.htmlLabel >
<#assign worksCounter = excerptProperties.worksCounter >
<#assign bibliographyCounter = excerptProperties.bibliographyCounter >
</#if>
</#list>
<#list excerpts as excerptProperties>
<#if order.elenphExcerpt?has_content && excerptProperties.elenphExcerpt == order.elenphExcerpt>
<#assign excerptText = excerptProperties.htmlContent >
<#assign excerptTextName = excerptProperties.htmlLabel >
<#assign worksCounter = excerptProperties.worksCounter >
<#assign bibliographyCounter = excerptProperties.bibliographyCounter >
</#if>
</#list>
<@startDocumentPart order.level?number lastLevel/>
<#if excerptText?? && excerptTextName?? && excerptTextName?has_content && excerptText?has_content>
<button type="button" style="border:none;padding: 18px;width: 100%; text-align:left;" class="collapsible">${excerptTextName}</button>
<div class="autoExpand htmlExcerpt" style="list-style:none; display:none;">
${excerptText}
<@arrangeSources works worksCounter?number order.elenphExcerpt />
<@arrangeLiterature bibliography bibliographyCounter?number order.elenphExcerpt />
<div class="htmlExcerpt" style="list-style:none;">
${excerptText}
<@arrangeSources works worksCounter?number order.elenphExcerpt />
<@arrangeLiterature bibliography bibliographyCounter?number order.elenphExcerpt />
</div>
</#if>
</div>
<#assign lastLevel = order.level?number >
</#list>
<@endDocumentPart lastLevel />
</div>
<@arrangeSources works works?size />
<@arrangeLiterature bibliography bibliography?size />
</#macro>
<#macro startDocumentPart newLevel lastLevel=0 >
<#assign depth = newLevel - lastLevel >
<#if depth == 0>
<@closeDocPart 1 />
<@openDocPart 1 />
<#elseif depth &gt; 0>
<@openDocPart depth />
<#else >
<@closeDocPart -depth+1 />
<@openDocPart 1 />
</#if>
</#macro>
<#macro endDocumentPart lastLevel newLevel=0>
<#assign depth = lastLevel - newLevel >
<#if depth &gt; 0>
<@closeDocPart depth />
</#if>
</#macro>
<#macro closeDocPart count>
<#list 1..count as x>
</div>
</#list>
</#macro>
<#macro openDocPart count>
<#list 1..count as x>
<button type="button" style="border:none;padding: 18px;width: 100%; text-align:left;" class="collapsible">${excerptTextName}</button>
<div class = "documentPart autoExpand articleExcerpt" style="display:block;">
</#list>
</#macro>
<#macro arrangeSources sources counter filter="none">
<#if sources?? && sources?has_content && counter &gt; 0>
<button type="button" class="collapsible" style="border: none; color: #8B4513; padding: 18px;width: 100%;text-align:left; background-color: #ffffff; background-image: url(${urls.base}/themes/iph/images/book_icon.png); background-repeat: no-repeat; background-position: left center;">Источники</button>