Marco Pessotto
and 1 contributors

NAME

Text::Amuse::Preprocessor::Typography - Perl extension for pre-processing of Text::Amuse files [DEPRECATED]

SYNOPSIS

  use Text::Amuse::Preprocessor::Typography qw/typography_filter/;
  my $cleanedtext = typography_filter($lang, $text)
  

DESCRIPTION

Common routines to filter the input files, fixing typography and language-specific rules. All the text is assumed to be already decoded.

This module is DEPRECATED and kept only for legacy. Please use the interface described in Text::Amuse::Preprocessor instead.

FUNCTIONS

linkify_filter($string)

Detect and replace the bare links with the proper markup, as [[http://domain.org/my/url/and_params?a=1&b=c][domain.org]]

It's a bit opinionated to hide the full url and show only the domain. Anyway, it's a preprocessing filter and the most important thing is not to loose pieces. And we don't, because the full url is still there. Anyway, long urls are a pain to display and to typeset, so the domain is a sensible choice. The user can anyway change this. It's just an helper to avoid boring tasks, nothing more.

Returns the adjusted string.

typography_filter($lang, $string)

Perform the smart replacement of single quotes, double quotes, dashes and, in some cases, the superscript for things like 2nd, 13th, etc.

The languages supported are en, fi, hr, sr, ru, es.

Returns the adjusted string.

get_typography_filter($lang, $links)

Return a sub which you can call later on a string. The sub will first call the common replacements (ugly unicode ligatures). If the first argument is set and is a valid language, will do the language specific replacements. If the second argument is set and true, will also fix the links.

The sub itself will return the adjusted string.

filters()

Return an hashref with the filters subs.

SEE ALSO

Text::Amuse::Preprocessor