% Copyright (C) 2009 Michał Masłowski

% This file is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This file is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
% As a special exception, when this file is read by TeX when
% processing a TeX source document, you may use the result without
% restriction.


\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{onedash}[2009/05/09 language-dependent dashes]

% Declare option #1 providing quotes consisting of #2 space, #3
% character and #4 space after it.
\newcommand{\onedash@declare}[4]{%
  \DeclareOption{#1}{%
    \def\onedash@makeit{%
      \newcommand{\dash}{#2#3#4}
      \newcommand{\pdash}{#3#4}}}}

\onedash@declare{american}{}{\textemdash}{\hskip0pt}
\onedash@declare{british}{~}{\textendash}{\ }
\onedash@declare{polish}{~}{\textendash}{\ }
\onedash@declare{polish-emdash}{~}{\textemdash}{\ }

\ExecuteOptions{american}\relax % The default.
\ProcessOptions\relax
\onedash@makeit

% Hyphen used in Polish.
\newcommand\hyph{\kern0pt\discretionary{-}{-}{-}\penalty10000\hskip0pt\relax}
