Beispiel #1
0
def getStyleBibliography(biblioList):
    import rython
    ctx = rython.RubyContext(requires=["rubygems", "anystyle/parser"])
    ctx("Encoding.default_internal = 'UTF-8'")
    ctx("Encoding.default_external = 'UTF-8'")
    anystyle = ctx("Anystyle.parser")
    anyStyleList = []
    h = HTMLParser.HTMLParser()
    for biblio in biblioList:
        parsed = anystyle.parse(h.unescape(biblio).encode('utf-8'))
        anyStyleList.append(parsed)
    return anyStyleList
Beispiel #2
0
import rython
from pyramid.response import Response
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPNotFound, HTTPFound

from sqlalchemy.exc import DBAPIError

from .models import *

# parser setup
ctx = rython.RubyContext(requires=["rubygems", "anystyle/parser"])
parser = ctx("Anystyle.parser")

## SITE VIEWS ##


@view_config(route_name='home', renderer='templates/index.mako')
def home(request):
    return {'ok': 'ok'}


@view_config(route_name='login', renderer='templates/login.mako')
def login(request):
    return {'ok': 'ok'}


## CITATION API VIEWS ##


@view_config(route_name='citation_update', request_method='PUT')
def citation_update(request):
Beispiel #3
0
def init_gkv():
    ctx = rython.RubyContext(requires=["rubygems", "gkv"])
    db = ctx("Gkv::Database.new")
    return db
Beispiel #4
0
def init_ctx():
    global ctx
    if not ctx:
        ctx = rython.RubyContext(requires=['erb'], debug=True)
        ctx.load()
Beispiel #5
0
def get_ctx():
    ctx = rython.RubyContext(requires=['erb'], debug=True)
    ctx.load()
    return ctx