コード例 #1
0
ファイル: sep.py プロジェクト: we1l1n/inpho
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
コード例 #2
0
ファイル: views.py プロジェクト: inpho-sep/pubssite
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):
コード例 #3
0
ファイル: pygkv.py プロジェクト: gitter-badger/pyGKV
def init_gkv():
    ctx = rython.RubyContext(requires=["rubygems", "gkv"])
    db = ctx("Gkv::Database.new")
    return db
コード例 #4
0
def init_ctx():
    global ctx
    if not ctx:
        ctx = rython.RubyContext(requires=['erb'], debug=True)
        ctx.load()
コード例 #5
0
ファイル: parse_erb.py プロジェクト: yuzawataka/colony
def get_ctx():
    ctx = rython.RubyContext(requires=['erb'], debug=True)
    ctx.load()
    return ctx