# -*- tcl -*-
# $Id: linuxdoc_title,v 1.5 2002/01/17 10:13:07 tobotras Exp $

# REQUIRES running_title!
global TEItools_running_title_in_use
if { ![info exists TEItools_running_title_in_use] } {
    puts stderr "\n*** linuxdoc_title requires loading running_title first!\n"
    exit 1
}

rename TitlePage {}

proc TitlePage {} {
    global header 
    set ret {}

    set title {}
    withNode doctree element TITLEPAGE {
	foreachNode subtree element TITLEPART {
	    append title "[content]\\\\\n"
	}
    }
    
    # Shamelessly stolen from sgml-tools style
    if { "$title" != "" } {
	append ret "
%\\addtolength\\linewidth{0.8in}
%\\addtolength\\oddsidemargin{-0.8in}
\\noindent
\{\\huge\\sf[localize cyr] $title\}\\\\
\\rule\{\\linewidth\}\{1mm\}\\\\
"
    } else {
	puts stderr "WARNING: No document title"
    }
    
    global authorPrefix_Counter
    if { [info exist authorPrefix_Counter] } {
	append ret "\\mbox\{[localize cyr] "
	for {set i 0} {$i <= $authorPrefix_Counter} {incr i} {
	    if { $i > 0 } {
		append ret ", "
	    }
	    append ret "[authorMacro $i]{}"
	}
	append ret "\}\\ \\hfill "
    }
    
    if { [info exist header(date)] } {
	append ret "$header(date) \\ "
    }

    return "$ret\\
%\\addtolength\\linewidth{-0.8in}
%\\addtolength\\oddsidemargin{0.8in}
\\vskip 3ex
\\setcounter{footnote}{0}
"
}
