Commit d786060307f9f289f8e2cba8f233cb341ae0e063
- Diff rendering mode:
- inline
- side by side
server.py
(11 / 11)
  | |||
1 | 1 | from flask import Flask | |
2 | 2 | from flask import request | |
3 | from flask import render_template | ||
3 | from flask import render_template, url_for | ||
4 | 4 | from flask import make_response | |
5 | 5 | from flask import jsonify | |
6 | 6 | import logging | |
… | … | ||
143 | 143 | root = lxml.html.parse(StringIO.StringIO(page)).getroot() | |
144 | 144 | root.make_links_absolute(request.args['url'], resolve_base_href = True) | |
145 | 145 | # Log -- comment them | |
146 | print "Page parsed.. Preparing to send.." | ||
146 | #print "Page parsed.. Preparing to send.." | ||
147 | 147 | ||
148 | 148 | # inject the JS toolbar to annotate text | |
149 | 149 | jq = root.makeelement('script') | |
150 | jq.set('src', '/static/jquery-1.9.1.min.js') | ||
150 | jq.set('src', url_for('static', filename='jquery-1.9.1.min.js')) | ||
151 | 151 | ||
152 | 152 | script = root.makeelement('script') | |
153 | script.set('src', '/static/text-annotation.js') | ||
153 | script.set('src', url_for('static', filename='text-annotation.js')) | ||
154 | 154 | ||
155 | 155 | tree = root.makeelement('script') | |
156 | tree.set('src', '/static/tree.js') | ||
156 | tree.set('src', url_for('static', filename='tree.js')) | ||
157 | 157 | ||
158 | 158 | bs_js = root.makeelement('script') | |
159 | bs_js.set('src', '/static/bootstrap.js') | ||
159 | bs_js.set('src', url_for('static', filename='bootstrap.js')) | ||
160 | 160 | ||
161 | 161 | jit = root.makeelement('script') | |
162 | jit.set('src', '/static/jit.js') | ||
162 | jit.set('src', url_for('static', filename='jit.js')) | ||
163 | 163 | ||
164 | 164 | us = root.makeelement('script') | |
165 | us.set('src', '/static/underscore-min-1.4.4.js') | ||
165 | us.set('src', url_for('static', filename='underscore-min-1.4.4.js')) | ||
166 | 166 | ||
167 | 167 | link = root.makeelement('link') | |
168 | link.set('href', '/static/text-annotation.css') | ||
168 | link.set('href', url_for('static', filename='text-annotation.css')) | ||
169 | 169 | link.set('type', 'text/css') | |
170 | 170 | link.set('rel', 'stylesheet') | |
171 | 171 | ||
172 | 172 | bs = root.makeelement('link') | |
173 | bs.set('href', '/static/bootstrap.css') | ||
173 | bs.set('href', url_for('static', filename='bootstrap.css')) | ||
174 | 174 | bs.set('type', 'text/css') | |
175 | 175 | bs.set('rel', 'stylesheet') | |
176 | 176 | ||
177 | 177 | tree_css = root.makeelement('link') | |
178 | tree_css.set('href', '/static/tree.css') | ||
178 | tree_css.set('href', url_for('static', filename='tree.css')) | ||
179 | 179 | tree_css.set('type', 'text/css') | |
180 | 180 | tree_css.set('rel', 'stylesheet') | |
181 | 181 |
templates/web.html
(3 / 3)
  | |||
4 | 4 | <meta charset="utf-8"> | |
5 | 5 | <meta http-equiv='imagetoolbar' content='no'/> | |
6 | 6 | <title> Web Annotation </title> | |
7 | <link rel="stylesheet" type="text/css" href="/static/bootstrap.css"></link> | ||
8 | <script type="text/javascript" src="/static/jquery-1.9.1.min.js"></script> | ||
9 | <script type="text/javascript" src="/static/bootstrap.js"></script> | ||
7 | <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='bootstrap.css') }}"></link> | ||
8 | <script type="text/javascript" src="{{ url_for('static', filename='jquery-1.9.1.min.js') }}"></script> | ||
9 | <script type="text/javascript" src"{{ url_for('static', filename='bootstrap.js') }}"></script> | ||
10 | 10 | <style type="text/css"> | |
11 | 11 | .container { | |
12 | 12 | margin-top: 30px; |