Skip to content

kevmoo/haml.dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haml.dart

  • Main goal: a haml-spec compliant implementation of Haml in Dart.
  • A bunch of helpers to parse indention-based grammars to make things like Haml (and hopefully Sass) easier.
  • Some thoughts — wrapped in the Walker class at the moment — on implementing the Dart StreamTransformer model in such a way to allow both asynchronous (Stream-, Future-based) and synchronous (Iterable-based) parsing of text.

Huge thanks to Lukas Renggli and his PetitParserDart library.

Currently passing 72 of 102 haml-spec - modified tests.

Added some tests to haml-spec to keep myself honest in vague cases.

import 'package:haml/haml.dart';

void main() {
  print('Sample 1:');
  var input = '%h1 Hello, Haml!';
  var output = hamlStringToHtml(input);
  print(output);

  print('Sample 2:');
  input  =
'''
#content
  .section.draft
    %p.paragraph.example Here's some content
    %img{ :src => 'http://foo.com/img.png', :alt => 'silly' }
  %a(href='http://foo.com') Link body
''';

  output = hamlStringToHtml(input);
  print(output);
}

Sample 1:

<h1>Hello, Haml!</h1>

Sample 2:

<div id='content'>
  <div class='draft section'>
    <p class='example paragraph'>Here's some content</p>
    <img alt='silly' src='http://foo.com/img.png'>
  </div>
  <a href='http://foo.com'>Link body</a>
</div>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages