Re: configuration and namespaces

Derek Robert Price <[email protected]> Mon, 23 Jun 2003 13:11:33 -0400
Newsgroups gmane.comp.tex.texi2html.devel
Organization Ximbiot <http://ximbiot.com>
Message-ID <[email protected]>
Dumas Patrice wrote:

>Hi,
>
>It seems to me that we are about to rework the configuration model of 
>texi2html. Thus I will put here some proposals/questions:
>
>namespaces
>----------
>
>Currently there is one module, called T2H_i18n, for internationalization.
>Derek suggested to use another, Texi2HTML. And, if we use variables and
>not a hash, use another sub module Texi2HTML::Config. In any case I think 
>that T2H_i18n should better be called Texi2HTML::I18n.
>
>What do you think about it ?
>

Sounds like a good idea.

>things currently in the init file
>---------------------------------
>
>Currently the things which should be in Texi2HTML::Config are in variables
>(strings, arrays, hashes and function references).
>There are variables like 
>T2H_DEBUG
>function references like 
>$T2H_print_section
>and
>$t2h_index 
>and things taken from texi2html.pl, like
>%accent_map
>
>There are also global variables which are used by the functions, but set
>in texi2html.pl:
>
>The hashes
> T2H_HREF, T2H_NAME, T2H_NODE, T2H_NO_TEXI
>and the refs
>$T2H_OVERVIEW
>$T2H_TOC       
>$T2H_TOP        
>$T2H_THIS_SECTION
>$T2H_THIS_HEADER 
>
>And lastly there are variables for LaTeX2HTML
>
>put Latex2html variables in another file
>----------------------------------------
>
>First I think that the variables for LaTeX2HTML should go in a distinct file.
>And there will be a switch (and variable) for that file. 
>

What exactly is the extent of the LaTeX2HTML support?  I scanned the 
docs and the perl but it wasn't quickly obvious.  I don't recall 
encountering it as a step in the Texi2HTML conversion...  is it a 
seperate feature?

>This is still problematic if we want to distribute texi2html as a single file
>and still override the latex2html defaults, we have to keep those variables
>global... At least they shouldn't be mixed with Texi2html config variables
>anymore.
>

Hrm.  Dependant on your answer to my last question, and perhaps whether 
it would be posible to extract the LaTeX stuff and bind the two modules 
less tightly, what about Texi2HTML::LaTeX2HTML or LaTeX2HTML namespaces 
(and Texi2HTML::LaTeX2HTML::Config/LaTeX2HTML::Config)?

>A hash or variables
>-------------------
>
>There are 2 possibilities, here:
>- use a hash, %config, in the Texi2HTML namespace and put all the above 
>things in it. In that case I suggest removing the T2H_ or t2h_. The 
>variables will be called 
>$Texi2HTML::config{'DEBUG'}
>instead of
>$T2H_DEBUG
>
>And in that case we could require the config files while in the Texi2html
>name space and the entries in the init file would be like
>$config{'DEBUG'} = 1;
>
>- use a submodule Config and keep the variables as is, removing T2H_ or t2h_.
>The variables will be called
>$Texi2HTML::config::DEBUG
>
>And in that case we could require the config files while in the 
>Texi2html::Config name space and the entries in the init file would be like
>$DEBUG = 1;
>
>What do you prefer ?
>

I think I prefer the Texi2html::Config namespace, since it simplifies 
the Config.pm file, but this requires that warnings be suppressed during 
the require since, if defaults are provided for everything, then a 
redefinition warning will be issued for at least the functions.  strict 
compilation may need to be suppressed for the duration of the require as 
well.

Maybe that's why CPAN chose the config hash?  Might be worth looking up 
or asking if they had other reasons.

>global variables used in .init functions
>----------------------------------------
>
>I also suggest putting the global variables used in the init file functions
>in the Texi2HTML namespace. Thus, for example
>%T2H_HREF would become %Texi2HTML::HREF
>  
>

Seconded.

Derek

-- 
                *8^)

Email: [email protected]

Get CVS support at <http://ximbiot.com>!
-- 
I will not defame New Orleans.
I will not defame New Orleans.
I will not defame New Orleans...

          - Bart Simpson on chalkboard, _The Simpsons_