# -*- CPERL -*-
# /=====================================================================\ #
# |  html                                                               | #
# | Implementation for LaTeXML                                          | #
# |=====================================================================| #
# | Part of LaTeXML:                                                    | #
# |  Public domain software, produced as part of work done by the       | #
# |  United States Government & not subject to copyright in the US.     | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov>                        #_#     | #
# | http://dlmf.nist.gov/LaTeXML/                              (o o)    | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use LaTeXML::Package;

RequirePackage('hyperref');
#**********************************************************************
DefMacro('\latextohtml','\LaTeX2\texttt{HTML}');
DefMacro('\htmladdnormallinkfoot{}{}','\href{#2}{#1}');
DefMacro('\htmladdnormallink{}{}','\href{#2}{#1}');
DefMacro('\htmladdimg{}','\hyperimage{#1}');
DefMacro('\externallabels Semiverbatim Semiverbatim','');
DefMacro('\externalref{}',''); # ???
DefMacro('\externalcite','\nocite');
DefMacro('\htmladdTOClink[]{}{}{}', '');
DefConstructor('\htmlrule OptionalMatch:*','<ltx:rule/>');
DefConstructor('\HTMLrule OptionalMatch:*','<ltx:rule/>');
DefConstructor('\htmlclear','<ltx:br/>');
DefMacro('\bodytext{}','');
DefMacro('\htmlbody','');

DefConstructor('\hyperrefdef {} {}{} Semiverbatim', "<ltx:ref labelref='#label'>#1</ltx:ref>",
	       properties=>sub { (label=>CleanLabel($_[4])); });

Let('\hyperrefhyper',  '\hyperrefdef');
Let('\hyperrefpagedef','\hyperrefdef');
Let('\hyperrefnoref',  '\hyperrefdef');
Let('\hyperrefhtml',   '\hyperrefdef');

DefConstructor('\hypercite [] {}{} [] Semiverbatim',
	       "<ltx:cite>#4 <ltx:bibref bibrefs='#5'>#2</ltx:bibref> #1</ltx:cite>");
DefMacro('\htmlcite{}{}','\hypercite{#1}{}{#2}');
DefMacro('\htmlimage{}','');
DefMacro('\htmlborder{}','');
DefEnvironment('{makeimage}','#body');
DefEnvironment('{tex2html_deferred}','#body');
DefMacro('\htmladdtonavigation{}','');

# These get excluded, since we probably don't even want to try to include html?
#DefEnvironment('{rawhtml}','');
#DefEnvironment('{htmlonly}','');
DefConstructorI(T_CS("\\begin{rawhtml}"),undef,'', reversion=>'',
		afterDigest=>[sub {
				my($stomach,$whatsit)=@_;
				my $end = "\\end{rawhtml}";
				my @lines = $stomach->getGullet->getMouth->readRawLines($end,0);
				NoteProgress("[Skip rawhtml (".scalar(@lines)."lines)]"); }]);
DefConstructorI(T_CS("\\begin{htmlonly}"),undef,'', reversion=>'',
		afterDigest=>[sub {
				my($stomach,$whatsit)=@_;
				my $end = "\\end{htmlonly}";
				my @lines = $stomach->getGullet->getMouth->readRawLines($end,0);
				NoteProgress("[Skip htmlonly (".scalar(@lines)."lines)]"); }]);
DefMacro('\html{}','');
DefEnvironment('{latexonly}','#body'); # Include this (?)
DefMacro('\latex{}','#1');
DefMacro('\latexhtml{}{}','#1');

DefMacro('\strikeout{}','#1');
DefMacro('\htmlurl Semiverbatim','\url{#1}');

DefMacro('\HTMLset{}{}','');
DefMacro('\htmlinfo','');
# Not implemented!
#**********************************************************************
1;
