- FC6B0036D74F0369666FCBE199CDA20733E2B5F384C4653CE6EEBC294C61AB14AD70DE596F34979EC91896E1A4D298153628F13BA430D8190D6360F0102FDE39+ 96D91F8B483D435147D82A364AB5D03F1154316AA1DA1A05A0B4333B3E88081FE92A0747FB0923813FFBDB4D9FB4239E4247F792BEDE52DCACDD83F42E439179logotron/reader.py(243 . 7)(243 . 9)
59
60
61 # Regexps used in format_logline:
62 boxlinks_re = re.compile('\[\s*<a href="(http[^ \[\]]+)">[^ <]+</a>\s*\]\[([^\[\]]+)\]')
63 boxlinks_re = re.compile(
64 '\[\s*<a href="(http[^ \[\]]+)"[^>]*>[^ <]+</a>\s*\]\[([^\[\]]+)\]')
65
66 stdlinks_re = re.compile('(http[^ \[\]]+)')
67
68
(252 . 10)(254 . 12)
70 payload = html_escape(l['payload'])
71
72 # Format ordinary links:
73 payload = re.sub(stdlinks_re, r'<a href="\1">\1</a>', payload)
74 payload = re.sub(stdlinks_re,
75 r'<a href="\1" target=\'_blank\'>\1</a>', payload)
76
77 # Now also format [link][text] links :
78 payload = re.sub(boxlinks_re, r'<a href="\1">\2</a>', payload)
79 payload = re.sub(boxlinks_re,
80 r'<a href="\1" target=\'_blank\'>\2</a>', payload)
81
82 # If this is a search result, illuminate the matched strings:
83 if highlights != []:
(309 . 12)(313 . 29)
85 chan,
86 next_day_txt)
87
88 # s += """<span><a href="{0}log/{1}?rev=1">Reverse</a></span>""".format(
89 # get_base(), chan)
90
91 return s
92
93 # Make above callable from inside htm templater:
94 app.jinja_env.globals.update(generate_navbar=generate_navbar)
95
96
97 @app.route('/rnd/<chan>')
98 def rnd(chan):
99 # Handle rubbish chan:
100 if chan not in Channels:
101 return redirect(url_for('log'))
102
103 rnd_line = query_db(
104 '''select * from loglines where chan=%s
105 order by random() limit 1 ;''',
106 [chan], one=True)
107
108 return redirect(line_url(rnd_line))
109
110
111 @app.route('/log/<chan>/<date>')
112 @app.route('/log/<chan>', defaults={'date': None})
113 @app.route('/log/', defaults={'chan': Default_Chan, 'date': None})
(327 . 6)(348 . 9)
115 # Get possible selection start and end
116 sel_start = request.args.get('ss', default = 0, type = int)
117 sel_end = request.args.get('se', default = 0, type = int)
118
119 # Get possible 'reverse gear'
120 rev = request.args.get('rev', default = 0, type = int)
121
122 # Get current time
123 now = datetime.now()
(358 . 13)(382 . 18)
125 and t between %s and %s order by idx asc;''',
126 [chan, day_start, day_end], one=False)
127
128 # Optional 'reverse gear' knob:
129 if rev == 1:
130 lines.reverse()
131
132 # Return the HTMLized text
133 return render_template('log.html',
134 chan = chan,
135 loglines = lines,
136 sel = (sel_start, sel_end),
137 date = date,
138 tail = tail)
139 tail = tail,
140 rev = not rev)
141
142
143 @app.route('/log-raw/<chan>')