diff options
-rwxr-xr-x | cgi-bin/ordered-list.cgi | 59 |
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() |