\NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \newcommand* etc. 
\ProvidesPackage{blogdot}[2013/01/22 v0.41b HTML presentations (UL)]
%% copyright (C) 2011 Uwe Lueck, 
%% http://www.contact-ednotes.sty.de.vu 
%% -- author-maintained in the sense of LPPL below.
%%
%% This file can be redistributed and/or modified under 
%% the terms of the LaTeX Project Public License; either 
%% version 1.3c of the License, or any later version.
%% The latest version of this license is in
%%     http://www.latex-project.org/lppl.txt
%% We did our best to help you, but there is NO WARRANTY. 
%%
%% Please report bugs, problems, and suggestions via 
%% 
%%   http://www.contact-ednotes.sty.de.vu 
%%
%% == 'blog' Required ==
%% 'blogdot' is an extension of 'blog' 
%% (but what about options? TODO):
\RequirePackage{blog}
%% == Size Parameters ==
%% \label{sec:dot-size}
%% I assume that it is clear what the following
%% six page dimension parameters 
%% \begin{quote}
%% |\leftpagemargin|, |\rightpagemargin|, 
%% |\upperpagemargin|,\\|\lowerpagemargin|, 
%% |\typeareawidth|, |\typeareaheight|
%% \end{quote}
%% mean. 
%% The choices are what I thought should work best 
%% on my 1024$\times$600 screen (in fullscreen mode); 
%% but I had to optimize the left and right margins experimentally
%% (with Mozilla Firefox~3.6.22 for Ubuntu canonical~-~1.0).
%% It seems to be best when the horizontal parameters 
%% together with what the brouswer adds 
%% (scroll bar, probably 32px with me) 
%% sum up to the screen width.
\newcommand*{\leftpagemargin}{176}
\newcommand*{\rightpagemargin}{\leftpagemargin}
%% So |\rightpagemargin| ultimately is the same as 
%% |\leftpagemargin| as long as you don't redefine it, 
%% and it suffices to `\renewcommand' `\leftpagemargin'
%% in order to get a horizontically centered type area 
%% with user-defined margin widths.---Something analogous
%% applies to |\upperpagemargin| and |\lowerpagemargin|:
\newcommand*{\upperpagemargin}{80}
\newcommand*{\lowerpagemargin}{\upperpagemargin}
%% A difference to the ``horizontal" parameters is 
%% (I expect) that the position of the type area on the 
%% screen is affected by |\upperpagemargin| only, 
%% and you may choose |\lowerpagemargin| just large enough 
%% that the next slide won't be visible on any computer screen 
%% you can think of.
\newcommand*{\typeareawidth}{640}
\newcommand*{\typeareaheight}{440}
%% Centering with respect to web page body may work better on 
%% different screens (2011/10/03), but it doesn't work here
%% (2011/10/04).
% \renewcommand*{\body}{%
%     </head>\CLBrk
%     <body \@bgcolor{\bodybgcolor} \@align@c>}
%% |\CommentBlogDotWholeWidth| procuces no \HTML\ code ...
\global\let\BlogDotWholeWidth\@empty
%% ... unless calculated with |\SumBlogDotWidth|: 
\newcommand*{\SumBlogDotWidth}{%
    \relax{%                        %% \relax 2011/10/22 magic ...
    \count@\typeareawidth
    \advance\count@ \leftpagemargin
    \advance\count@\rightpagemargin
    \typeout{ * blogdot slide width = \the\count@\space*}%
    \xdef\CommentBlogDotWholeWidth{%
        \comment{ slide width = \the\count@\ }}}}
%%
%% == (Backbone for) Starting a ``Slide" ==
%% \label{sec:dot-start}
%% |\startscreenpage{<style>}{<anchor-name>}|
\newcommand*{\startscreenpage}[2]{%% 0 2011/09/25!?:
    \\\CLBrk                                %% 2012/11/19
%% <- `\\' suddenly necessary, likewise in `texblog.fdf'
%%    with `\NextView' and `\nextruleview'. 
%%    Due to recent `firefox'?              %% 2012/11/21
    \startTable{%
        \@cellpadding{0} \@cellspacing{0}%
        \maybe@blogdot@borders              %% 2011/10/12
        \maybe@blogdot@frame                %% 2011/10/14
    }%
    \CLBrk                                  %% 2011/10/03
    \starttr
%% First cell determines both
%% height of upper page margin |\upperpagemargin|
%% and
%% width of left page margin |\leftpagemargin|:
      \startTd{\@width {\leftpagemargin }%
               \@height{\upperpagemargin}}%
%         \textcolor{\bodybgcolor}{XYZ}%
      \endTd
%% Using |\typeareawidth|:
%       \startTd{\@width{\typeareawidth}}\endTd
      \simplecell{%
        \CLBrk
        \hanc{#2}{\hvspace{\typeareawidth}% 
                          {\upperpagemargin}}%
        \CLBrk
      }%
%% Final cell of first row determines right margin width:
      \startTd{\@width{\leftpagemargin}}\endTd
    \endtr
    \starttr
    \emptycell\startTd{\@height{\typeareaheight}#1}%
}
%% |\titlescreenpage| \ (`\STARTscreenpage' TODO?) \ %% 2011/10/03 \ 2012/11/19
%% opens the title page (I thought). To get it to your screen, 
%% (make and) click a link like 
%% \[`\ancref{START}{start presentation}':\]
\newcommand*{\titlescreenpage}{%
    \startscreenpage{\@align@c}{START}}
%% 
%% == Finishing a ``Slide" and ``Restart" (Backbone) ==
%% \label{sec:dot-fin}
%% |\screenbottom{<next-anchor>}| finishes the current slide 
%% and links to the <next-anchor>, the anchor of a slide opened by 
%% \[`\startscreenpage{<style>}{<next-anchor>}'.\] 
%% More precisely, the margin below the type area is that link.
%% The corner at its right is a link to the anchor to whose name 
%% |\BlogDotRestart| expands. 
\newcommand*{\screenbottom}[1]{%
    \ifFillBlogDotTypeArea 
      <p>\ancref{#1}{\BlogDotFillText}%    %% not </p> 2011/10/22
    \fi
    \endTd\emptycell
    \endtr
    \CLBrk
    \tablerow{bottom margin}%                       %% 2011/10/13
      \emptycell
      \CLBrk
      \startTd{\@align@c}%
        \ancref{#1}{\HVspace{\BlogDotBottomFill}%
%% <- seems to be useless now (2011/10/15).
                            {\typeareawidth}%
                            {\lowerpagemargin}}%
      \endTd
      \CLBrk
      \simplecell{\ancref{\BlogDotRestart}% 
                         {\hvspace{\rightpagemargin}% 
                                  {\lowerpagemargin}}}%
    \endtablerow
    \CLBrk
    \endTable
}
%% The default for |\BlogDotRestart| is |START|---the title page. 
%% You can `\renew'\-`command' it so you get to a slide 
%% containing an overview of the presentation.
\newcommand*{\BlogDotRestart}{START}
%% 
%% == Moving to Next ``Slide" (User Level) == 
%% \label{sec:dot-next}
%% |\nextscreenpage{<style>}{<anchor-name>}|
%% puts closing the previous slide and opening the next 
%% one---having anchor name `<anchor-name>'---together.
%% <style> is for style settings for the next page, 
%% made here for choosing between centering the page/slide content 
%% and aligning it flush left.
\newcommand*{\nextscreenpage}[2]{%
    \screenbottom{#2}\CLBrk
    \hrule           \CLBrk 
    \startscreenpage{#1}{#2}}
%% |\nextcenterscreenpage{<anchor-name>}| chooses centering 
%% the slide content:
\newcommand*{\nextcenterscreenpage}{\nextscreenpage{\@align@c}}
%% |\nextnormalscreenpage{<anchor-name>}| chooses flush left
%% on the type area determined by |\typeareawidth|:
\newcommand*{\nextnormalscreenpage}{\nextscreenpage{}}
%% 
%% == Constructs for Type Area ==
%% \label{sec:dot-type}
%% If you want to get centered titles with \xmltagcode{h2} etc., 
%% you should declare this in `.css' files. But you may consider 
%% this way too difficult, and you may prefer to declare this 
%% right in the \HTML\ code. That's what I do! I use 
%% |\cheading{<digit>}{<text>}| for this purpose. 
\newcommand*{\cheading}[1]{\CLBrk\TagSurr{h#1}{\@align@c}}
%% |\begin{textblock}{<width>}| opens a |{textblock}| 
%% environment. The latter will contain text that will be flush left
%% in a narrower text area---of width <width>---than the one 
%% determined by |\typeareawidth|. It may be used on 
%% "centered" slides. It is made for lists whose entries are 
%% so short that the page would look unbalanced under a 
%% centered title with the list adjusted to the left 
%% of the entire type area. (Thinking of standard \LaTeX, 
%% it is almost the `{minipage}' environment, however lacking 
%% the footnote feature, in that respect it is rather 
%% similar to `\parbox' which however is not an environment.)
\newenvironment*{textblock}[1]
    {\startTable{\@width{#1}}\starttr\startTd{}}
    {\endTd\endtr\endTable}
%%
%% == Debugging and `.cfg's ==
%% \label{sec:cfgs}
%% |\ShowBlogDotBorders| shows borders of the page margins 
%% and may be undone by |\DontShowBlogDotBorders|:
\newcommand*{\ShowBlogDotBorders}{%
    \def\maybe@blogdot@borders{rules="all"}}
\newcommand*{\DontShowBlogDotBorders}{%
    \let\maybe@blogdot@borders\@empty}
\DontShowBlogDotBorders
%% %% 2011/10/14:
%% |\ShowBlogDotFrame| shows borders of the page margins 
%% and may be undone by |\DontShowBlogDotFrame|:
\newcommand*{\ShowBlogDotFrame}{%
    \def\maybe@blogdot@frame{\@frame@box}}
\newcommand*{\DontShowBlogDotFrame}{%
    \let\maybe@blogdot@frame\@empty}
\DontShowBlogDotFrame
%% However, the rules seem to affect horizontal positions ...
%%
%% |\BlogDotFillText| is a dirty trick ... seems to widen 
%% %% doc. extended 2011/10/13
%% the type area and this way centers the text on wider screens 
%% than the one used originally. Of course, this can corrupt 
%% intended line breaks. 
\newcommand*{\BlogDotFillText}{%            %% 2011/10/11
    \center
        \BlogDotFillTextColor{%             %% 2011/10/12
%                 X\\X                      %% insufficient
                 X X X X X X X X X X X X X X X X X X X X 
                 X X X X X X X X X X X X X X X X X X X X 
                 X X X X X X X X X X 
                 X X X X X X X X X X 
%                  X X X X X X X X X X X X X X X X X X X X 
        }
    \endcenter
}
%% |\FillBlogDotTypeArea| fills `\BlogDotFillText' into the 
%% type area, also as a link to the next slide. This may widen
%% the type area so that the text is centered on wider screens 
%% than the one the \HTML\ page was made for. The link may serve 
%% as an alternative to the bottom margin link 
%% (which sometimes fails). 
%% `\FillBlogDotTypeArea'                   %% 2011/10/22
%% can be undone 
%% by |\DontFillBlogDotTypeArea|:
\newcommand*{\FillBlogDotTypeArea}{%
    \let\ifFillBlogDotTypeArea\iftrue 
    \typeout{ * blogdot filling type area *}}       %% 2011/10/13
\newcommand*{\DontFillBlogDotTypeArea}{%
    \let\ifFillBlogDotTypeArea\iffalse}
\DontFillBlogDotTypeArea
%% |\FillBlogDotBottom| fills `\BlogDotFillText' into the 
%% center bottom cell. I tried it before `\FillBlogDotTypeArea'
%% and I am not sure ... 
%% It can be undone by 
%% |\DontFillBlogDotBottom|:
\newcommand*{\FillBlogDotBottom}{%
    \let\BlogDotBottomFill\BlogDotFillText}
%% ... actually, it doesn't seem to make a difference! 
%% (2011/10/13)
\newcommand*{\DontFillBlogDotBottom}{\let\BlogDotBottomFill\@empty} 
\DontFillBlogDotBottom
%% |\DontShowBlogDotFillText| makes `\BlogDotFillText' invisible,\\ 
%% |\ShowBlogDotFillText| makes it visible. 
%% Until 2011/10/22, `\textcolor' ('blog.sty') used the 
%% \xmltagcode{font} element that is deprecated. 
%% I still use it here because it seems to suppress the 
%% `hover' \acro{CSS} indication for the link. 
%% (I might offer a choice---TODO)
\newcommand*{\DontShowBlogDotFillText}{%
%     \def\BlogDotFillTextColor{\textcolor{\bodybgcolor}}}
    \def\BlogDotFillTextColor{%
        \TagSurr{font}{color="\bodybgcolor"}}}
\newcommand*{\ShowBlogDotFillText}{%
    \def\BlogDotFillTextColor{\textcolor{red}}}
\DontShowBlogDotFillText
%% As of 2013/01/22, 'texlinks.sty' provides    %% adjusted 2013/01/22
%% `\ctanfileref{<path>}{<file-name>}' that uses an online 
%% \TeX\ archive randomly chosen or determined by the user. 
%% This is preferable for an online version of the presentation. 
%% In `dantev45.htm', this is used for example files.
%% When, on the other hand, internet access during the presentation is 
%% bad, such example files may instead be loaded from the 
%% ``current directory." \ |\usecurrdirctan| \ modifies `\ctanfileref' 
%% for this purpose (i.e., it will ignore <path>):
\newcommand*{\usecurrdirctan}{%
    \renewcommand*{\ctanfileref}[2]{%
        \hnewref{}{##2}{\filenamefmt{##2}}}}
%% (Using a local \acro{TDS} tree would be funny, but I don't 
%%  have good idea for this right now. )
%%
%% |\TryBlogDotCFG| looks for `blogdot.cfg', 
%% \[|\TryBlogDotCFG[<file-name-base>]|\]       %% \[...\] 2011/10/21 
%% looks for `<file-name-base>.cfg' 
%% (for recompiling a certain file):
\newcommand*{\TryBlogDotCFG}[1][blogdot]{%
    \InputIfFileExists{#1.cfg}{%
        \typeout{
            * Using local settings from \string`#1.cfg\string' *}%
    }{}%
}
\TryBlogDotCFG
%%
%% %% rm. \pagebreak 2013/01/04
%% == The End and HISTORY ==
\endinput
%% VERSION HISTORY
v0.1    2011/09/21f.  started
        2011/09/25    spacing/padding off
        2011/09/27    \CLBrk
        2011/09/30    \BlogDotRestart
        used for DANTE meeting
v0.2    2011/10/03    four possibly independent page margin 
                      parameters; \hvspace moves to texblog.fdf
        2011/10/04    renewed \body commented out
        2011/10/07    documentation
        2011/10/08    added some labels
        2011/10/10    v etc. in \ProvidesPackage
        part of morehype RELEASE r0.5 
v0.3    2011/10/11    \HVspace, \BlogDotFillText
        2011/10/12    commands for \BlogDotFillText
        2011/10/13    more doc. on "debugging"; 
                      \ifFillBlogDotTypeArea, \tablerow, messages
        2011/10/14    \maybe@blogdot@frame
        2011/10/15    doc. note: \HVspace useless
        part of morehype RELEASE r0.51 
v0.4    2011/10/21    \usecurrdirctan
        2011/10/22    FillText with <p> instead of </p>, its color 
                      uses <font>; some more reworking of doc.
        part of morehype RELEASE r0.6 
v0.41   2012/11/19    \startscreenpage with \\; doc. \ 
        2012/11/21    updating version infos, doc. \pagebreak
v0.41a  2013/01/04    rm. \pagebreak 
        part of morehype RELEASE r0.81
v0.41b  2013/01/22    adjusted doc. on `texlinks'
