Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added markdown format processing of comment fields #1075

Merged
merged 2 commits into from Apr 11, 2016
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

22 api.py
@@ -495,7 +495,7 @@ def GetComment(node, layers='core') :
"""Get the first rdfs:comment we find on this node (or "No comment"), within any of the specified layers."""
tx = GetComments(node, layers)
if len(tx) > 0:
return tx[0]
return MD.parse(tx[0])
else:
return "No comment"

@@ -943,3 +943,23 @@ def ShortenOnSentence(source,lengthHint=250):
com += ".."
source = com
return source

class MarkdownTool():
def __init__ (self):
import markdown
from markdown.extensions.wikilinks import WikiLinkExtension
self._md = markdown.Markdown(extensions=[WikiLinkExtension(base_url='/', end_url='', html_class='localLink')])

def parse(self,source,preservePara=False):
if not source or len(source) == 0:
return ""
source = source.replace("\\n","\n")
ret = self._md.reset().convert(source)
if not preservePara:
#Remove wrapping <p> </p> that Markdown adds by default
if len(ret) > 7 and ret.startswith("<p>") and ret.endswith("</p>"):
ret = ret[3:len(ret)-4]
return ret

MD = MarkdownTool()

@@ -0,0 +1,6 @@
"""`appengine_config` gets loaded when starting a new application instance."""
import vendor
# insert `lib` as a site directory so our `main` module can load
# third-party libraries, and override built-ins with newer
# versions.
vendor.add('lib')
@@ -17,9 +17,9 @@
</head>
<body>
<div resource="http://bib.schema.org/">
<span property="rdfs:comment">You are viewing the Bibliographic Extension within &lt;a href="http://schema.org/"&gt;schema.org&lt;/a&gt;.
It defines terms such as &lt;a href="/Audiobook"&gt;Audiobook&lt;/a&gt;, &lt;a href="/Thesis"&gt;Thesis&lt;/a&gt;, &lt;a href="/ComicStory"&gt;ComicStory&lt;/a&gt;, and &lt;a href="/workTranslation"&gt;workTranslation&lt;/a&gt;.
For more details see the W3C BibExtend Community Group's &lt;a href="http://www.w3.org/community/schemabibex/wiki/Bib.schema.org-1.0"&gt;wiki&lt;/a&gt;.</span>
<span property="rdfs:comment">You are viewing the Bibliographic Extension within [schema.org](http://schema.org).
It defines terms such as [[Audiobook]], [[Thesis]], [[ComicStory]], and [[workTranslation]].
For more details see the W3C BibExtend Community Group's [wiki](http://www.w3.org/community/schemabibex/wiki/Bib.schema.org-1.0).</span>
<span property="schema:name">Bibliographic Extension</span>
<span property="schema:softwareVersion">1.0</span>
</div>
@@ -6,7 +6,7 @@
"@id": "http://meta.schema.org",
"schema:name": "Meta Extension",
"schema:softwareVersion": "1.0",
"rdfs:comment": "The meta extension contains terms primarily designed to support the implementation of the Schema.org vocabulary itself. It includes terms such as Class, Property, domainIncludes and supersededBy. \nThey are not currently advocateded for widespread use across the web.",
"rdfs:comment": "The meta extension contains terms primarily designed to support the implementation of the Schema.org vocabulary itself. It includes terms such as [[Class]], [[Property]], [[domainIncludes]] and [[supersededBy]]. They are not currently advocateded for widespread use across the web.",
"@graph": [
{
"@id": "http://schema.org/Class",
@@ -2993,7 +2993,7 @@

<div typeof="rdfs:Class" resource="http://schema.org/CheckInAction">
<span class="h" property="rdfs:label">CheckInAction</span>
<span property="rdfs:comment">The act of an agent communicating (service provider, social media, etc) their arrival by registering/confirming for a previously reserved service (e.g. flight check in) or at a place (e.g. hotel), possibly resulting in a result (boarding pass, etc).&lt;p&gt;Related actions:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://schema.org/CheckOutAction&quot;&gt;CheckOutAction&lt;/a&gt;: The antonym of CheckInAction.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://schema.org/ArriveAction&quot;&gt;ArriveAction&lt;/a&gt;: Unlike ArriveAction, CheckInAction implies that the agent is informing/confirming the start of a previously reserved service.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://schema.org/ConfirmAction&quot;&gt;ConfirmAction&lt;/a&gt;: Unlike ConfirmAction, CheckInAction implies that the agent is informing/confirming the *start* of a previously reserved service rather than its validity/existence&lt;/li&gt;&lt;/ul&gt;.</span>
<span property="rdfs:comment">The act of an agent communicating (service provider, social media, etc) their arrival by registering/confirming for a previously reserved service (e.g. flight check in) or at a place (e.g. hotel), possibly resulting in a result (boarding pass, etc).\n\nRelated actions:\n\n* [[CheckOutAction]]: The antonym of CheckInAction.\n* [[ArriveAction]]: Unlike ArriveAction, CheckInAction implies that the agent is informing/confirming the start of a previously reserved service.\n* [[ConfirmAction]]: Unlike ConfirmAction, CheckInAction implies that the agent is informing/confirming the *start* of a previously reserved service rather than its validity/existence.</span>
<span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/CommunicateAction">CommunicateAction</a></span>
</div>

<div typeof="rdf:Property" resource="http://schema.org/sponsor">
<span class="h" property="rdfs:label">sponsor</span>
<span property="rdfs:comment">A person or organization that supports a thing through a pledge, promise, or financial contribution. e.g. a sponsor of a Medical Study or a corporate sponsor of an event.</span>
<!-- <span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/MedicalStudy">MedicalStudy</a></span> moved to extension -->
<!-- <span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/MedicalStudy">MedicalStudy</a></span> moved to extension -->
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/Person">Person</a></span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/Organization">Organization</a></span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/Event">Event</a></span>

<div typeof="http://schema.org/Organization" resource="http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex">
<span property="rdfs:label">BibExTerm</span>
<span property="rdfs:comment">The W3C &lt;a href="http://www.w3.org/community/schemabibex/"&gt;Schema Bib Extend&lt;/a&gt; (BibEx) group led the work to improve schema.org for bibliographic information, including terms for periodicals, articles and multi-volume works. The design was inspired in places (e.g. pageStart, pageEnd, pagination) by the &lt;a href="http://bibliontology.com/"&gt;Bibliographic Ontology&lt;/a&gt;, 'bibo'.</span>
<span property="rdfs:comment">The W3C [Schema Bib Extend](http://www.w3.org/community/schemabibex/) (BibEx) group led the work to improve schema.org for bibliographic information, including terms for periodicals, articles and multi-volume works. The design was inspired in places (e.g. [[pageStart]], [[pageEnd]], [[pagination]]) by the [Bibliographic Ontology](http://bibliontology.com/), 'bibo'.</span>
</div>

<div typeof="http://schema.org/Organization" resource="http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#Automotive_Ontology_Working_Group">
<span property="rdfs:label">AutomotiveOntologyWGClass</span>
<span property="rdfs:comment">This element is based on the work of the Automotive Ontology Working Group, see &lt;a href=&quot;http://www.automotive-ontology.org&quot;&gt;http://www.automotive-ontology.org&lt;/a&gt; for details. Many class and property definitions are inspired by or based on abstracts from Wikipedia, the free encyclopedia.</span>
<span property="rdfs:comment">This element is based on the work of the Automotive Ontology Working Group, see [www.automotive-ontology.org](http://www.automotive-ontology.org) for details. Many class and property definitions are inspired by or based on abstracts from Wikipedia, the free encyclopedia.</span>
</div>
<hr />


<div typeof="rdfs:Class" resource="http://schema.org/Periodical">
<span class="h" property="rdfs:label">Periodical</span>
<span property="rdfs:comment">A publication in any medium issued in successive parts bearing numerical or chronological designations and intended, such as a magazine, scholarly journal, or newspaper to continue indefinitely.

&lt;br/&gt;&lt;br/&gt;See also &lt;a href="http://blog.schema.org/2014/09/schemaorg-support-for-bibliographic_2.html"&gt;blog post&lt;/a&gt;.</span>
<span property="rdfs:comment">A publication in any medium issued in successive parts bearing numerical or chronological designations and intended, such as a magazine, scholarly journal, or newspaper to continue indefinitely.\n\nSee also [blog post](http://blog.schema.org/2014/09/schemaorg-support-for-bibliographic_2.html).</span>
<span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/CreativeWorkSeries">CreativeWorkSeries</a></span>
<link property="owl:equivalentClass" href="http://purl.org/ontology/bibo/Periodical"/>
<span>Source: <a property="dc:source" href="http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_bibex">BibEx</a></span>
@@ -0,0 +1,47 @@
Metadata-Version: 1.1
Name: Markdown
Version: 2.6.6
Summary: Python implementation of Markdown.
Home-page: https://pythonhosted.org/Markdown/
Author: Waylan Limberg
Author-email: waylan.limberg [at] icloud.com
License: BSD License
Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-2.6.6.tar.gz
Description:
This is a Python implementation of John Gruber's Markdown_.
It is almost completely compliant with the reference implementation,
though there are a few known issues. See Features_ for information
on what exactly is supported and what is not. Additional features are
supported by the `Available Extensions`_.

.. _Markdown: http://daringfireball.net/projects/markdown/
.. _Features: https://pythonhosted.org/Markdown/index.html#Features
.. _`Available Extensions`: https://pythonhosted.org/Markdown/extensions/index.html

Support
=======

You may ask for help and discuss various other issues on the
`mailing list`_ and report bugs on the `bug tracker`_.

.. _`mailing list`: http://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
.. _`bug tracker`: http://github.com/waylan/Python-Markdown/issues

Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Communications :: Email :: Filters
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Text Processing :: Markup :: HTML
@@ -0,0 +1,36 @@
setup.cfg
Markdown.egg-info/PKG-INFO
Markdown.egg-info/SOURCES.txt
Markdown.egg-info/dependency_links.txt
Markdown.egg-info/top_level.txt
bin/markdown_py
markdown/__init__.py
markdown/__main__.py
markdown/__version__.py
markdown/blockparser.py
markdown/blockprocessors.py
markdown/inlinepatterns.py
markdown/odict.py
markdown/postprocessors.py
markdown/preprocessors.py
markdown/serializers.py
markdown/treeprocessors.py
markdown/util.py
markdown/extensions/__init__.py
markdown/extensions/abbr.py
markdown/extensions/admonition.py
markdown/extensions/attr_list.py
markdown/extensions/codehilite.py
markdown/extensions/def_list.py
markdown/extensions/extra.py
markdown/extensions/fenced_code.py
markdown/extensions/footnotes.py
markdown/extensions/headerid.py
markdown/extensions/meta.py
markdown/extensions/nl2br.py
markdown/extensions/sane_lists.py
markdown/extensions/smart_strong.py
markdown/extensions/smarty.py
markdown/extensions/tables.py
markdown/extensions/toc.py
markdown/extensions/wikilinks.py
@@ -0,0 +1,66 @@
../markdown/__init__.py
../markdown/__main__.py
../markdown/__version__.py
../markdown/blockparser.py
../markdown/blockprocessors.py
../markdown/inlinepatterns.py
../markdown/odict.py
../markdown/postprocessors.py
../markdown/preprocessors.py
../markdown/serializers.py
../markdown/treeprocessors.py
../markdown/util.py
../markdown/extensions/__init__.py
../markdown/extensions/abbr.py
../markdown/extensions/admonition.py
../markdown/extensions/attr_list.py
../markdown/extensions/codehilite.py
../markdown/extensions/def_list.py
../markdown/extensions/extra.py
../markdown/extensions/fenced_code.py
../markdown/extensions/footnotes.py
../markdown/extensions/headerid.py
../markdown/extensions/meta.py
../markdown/extensions/nl2br.py
../markdown/extensions/sane_lists.py
../markdown/extensions/smart_strong.py
../markdown/extensions/smarty.py
../markdown/extensions/tables.py
../markdown/extensions/toc.py
../markdown/extensions/wikilinks.py
../markdown/__init__.pyc
../markdown/__main__.pyc
../markdown/__version__.pyc
../markdown/blockparser.pyc
../markdown/blockprocessors.pyc
../markdown/inlinepatterns.pyc
../markdown/odict.pyc
../markdown/postprocessors.pyc
../markdown/preprocessors.pyc
../markdown/serializers.pyc
../markdown/treeprocessors.pyc
../markdown/util.pyc
../markdown/extensions/__init__.pyc
../markdown/extensions/abbr.pyc
../markdown/extensions/admonition.pyc
../markdown/extensions/attr_list.pyc
../markdown/extensions/codehilite.pyc
../markdown/extensions/def_list.pyc
../markdown/extensions/extra.pyc
../markdown/extensions/fenced_code.pyc
../markdown/extensions/footnotes.pyc
../markdown/extensions/headerid.pyc
../markdown/extensions/meta.pyc
../markdown/extensions/nl2br.pyc
../markdown/extensions/sane_lists.pyc
../markdown/extensions/smart_strong.pyc
../markdown/extensions/smarty.pyc
../markdown/extensions/tables.pyc
../markdown/extensions/toc.pyc
../markdown/extensions/wikilinks.pyc
.
dependency_links.txt
PKG-INFO
SOURCES.txt
top_level.txt
../../../bin/markdown_py
@@ -0,0 +1 @@
markdown
ProTip! Use n and p to navigate between commits in a pull request.