pandoc-2.9.2.1: Conversion between markup formats

Copyright | Copyright (C) 2017–2020 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell2010

Text.Pandoc.BCP47

Description

Functions for parsing and rendering BCP47 language identifiers.

Synopsis

- getLang :: WriterOptions -> Meta -> Maybe Text
- parseBCP47 :: Text -> Either Text Lang
- data Lang = Lang {
  - langLanguage :: Text
  - langScript :: Text
  - langRegion :: Text
  - langVariants :: [Text]
  }
- renderLang :: Lang -> Text

# Documentation

getLang :: WriterOptions -> Meta -> Maybe Text Source #

Get the contents of the `lang` metadata field or variable.

parseBCP47 :: Text -> Either Text Lang Source #

Parse a BCP 47 string as a Lang. Currently we parse extensions and private-use fields as "variants," even though officially they aren't.

data Lang Source #

Represents BCP 47 language/country code.

Constructors

Lang |

Fields

- langLanguage :: Text
- langScript :: Text
- langRegion :: Text
- langVariants :: [Text]

#### Instances

Instances details

Eq Lang Source # |
Instance details Defined in Text.Pandoc.BCP47 Methods (==) :: Lang -> Lang -> Bool Source # (/=) :: Lang -> Lang -> Bool Source #
Ord Lang Source # |
Instance details Defined in Text.Pandoc.BCP47 Methods compare :: Lang -> Lang -> Ordering Source # (<) :: Lang -> Lang -> Bool Source # (<=) :: Lang -> Lang -> Bool Source # (>) :: Lang -> Lang -> Bool Source # (>=) :: Lang -> Lang -> Bool Source # max :: Lang -> Lang -> Lang Source # min :: Lang -> Lang -> Lang Source #
Show Lang Source # |
Instance details Defined in Text.Pandoc.BCP47 Methods showsPrec :: Int -> Lang -> ShowS Source # show :: Lang -> String Source # showList :: [Lang] -> ShowS Source #

renderLang :: Lang -> Text Source #

Render a Lang as BCP 47.