Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Creating HTML from SMCL log file including graphics - revised log2html.ado


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Creating HTML from SMCL log file including graphics - revised log2html.ado
Date   Fri, 19 May 2006 12:05:12 +0100

David Elliott wrote:

1) The restriction to only png is that, if this is going to be rendered
as HTML, this is the only bitmap file format that can be displayed on
all the browsers I tested.

A fair point. Some people may prefer another format, provided it renders
on their own browser.

2) If you examine the output from the following 4 -graph export-
commands you will see that the extension is not included when you use
the [,as(png)] argument: <snip>

True, but the file produced does not have an extension, so adding one in
the <img> tag will not help.

3) Ideally, one would have paths relative to the directory in which the
html log was written.  Unfortunately STATA's string handling functions
don't include drive|path|filename|extension aware functions like
JUSTDRIVE( ) | JUSTEXT( ) | JUSTFNAME( ) | JUSTSTEM( ) that would allow
parsing the various file locations and their relationships relative to
each other.  For ease of coding and possibility of moving the htmllog
and images to a different directory in the future, I believe they should
be in the same directory.  If you hard code the directories, moving the
files will break the links.  For Internet Explorer, a reference to
src="c:\web\test.png" will work, but in Gecko-based browsers like
Netscape|Firefox, it will fail.

Fair point- I was thinking that assuming the html log is going in my
working directory I may want to code, e.g. -graph export
images\fig1.png- and have the relative location picked up.

4) I am aware on the inability to include multiple word filenames.  As a
general rule, it is inadvisable to have space-separated filenames in web
addresses.  I could pick up the entire filename, or parse back to the
preceding '\' or '/' but it is harder than it looks.  I am unable to
find the index(...) function to which you refer although there is an
indexnot(...) function referenced under -help string_functions-

I agree that the filename itself is best not to have spaces, but there
is no reason why the path (which is being stripped off anyway) should
not. Either way, it would be better to make the code exit with an error
or do nothing at all if a space-separated name is encountered, rather
than substituting a link to a non-existent file. The command -index()-
was renamed -strpos()- in version 9, I used -index()- as the program has
the version set to 8.

5) Any suggestions as to what verbatim options you would want,
remembering that it would be applied to all images?  The <img> tag
doesn't have a lot of attributes.  While good coding practice would have
the height and width explicitly specified, this only really helps when
rendering complex designs since the layout engine is able to know the
dimensions of images before they have fully downloaded.  You have the
dimensions only if explicitly specified with the height(600)
width(800) arguments.

The options do not need to be specified. If you add, say, -gropts(str)-
in the syntax and then -`gropts'- inside the <img> tag, I can pass any
options I like to all the graphs when I create the html file.

David

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index