0.0
No release in over 3 years
There's a lot of open issues
Parses Inline Attribute Lists with extensions, quotes, interpolation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 13.3
~> 3.13
 Project Readme
EN ru

is-ial-parser

GitHub License Gem Version Ruby Coverage

Universal Inline Attribute List (IAL) parser for Kramdown and Jekyll plugins.

Version

  • 0.8.0 — pre-release.

Overview

is-ial-parser is a Ruby gem designed to parse Inline Attribute Lists with support for extensions, quoting, interpolation, and type conversion. It helps process attribute strings typically embedded in markdown or static site generators like Jekyll, enabling enhanced control over element attributes, classes, IDs, and custom extensions.

Key features include:

  • Parsing of IDs, classes, key-value attributes, and special prefixes.
  • Support for quoted and escaped values.
  • Conversion of string values to native Ruby types (booleans, numbers, symbols).
  • Extensible attribute namespaces using colon-separated keys.
  • Configurable strict mode with detailed error handling.
  • Preservation of original quoting if needed.
  • Comprehensive handling of edge cases and errors such as duplicate IDs or unterminated quotes.

Installation

Add this line to your application's Gemfile:

gem 'is-ial-parser', '~> 0.8.0'

Then execute:

bundle install

Or install it yourself as:

gem install is-ial-parser

Usage

require 'is-ial-parser'

source = '@/home/ivan scan=false link= title="Example title" .note.italic #header ext:sym=blabla\ ololo'
result = IALParser.parse(source, special_prefixes: ['@'])

# Result is a Hash with parsed keys and values:
puts result[:id]           # :header
puts result[:classes]      # Set['note', 'italic']
puts result[:"@"]          # "/home/ivan"
puts result[:scan]         # false
puts result[:title]        # "Example title"
puts result[:ext][:sym]    # "blabla ololo"

See the test/spec files for more usage examples and edge cases.

Development

To run specs:

bundle exec rake spec

Test coverage includes parsing of classes, IDs, attributes, quoted and escaped strings, extensions, error conditions, and type conversions.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jekyll-is/is-ial-parser.

Please follow the existing code style and test coverage for any additions.

License

The gem is available as open source under the terms of the GNU GPLv3 License.