From 4d9187023fb19d70188e3adb31d7017aa56907bf Mon Sep 17 00:00:00 2001
From: Claas Kazzer <kazzer@ub.uni-leipzig.de>
Date: Thu, 12 Jul 2018 09:05:24 +0200
Subject: [PATCH] refs #13567 * modifies schema.org layout in data-titleDetails
 ** changes recorddataformatterfactory to facilitate schema tagging of several
 items ** separates ISBN/ISSN output in recorddataformatterfactory for tagging
 ** adds new data... templates for schema tagging ** removes schema tagging
 from page heading in record view as it produces truncated titles ** keep name
 tag in description instead ** improves schema tagging on author and place of
 publication

---
 .../View/Helper/Root/RecordDataFormatterFactory.php   |  8 ++++----
 themes/finc/scss/compiled.scss                        |  2 +-
 themes/finc/templates/RecordDriver/SolrAI/core.phtml  |  7 +++++--
 .../templates/RecordDriver/SolrDefault/core.phtml     |  7 +++++--
 .../RecordDriver/SolrDefault/data-isbn.phtml          | 11 +++++++++++
 .../RecordDriver/SolrDefault/data-issn.phtml          | 11 +++++++++++
 .../RecordDriver/SolrDefault/data-titleDetails.phtml  |  2 +-
 .../finc/templates/RecordDriver/SolrLido/core.phtml   |  5 ++++-
 .../finc/templates/RecordDriver/SolrMarc/core.phtml   |  7 +++++--
 9 files changed, 47 insertions(+), 13 deletions(-)
 create mode 100644 themes/finc/templates/RecordDriver/SolrDefault/data-isbn.phtml
 create mode 100644 themes/finc/templates/RecordDriver/SolrDefault/data-issn.phtml

diff --git a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
index 2e4e20f781f..992aa281024 100644
--- a/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
+++ b/module/finc/src/finc/View/Helper/Root/RecordDataFormatterFactory.php
@@ -198,10 +198,10 @@ class RecordDataFormatterFactory
             'data-hierarchyParentTitle.phtml'
         );
         $spec->setTemplateLine(
-            'ISBN', 'getISBNs', 'data-escapeHtml.phtml'
+            'ISBN', 'getISBNs', 'data-isbn.phtml'
         );
         $spec->setTemplateLine(
-            'ISSN', 'getISSNs', 'data-escapeHtml.phtml'
+            'ISSN', 'getISSNs', 'data-issn.phtml'
         );
         $spec->setTemplateLine(
             'Notes',
@@ -422,10 +422,10 @@ class RecordDataFormatterFactory
             'Bibliography', 'getBibliographyNotes', 'data-escapeHtml.phtml'
         );
         $spec->setTemplateLine(
-            'ISBN', 'getISBNs', 'data-escapeHtml.phtml'
+            'ISBN', 'getISBNs', 'data-isbn.phtml'
         );
         $spec->setTemplateLine(
-            'ISSN', 'getISSNs', 'data-escapeHtml.phtml'
+            'ISSN', 'getISSNs', 'data-issn.phtml'
         );
         $spec->setTemplateLine(
             'DOI', 'getCleanDOI', 'data-escapeHtml.phtml'
diff --git a/themes/finc/scss/compiled.scss b/themes/finc/scss/compiled.scss
index 31843eb62d9..5ca2f624cf4 100644
--- a/themes/finc/scss/compiled.scss
+++ b/themes/finc/scss/compiled.scss
@@ -804,7 +804,7 @@ table.collapse.in {
 
 ////// NO margin bottom
 .no-margin-btm {
-  margin-top: 0;
+  margin-btm: 0;
 }
 
 ////// NO margin left
diff --git a/themes/finc/templates/RecordDriver/SolrAI/core.phtml b/themes/finc/templates/RecordDriver/SolrAI/core.phtml
index da91f88d83f..ae088dc6da9 100644
--- a/themes/finc/templates/RecordDriver/SolrAI/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrAI/core.phtml
@@ -38,8 +38,11 @@
       <? endif; ?>
   <div class="media-body">
 
-    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars */ ?>
-      <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
+    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars;
+          remove schema name tag here but keep in description, CK
+       */
+    ?>
+      <h3><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
       <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
       <? if ($summary): ?>
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/core.phtml b/themes/finc/templates/RecordDriver/SolrDefault/core.phtml
index b921fe2429d..961f931ef87 100644
--- a/themes/finc/templates/RecordDriver/SolrDefault/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrDefault/core.phtml
@@ -37,8 +37,11 @@
   <? endif; ?>
   <div class="media-body">
 
-    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars */ ?>
-      <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
+    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars
+          remove schema name tag here but keept in description, CK
+       */
+    ?>
+      <h3><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
     <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
     <? if ($summary): ?>
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-isbn.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-isbn.phtml
new file mode 100644
index 00000000000..ea31c702f8f
--- /dev/null
+++ b/themes/finc/templates/RecordDriver/SolrDefault/data-isbn.phtml
@@ -0,0 +1,11 @@
+<!-- finc: RecordDriver - SolrDefault - data-isbn -->
+<? if (!empty($data)): ?>
+<? if (is_array($data)): ?>
+  <span property="isbn">
+    <?=implode('<br/>', array_map(array($this, 'escapeHtml'), $data))?>
+  </span>
+<? else: ?>
+<?=$this->escapeHtml($data)?>
+<? endif; ?>
+<? endif; ?>
+<!-- finc: RecordDriver - SolrDefault - data-isbn - END -->
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-issn.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-issn.phtml
new file mode 100644
index 00000000000..9c83fd7b91e
--- /dev/null
+++ b/themes/finc/templates/RecordDriver/SolrDefault/data-issn.phtml
@@ -0,0 +1,11 @@
+<!-- finc: RecordDriver - SolrDefault - data-issn -->
+<? if (!empty($data)): ?>
+<? if (is_array($data)): ?>
+  <span property="issn">
+    <?=implode('<br/>', array_map(array($this, 'escapeHtml'), $data))?>
+  </span>
+<? else: ?>
+<?=$this->escapeHtml($data)?>
+<? endif; ?>
+<? endif; ?>
+<!-- finc: RecordDriver - SolrDefault - data-issn - END -->
diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml
index f159ec02107..c903481e56b 100644
--- a/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml
+++ b/themes/finc/templates/RecordDriver/SolrDefault/data-titleDetails.phtml
@@ -1,5 +1,5 @@
 <!-- finc: RecordDriver - solrDefault - data-titleDetails -->
-<span property="title">
+<span property="name">
 <? if (!empty($data)): ?>
     <? $i = 0; foreach ($data as $title): ?>
         <?=($i > 0 ? '<br />':'')?><?=$this->escapeHtml($title)?><? $i++ ;?>
diff --git a/themes/finc/templates/RecordDriver/SolrLido/core.phtml b/themes/finc/templates/RecordDriver/SolrLido/core.phtml
index 5f4d4deeced..3ade8f8e601 100644
--- a/themes/finc/templates/RecordDriver/SolrLido/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrLido/core.phtml
@@ -55,7 +55,10 @@
   <? endif; ?>
   <div class="media-body">
 
-    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars */ ?>
+    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars
+          remove schema name tag here but keept in description, CK
+       */
+    ?>
     <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
     <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
diff --git a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
index 24ea546d21c..6be3f73ba42 100644
--- a/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
+++ b/themes/finc/templates/RecordDriver/SolrMarc/core.phtml
@@ -37,8 +37,11 @@
       <? endif; ?>
   <div class="media-body">
 
-    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars */ ?>
-      <h3 property="name"><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
+    <? /* finc: We want to get rid of trailing special chars in the title and limit its length to 100 chars
+          remove schema name tag here but keept in description, CK
+       */
+    ?>
+      <h3><?=$this->escapeHtml(preg_replace('/(\s[\/\.:]\s*)*$/', '', $this->truncate($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection(), 100)))?></h3>
 
       <? $summary = $this->driver->getSummary(); $summary = isset($summary[0]) ? $this->escapeHtml($summary[0]) : false; ?>
       <? if ($summary): ?>
-- 
GitLab