Beispiel #1
0
def annotation_page(annotation, request):
    document = annotation.document
    if document and document.title:
        title = 'Annotation by {user} on {title}'.format(
            user=annotation.userid.replace('acct:', ''),
            title=document.title)
    else:
        title = 'Annotation by {user}'.format(
            user=annotation.userid.replace('acct:', ''))

    alternate = request.route_url('api.annotation', id=annotation.id)

    return render_app(request, {
        'meta_attrs': (
            {'property': 'og:title', 'content': title},
            {'property': 'og:description', 'content': ''},
            {'property': 'og:image', 'content': '/assets/images/logo.png'},
            {'property': 'og:site_name', 'content': 'Hypothes.is'},
            {'property': 'og:url', 'content': request.url},
        ),
        'link_attrs': (
            {'rel': 'alternate', 'href': alternate,
                'type': 'application/json'},
        ),
    })
Beispiel #2
0
def annotation_page(annotation, request):
    document = annotation.document
    if document and document.title:
        title = 'Annotation by {user} on {title}'.format(
            user=annotation.userid.replace('acct:', ''),
            title=document.title)
    else:
        title = 'Annotation by {user}'.format(
            user=annotation.userid.replace('acct:', ''))

    alternate = request.route_url('api.annotation', id=annotation.id)

    return render_app(request, {
        'meta_attrs': (
            {'property': 'og:title', 'content': title},
            {'property': 'og:description', 'content': ''},
            {'property': 'og:image', 'content': '/assets/images/logo.png'},
            {'property': 'og:site_name', 'content': 'Hypothes.is'},
            {'property': 'og:url', 'content': request.url},
        ),
        'link_attrs': (
            {'rel': 'alternate', 'href': alternate,
                'type': 'application/json'},
        ),
    })
Beispiel #3
0
def stream(context, request):
    q = request.params.get('q', '').split(':', 1)
    if len(q) >= 2 and q[0] == 'tag':
        tag = q[1]
        if ' ' in tag:
            tag = '"' + tag + '"'
        query = {'q': 'tag:{}'.format(tag)}
        location = request.route_url('activity.search', _query=query)
        raise httpexceptions.HTTPFound(location=location)
    atom = request.route_url('stream_atom')
    rss = request.route_url('stream_rss')
    return render_app(
        request, {
            'link_tags': [
                {
                    'rel': 'alternate',
                    'href': atom,
                    'type': 'application/atom+xml'
                },
                {
                    'rel': 'alternate',
                    'href': rss,
                    'type': 'application/rss+xml'
                },
            ]
        })
Beispiel #4
0
def stream(context, request):
    atom = request.route_url('stream_atom')
    rss = request.route_url('stream_rss')
    return render_app(request, {
        'link_tags': [
            {'rel': 'alternate', 'href': atom, 'type': 'application/atom+xml'},
            {'rel': 'alternate', 'href': rss, 'type': 'application/rss+xml'},
        ]
    })
Beispiel #5
0
def stream(context, request):
    atom = request.route_url('stream_atom')
    rss = request.route_url('stream_rss')
    return render_app(request, {
        'link_tags': [
            {'rel': 'alternate', 'href': atom, 'type': 'application/atom+xml'},
            {'rel': 'alternate', 'href': rss, 'type': 'application/rss+xml'},
        ]
    })
Beispiel #6
0
Datei: main.py Projekt: nlisgo/h
def stream(context, request):
    atom = request.route_url("stream_atom")
    rss = request.route_url("stream_rss")
    return render_app(
        request,
        {
            "link_tags": [
                {"rel": "alternate", "href": atom, "type": "application/atom+xml"},
                {"rel": "alternate", "href": rss, "type": "application/rss+xml"},
            ]
        },
    )
Beispiel #7
0
def stream(context, request):
    q = request.params.get('q', '').split(':', 1)
    if len(q) >= 2 and q[0] == 'tag':
        tag = q[1]
        if ' ' in tag:
            tag = '"' + tag + '"'
        query = {'q': 'tag:{}'.format(tag)}
        location = request.route_url('activity.search', _query=query)
        raise httpexceptions.HTTPFound(location=location)
    atom = request.route_url('stream_atom')
    rss = request.route_url('stream_rss')
    return render_app(request, {
        'link_tags': [
            {'rel': 'alternate', 'href': atom, 'type': 'application/atom+xml'},
            {'rel': 'alternate', 'href': rss, 'type': 'application/rss+xml'},
        ]
    })
Beispiel #8
0
Datei: main.py Projekt: nlisgo/h
def annotation_page(annotation, request):
    document = annotation.document
    if document and document.title:
        title = "Annotation by {user} on {title}".format(
            user=annotation.userid.replace("acct:", ""), title=document.title
        )
    else:
        title = "Annotation by {user}".format(user=annotation.userid.replace("acct:", ""))

    alternate = request.route_url("api.annotation", id=annotation.id)

    return render_app(
        request,
        {
            "meta_attrs": (
                {"property": "og:title", "content": title},
                {"property": "og:description", "content": ""},
                {"property": "og:image", "content": "/assets/images/logo.png"},
                {"property": "og:site_name", "content": "Hypothes.is"},
                {"property": "og:url", "content": request.url},
            ),
            "link_attrs": ({"rel": "alternate", "href": alternate, "type": "application/json"},),
        },
    )