View Source mix isbn.update_ranges (Exisbn v2.2.5)

Downloads the ISBN RangeMessage XML from isbn-international.org and regenerates lib/regions.ex with up-to-date publisher ranges.

Country code mappings (ISO 3166-1 alpha-2) are read from priv/country_codes.exs. New registration groups absent from that file receive country_code: nil and a warning is printed.

usage

Usage

mix isbn.update_ranges
mix isbn.update_ranges --xml path/to/RangeMessage.xml
mix isbn.update_ranges --url https://example.com/RangeMessage.xml

options

Options

  • --xml — path to a local XML file (skips network download)
  • --url — override the default download URL

Link to this section Summary

Functions

Renders the Exisbn.Regions module source from a dataset map.

Parses an ISBN RangeMessage XML binary and returns a list of group maps.

Link to this section Functions

Link to this function

generate_module(dataset, module_name \\ "Exisbn.Regions")

View Source
@spec generate_module(map(), String.t()) :: String.t()

Renders the Exisbn.Regions module source from a dataset map.

module_name defaults to "Exisbn.Regions" and can be overridden in tests to avoid redefining the live module.

Link to this function

parse_range_message(xml)

View Source
@spec parse_range_message(binary()) :: [
  %{prefix: String.t(), agency: String.t(), ranges: [[String.t()]]}
]

Parses an ISBN RangeMessage XML binary and returns a list of group maps.

Each map has keys :prefix, :agency, and :ranges, where :ranges is a list of [lo, hi] string pairs with leading zeros preserved.