Coverage for src/pyrsslocal/simple_server/html_string.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2023-02-02 02:59 +0100

1""" 

2@file 

3@brief This module contains various string useful when a html page has to be produced. 

4 

5It contains the following variables: 

6 

7@var html_header a HTML header to use this way: 

8 html_header % (title, author, keywords) 

9@var html_footr a HTML footer 

10""" 

11 

12html_header = """ 

13<?xml version="1.0" encoding="utf-8"?> 

14<html> 

15<head> 

16<link href="/js/pyrsslocal.ico" rel="shortcut icon"/> 

17<link href="/js/pMenu.css" rel="stylesheet" type="text/css"/> 

18<link rel="stylesheet" type="text/css" href="/js/prettify.css"/> 

19<title>%s</title> 

20<meta content="%s" name="author"/> 

21<meta content="%s" name="keywords"/> 

22<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> 

23<script src="/js/latexit.js" type="text/javascript"></script> 

24<script src="/js/run_prettify.js" type="text/javascript"></script> 

25<link href="/js/shCore.css" rel="stylesheet" type="text/css" /> 

26<link href="/js/shThemeDefault.css" rel="stylesheet" type="text/css" /> 

27<script src="/js/shCore.js" type="text/javascript"></script> 

28<script src="/js/shAutoloader.js" type="text/javascript"></script> 

29</head> 

30<body> 

31""" 

32 

33html_footer = """ 

34<script type="text/javascript"> 

35SyntaxHighlighter.autoloader( 

36 'js jscript javascript /js/shBrushJScript.js', 

37 'py python /js/shBrushPython.js', 

38 'xml html /js/shBrushXml.js', 

39 'cpp c /js/shBrushCpp.js', 

40 'sql /js/shBrushSql.js', 

41 'php /js/shBrushPhp.js', 

42 'vb vba /js/shBrushVb.js', 

43 'cs /js/shBrushCSharp.js', 

44 'css /js/shBrushCss.js' 

45); 

46SyntaxHighlighter.all(); 

47</script> 

48</body> 

49</html> 

50""" 

51 

52 

53debug_string_script = """ 

54from pandas import DataFrame 

55from pyquickhelper.pandashelper.tblformat import df2html 

56pars = [ { "key":k, "value":v } for k,v in params.items() ] 

57tbl = DataFrame (pars) 

58print ( df2html(tbl, class_table="myclasstable") ) 

59""" 

60 

61html_debug_string_script = """ 

62<b>executing the following script python</b> 

63<br/> 

64<pre class="prettyprint"> 

65%s 

66</pre> 

67<script type="text/python"> 

68%s 

69</script> 

70""" % (debug_string_script, debug_string_script) 

71 

72html_debug_string = "\n".join( 

73 [html_header % ("debug", "xd", ""), html_debug_string_script, html_footer])