예제 #1
0
파일: main.py 프로젝트: fangang123/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'},
        ),
    })
예제 #2
0
파일: main.py 프로젝트: pombredanne/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'},
        ),
    })
예제 #3
0
파일: main.py 프로젝트: ssin122/test-h
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'
                },
            ]
        })
예제 #4
0
파일: main.py 프로젝트: pombredanne/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'},
        ]
    })
예제 #5
0
파일: main.py 프로젝트: fangang123/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'},
        ]
    })
예제 #6
0
파일: main.py 프로젝트: 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"},
            ]
        },
    )
예제 #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'},
        ]
    })
예제 #8
0
파일: main.py 프로젝트: 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"},),
        },
    )