python-stdnum branch master updated. 1.6-8-gbd0c7c7
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.6-8-gbd0c7c7
- From: Commits of the python-stdnum project <python-stdnum-commits [at] lists.arthurdejong.org>
- To: python-stdnum-commits [at] lists.arthurdejong.org
- Reply-to: python-stdnum-users [at] lists.arthurdejong.org
- Subject: python-stdnum branch master updated. 1.6-8-gbd0c7c7
- Date: Tue, 11 Jul 2017 22:48:05 +0200 (CEST)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".
The branch, master has been updated
via bd0c7c7b3699f2481da0ba8b69204c30396e1f57 (commit)
from 81446fd2d42190cd35f5055f9e7792ee432ec602 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=bd0c7c7b3699f2481da0ba8b69204c30396e1f57
commit bd0c7c7b3699f2481da0ba8b69204c30396e1f57
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Tue Jul 11 22:17:59 2017 +0200
Include search term in online form
This also makes the Javascript regular expression used for highlighting
links the same as the Python equivalent.
diff --git a/online_check/check.js b/online_check/check.js
index 9c5025d..28528f6 100644
--- a/online_check/check.js
+++ b/online_check/check.js
@@ -27,7 +27,7 @@ $( document ).ready(function() {
).replace(
/^[*] (.*)$/gm, "<ul><li>$1</li></ul>"
).replace(
- /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
+ /(\b(https?|ftp):\/\/[^\s<]*[-\w+&@#/%=~_|])/ig,
"<a href='$1'>$1</a>"
)
}
diff --git a/online_check/stdnum.wsgi b/online_check/stdnum.wsgi
index 729f3eb..a69d167 100755
--- a/online_check/stdnum.wsgi
+++ b/online_check/stdnum.wsgi
@@ -94,6 +94,7 @@ def application(environ, start_response):
'HTTP_X_REQUESTED_WITH', '').lower() == 'xmlhttprequest'
parameters = cgi.parse_qs(environ.get('QUERY_STRING', ''))
results = []
+ number = ''
if 'number' in parameters:
number = parameters['number'][0]
results = [
@@ -104,4 +105,6 @@ def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'application/json')])
return [json.dumps(results, indent=2, sort_keys=True)]
start_response('200 OK', [('Content-Type', 'text/html')])
- return _template % '\n'.join(format(data) for data in results)
+ return _template % dict(
+ value=cgi.escape(number),
+ results='\n'.join(format(data) for data in results))
diff --git a/online_check/template.html b/online_check/template.html
index fac5cf5..63cd9ea 100644
--- a/online_check/template.html
+++ b/online_check/template.html
@@ -15,9 +15,9 @@
which it is valid.
</p>
<form>
- <input id="number" name="number" type="text" value="" class="stdnum_check"
placeholder="Enter number here">
+ <input id="number" name="number" type="text" value="%(value)s"
class="stdnum_check" placeholder="Enter number here">
<input type="submit" value="Check" class="stdnum_hide">
</form>
- <div id="number_results"><ul>%s</ul></div>
+ <div id="number_results"><ul>%(results)s</ul></div>
</body>
</html>
-----------------------------------------------------------------------
Summary of changes:
online_check/check.js | 2 +-
online_check/stdnum.wsgi | 5 ++++-
online_check/template.html | 4 ++--
3 files changed, 7 insertions(+), 4 deletions(-)
hooks/post-receive
--
python-stdnum
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-commits/
- python-stdnum branch master updated. 1.6-8-gbd0c7c7,
Commits of the python-stdnum project