Refactoring document structure

This commit is contained in:
Georgy Litvinov 2021-03-03 16:15:03 +01:00
parent 661871cd7e
commit 70c7f7c11b
5 changed files with 75 additions and 158 deletions

View file

@ -74,11 +74,11 @@ display:getCompilationBibliographyDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?bibliography ?elenphExcerpt
SELECT DISTINCT ?bibliography ?excerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
?elenphExcerpt ts_:bibliography ?bibliography .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt .
?excerpt ts_:bibliography ?bibliography .
} ORDER BY ?bibliography
""" .
@ -90,11 +90,11 @@ display:getCompilationWorksDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?works ?elenphExcerpt
SELECT DISTINCT ?works ?excerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
?elenphExcerpt ts_:works ?works .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt .
?excerpt ts_:works ?works .
} ORDER BY ?works
""" .

View file

@ -75,11 +75,11 @@ display:getArticleBibliographyDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?bibliography ?elenphExcerpt
SELECT DISTINCT ?bibliography ?excerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
?elenphExcerpt ts_:bibliography ?bibliography .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt .
?excerpt ts_:bibliography ?bibliography .
} ORDER BY ?bibliography
""" .
@ -91,11 +91,11 @@ display:getArticleWorksDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?works ?elenphExcerpt
SELECT DISTINCT ?works ?excerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
?elenphExcerpt ts_:works ?works .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt .
?excerpt ts_:works ?works .
} ORDER BY ?works
""" .

View file

@ -150,82 +150,7 @@ ${scripts.add('<script type="text/javascript" src="${urls.base}/themes/iph/js/co
<@documentRubrics />
<div class="articleParts" style="display:block;">
<#list paths as order>
<#-- ${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>
<div class = "articleExcerpt">
<#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}
<#if works?? && works?has_content && worksCounter?number &gt; 0 >
<div>
<button type="button" class="collapsible" style="background-color:white;border:none;padding: 18px;width: 100%;text-align:left;">Источники</button>
<div class="autoExpand works" style="display:none;">
<#list works as work>
<#if work.elenphExcerpt == order.elenphExcerpt >
<div class="work" style="list-style:none;">
<p> ${work.works} </p>
</div>
</#if>
</#list>
</div>
</div>
</#if>
<#if bibliography?? && bibliography?has_content && bibliographyCounter?number &gt; 0>
<div>
<button type="button" class="collapsible" style="background-color:white;border:none;padding: 18px;width: 100%; text-align: left;">Литература</button>
<div class="autoExpand bibliography" style="display:none;">
<#list bibliography as one_bibliography>
<#if one_bibliography.elenphExcerpt == order.elenphExcerpt >
<div class="bibliography_entry" style="list-style:none;">
<p> ${one_bibliography.bibliography} </p>
</div>
</#if>
</#list>
</div>
</div>
</#if>
</div>
</#if>
</div> <#-- articleExcerpt -->
</#list>
<#if works?? && works?has_content>
<div>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Источники</button>
<div class="autoExpand works" style="display:none;">
<#list works as work>
<div class="work" style="list-style:none;">
<p> ${work.works} </p>
</div>
</#list>
</div>
</div>
</#if>
<#if bibliography?? && bibliography?has_content>
<div>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%; text-align: left;">Литература</button>
<div class="autoExpand bibliography" style="display:none;">
<#list bibliography as one_bibliography>
<div class="bibliography_entry" style="list-style:none;">
<p> ${one_bibliography.bibliography} </p>
</div>
</#list>
</div>
</div>
</#if>
</div>
<@arrangeDocumentParts />
<@authors_underline />

View file

@ -126,76 +126,7 @@ ${scripts.add('<script type="text/javascript" src="${urls.base}/themes/iph/js/co
<@documentRubrics />
<div class="articleParts" style="display:block;">
<#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>
<#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}
<#if works?? && works?has_content && worksCounter?number &gt; 0 >
<button type="button" class="collapsible" style="background-color:white;border:none;padding: 18px;width: 100%;text-align:left; background-image: url(${urls.base}/themes/iph/images/book_icon.png); background-repeat: no-repeat; background-position: left center;">Источники</button>
<div class="autoExpand works" style="display:none;">
<#list works as work>
<#if work.elenphExcerpt == order.elenphExcerpt >
<div class="work" style="display:list-item;list-style-image:url(${urls.base}/themes/iph/images/bullet_icon.png); font-style: italic; font-family: PT Serif;">
<p> ${work.works} </p>
</div>
</#if>
</#list>
</div>
</#if>
<#if bibliography?? && bibliography?has_content && bibliographyCounter?number &gt; 0>
<button type="button" class="collapsible" style="background-color:white;border:none;padding: 18px;width: 100%; text-align: left; background-image: url(${urls.base}/themes/iph/images/book_icon.png); background-repeat: no-repeat; background-position: left center;">Литература</button>
<div class="autoExpand bibliography" style="display:none;">
<#list bibliography as one_bibliography>
<#if one_bibliography.elenphExcerpt == order.elenphExcerpt >
<div class="bibliography_entry" style="display:list-item;list-style-image:url(${urls.base}/themes/iph/images/bullet_icon.png); font-style: italic; font-family: PT Serif;">
<p> ${one_bibliography.bibliography} </p>
</div>
</#if>
</#list>
</div>
</#if>
</div>
</#if>
</div> <#-- articleExcerpt -->
</#list>
</div>
<#if works?? && works?has_content>
<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>
<div class="autoExpand works" style="display:block;">
<#list works as work>
<div class="work" style="display:list-item;list-style-image:url(${urls.base}/themes/iph/images/bullet_icon.png); font-style: italic; font-family: PT Serif;">
<p> ${work.works} </p>
</div>
</#list>
</div>
</#if>
<#if bibliography?? && bibliography?has_content>
<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>
<div class="autoExpand bibliography" style="display:block;">
<#list bibliography as one_bibliography>
<div class="bibliography_entry" style="display:list-item;list-style-image:url(${urls.base}/themes/iph/images/bullet_icon.png); font-style: italic; font-family: PT Serif;">
<p> ${one_bibliography.bibliography} </p>
</div>
</#list>
</div>
</#if>
<@arrangeDocumentParts />
<@authors_underline />

View file

@ -51,6 +51,67 @@
</#list>
</#if>
</#macro>
<#macro arrangeDocumentParts >
<div class="articleParts" style="display:block;">
<#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>
<#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 works?size order.elenphExcerpt />
<@arrangeLiterature bibliography bibliography?size order.elenphExcerpt />
</div>
</#if>
</div> <#-- articleExcerpt -->
</#list>
</div>
<@arrangeSources works works?size />
<@arrangeLiterature bibliography bibliography?size />
</#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>
<div class="autoExpand works" style="display:block;">
<#list sources as source>
<#if filter == "none" || source.excerpt == filter >
<div class="work" style="display:list-item;list-style-image:url(${urls.base}/themes/iph/images/bullet_icon.png); font-style: italic; font-family: PT Serif;">
<p> ${source.works} </p>
</div>
</#if>
</#list>
</div>
</#if>
</#macro>
<#macro arrangeLiterature literature counter filter="none">
<#if literature?? && literature?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>
<div class="autoExpand bibliography" style="display:block;">
<#list literature as literatureItem>
<#if filter == "none" || literatureItem.excerpt == filter >
<div class="bibliography_entry" style="display:list-item;list-style-image:url(${urls.base}/themes/iph/images/bullet_icon.png); font-style: italic; font-family: PT Serif;">
<p> ${literatureItem.bibliography} </p>
</div>
</#if>
</#list>
</div>
</#if>
</#macro>
<#macro authors_underline>
<#if authors?? && authors?has_content>