Skip to content

Commit

Permalink
Support rendering markup info with sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenedaele committed May 19, 2016
1 parent 3dbc11d commit 1db7b0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pyramid_skosprovider/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def source_adapter(obj, request):
:rtype: :class:`dict`
'''
return {
'citation': obj.citation
'citation': obj.citation,
'markup': obj.markup
}


Expand Down
12 changes: 11 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from skosprovider.skos import (
Concept,
Collection,
Label
Label,
Source
)

import json
Expand Down Expand Up @@ -174,6 +175,15 @@ def test_collection_adapter(self):
assert 0 == len(collection['superordinates'])
assert 0 == len(collection['sources'])

def test_source_adapter(self):
from pyramid_skosprovider.utils import source_adapter
s = Source('<em>My citation</em>', 'HTML')
source = source_adapter(s, Mock())
assert isinstance(source, dict)
assert 'citation' in source
assert 'markup' in source
assert source['markup'] == 'HTML'

def test_json_concept(self):
from pyramid_skosprovider.utils import json_renderer
c = Concept(
Expand Down

0 comments on commit 1db7b0e

Please sign in to comment.