summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2021-01-31 17:27:46 +0000
committerVincent Sanders <vince@kyllikki.org>2021-01-31 17:28:15 +0000
commit7b2cf96741b2ae2f9426f26ee9d05ed60da57911 (patch)
treee57fed410326aa153a6dd2b594d44c90b3ee8aa5
parent0db0abac48773ee2fb250aad99e6a215e05c3bd7 (diff)
downloadnetsurf-test-7b2cf96741b2ae2f9426f26ee9d05ed60da57911.tar.gz
netsurf-test-7b2cf96741b2ae2f9426f26ee9d05ed60da57911.tar.bz2
add ordered list generator cgi
-rwxr-xr-xcgi-bin/ordered-list.cgi59
1 files changed, 59 insertions, 0 deletions
diff --git a/cgi-bin/ordered-list.cgi b/cgi-bin/ordered-list.cgi
new file mode 100755
index 0000000..2096d0e
--- /dev/null
+++ b/cgi-bin/ordered-list.cgi
@@ -0,0 +1,59 @@
+#!/usr/bin/python3
+
+'''
+NetSurf test ordered list generator
+
+The liststyle form parameter may be given to select different list style types.
+'''
+
+import os
+import re
+import cgi
+import cgitb
+
+cgitb.enable()
+
+def main():
+ '''
+ The test plan generator
+ '''
+ docroot = os.environ["DOCUMENT_ROOT"]
+
+ testroot = os.path.join(docroot, "monkey-test")
+
+ params = cgi.FieldStorage()
+
+ liststyle = 'decimal'
+ listcount = 1000
+
+ if 'liststyle' in params and re.match('^[A-Za-z0-9-]+$', params['liststyle'].value):
+ liststyle = params['liststyle'].value
+
+ if 'listcount' in params and re.match('^[0-9]+$', params['listcount'].value):
+ listcount = num(params['listcount'].value)
+
+ if listcount > 10000:
+ listcount = 10000
+
+ print('Content-Type: text/html')
+ print('')
+
+ print('<!DOCTYPE html>')
+ print('<html>')
+ print('<head>')
+ print('<style>')
+ print('ol.a {list-style-type:',liststyle,';}')
+ print('</style>')
+ print('</head>')
+ print('<body>')
+ print('<h1>ordered list marker test with',liststyle,'style</h1>')
+ print('<ol class="a">')
+ for num in range(1, listcount):
+ print('<li>',num,'</li>', sep="")
+
+ print('</ol>')
+ print('</body>')
+ print('</html>')
+
+if __name__ == "__main__":
+ main()