Skip to content

Commit

Permalink
For Hebrew/Genizah only, turn all refs not to URLs into searches
Browse files Browse the repository at this point in the history
Temporary fix so cross-references work.
  • Loading branch information
andrew-morrison committed Mar 8, 2018
1 parent 7509149 commit 4041480
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions msdesc2html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,26 @@
<xsl:template match="ref[@target]" priority="10">
<xsl:variable name="target" as="xs:string" select="normalize-space(@target)"/>
<xsl:choose>
<xsl:when test="starts-with($target, 'http') or starts-with($target, 'mailto') or starts-with($target, 'ftp')">
<!-- For valid-looking URLs create links to external resources -->
<a href="{$target}">
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:when test="starts-with($target, 'www')">
<!-- Assume if the protocol is missing that it is http (hopefully the destination server will redirect if https) -->
<a href="http://{$target}">
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:when test="contains(base-uri(.), 'hebrew-mss') or contains(base-uri(.), 'genizah-mss')">
<!-- In Hebrew and Genizah, anything that isn't a URL appearsr to be a classmarks, sometimes with part numbers appended,
so as a TEMPORARY fix, convert them into links to search the catalogue -->
<a href="/?q={translate($target, '_#', ' ')}">
<xsl:apply-templates/>
<xsl:copy-of select="bod:logging('warn', 'Converting ref with unrecognized target into a search', ., $target)"/>
</a>
</xsl:when>
<xsl:when test="starts-with($target, '#')">
<xsl:choose>
<xsl:when test="$target = (//@xml:id)">
Expand All @@ -526,30 +546,6 @@
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="string-length($target) le 3">
<!-- Anything shorter than a few chars is very likely another old ID -->
<xsl:apply-templates/>
<xsl:copy-of select="bod:logging('warn', 'Skipping ref with invalid target', ., $target)"/>
</xsl:when>
<xsl:when test="starts-with($target, 'www')">
<!-- Assume if the protocol is missing that it is http (hopefully if it is https the destiantion server will redirect) -->
<a href="http://{$target}">
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:when test="starts-with($target, 'http') or starts-with($target, 'mailto') or starts-with($target, 'ftp')">
<!-- For valid-looking URLs create links to external resources -->
<a href="{$target}">
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:when test="contains(base-uri(.), 'hebrew-mss') or contains(base-uri(.), 'genizah-mss')">
<!-- In Hebrew and Genizah, a lot of these look like classmarks, so convert them into links to search the catalogue -->
<a href="/?q={translate($target, '_#', ' ')}">
<xsl:apply-templates/>
<xsl:copy-of select="bod:logging('warn', 'Converting ref with unrecognized target into a search', ., $target)"/>
</a>
</xsl:when>
<xsl:otherwise>
<!-- Probably either an old ID or a book reference -->
<xsl:apply-templates/>
Expand Down

1 comment on commit 4041480

@andrew-morrison
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.