lipengyu / strategico

Automatically exported from code.google.com/p/strategico
GNU General Public License v3.0
0 stars 0 forks source link

function ltp.HTMLreport is too big: should be splitted in more than one function #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The function is too big and not easily readable. It is better
 * to split it into more than one functions: one function for each statistical model (that creates charts and returns the html text related to the model)?
 * to keep the HTML template separated from the generation of charts and paragraphs/tables/results 

Original issue reported on code.google.com by matteo.redaelli on 26 Dec 2010 at 8:53

GoogleCodeExporter commented 9 years ago

and a file template like 

<html> 
<head> 
  <title>__TITLE__</title> 
</html> 
<body> 
 <h1>__TITLE__</h1> 
 <h2>Charts</h2> 
 <h3>Best Model</h3> 
  <img src="ltp_bestfit.png" /> 
 <h3>All Models </h3> 
 <img src="ltp_all.png" /> 
 <h2>Summary</h3> 
  __SUMMARY__
  __DETAILED_SUMMARY_MODELS__
  <hr />
  <a href=/strategico/help/ltp/>Quick Help</a>
</body>
</html>

and then create some functions that return the strings related to SUMMARY, 
DETAILED_SUMMARY_MODELS...

  template = "<html><head><title>__TITLE__</title></head><body><h1>__TITLE__</h1></body></html>" 
  gsub("__TITLE__", "My Title", template)

Original comment by matteo.redaelli on 7 Jan 2011 at 10:40