-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat the metadata abstract as ReStructured text
Abstracts in XML metadata retrieved from the Discovery Web Service are treated as being in ReStructured Text (RST) format. This is converted to HTML in the full and KML renderings of a metadata entry. Interpreting abstracts as RST should not affect existing metadata other than improve formatting in many cases. It will, however, allow future metadata production to take advantage of the formatting conventions provided by RST whilst still maintaining a human readable output to the raw XML metadata.
- Loading branch information
Homme Zwaagstra
committed
Sep 24, 2014
1 parent
382222b
commit ee511a8
Showing
3 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
# You can obtain a full copy of the RPL from | ||
# http://opensource.org/licenses/rpl1.5.txt or [email protected] | ||
|
||
from docutils import core | ||
|
||
""" | ||
Filters used in Mako templates. | ||
|
@@ -37,3 +39,10 @@ def quote(text): | |
if ' ' in text: | ||
return '"' + text + '"' | ||
return text | ||
|
||
def rst2html(rst): | ||
"""Convert restructured text into a HTML fragment""" | ||
# taken from <https://wiki.python.org/moin/ReStructuredText> | ||
|
||
parts = core.publish_parts(source=rst, writer_name='html') | ||
return parts['body_pre_docinfo']+parts['fragment'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ | |
http://opensource.org/licenses/rpl1.5.txt or [email protected] | ||
</%doc>\ | ||
<%! | ||
from medin.filters import rst2html | ||
template = "" | ||
%><?xml version="1.0" encoding="UTF-8"?> | ||
<kml xmlns="http://www.opengis.net/kml/2.2" | ||
|
@@ -50,9 +52,7 @@ | |
<name>${title | x}</name> | ||
<description> | ||
<![CDATA[ | ||
<p> | ||
${abstract | x} | ||
</p> | ||
${abstract | rst2html} | ||
<p>Further metadata details are available <a href="${script_root}/${self.attr.template}/catalogue/${gid | x}" title="Full metadata details">here</a>.</p> | ||
|