mustache_recase 2.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

mustache_recase #

A library for extending the functionality of mustache package with recase

Usage #

import 'package:mustache/mustache.dart';
import 'package:mustache_recase/mustache_recase.dart' as mustache_recase;

void main(){
  Template template = new Template("{{#title_case}} {{hello}} {{/title_case}}");
  Map variables = {"hello": "hello-world"};
  variables.addAll(mustache_recase.cases);
  String output = template.renderString(variables);
  print(output); // Hello World
}

See (or interact with) the example and/or the test of the package if you have doubts

List of usable cases #

  • snake_case
  • dot.case
  • path/case
  • param-case
  • PascalCase
  • Header-Case
  • Title Case
  • camelCase
  • Sentence case
  • CONSTANT_CASE

misc

This package was made with Generator+ package in an effort to have it tested and, at the same time, extended in it's mustache templates related features. I'm glad it worked as expected 😃

Changelog #

2.0.3 #

  • Changed to mustache_template that doesn't depends on mirrors for greater compatibility

2.0.2 #

  • Updated package
  • Removed 'new' keyword

2.0.1 #

  • Removed Generator+ dep

2.0.0 #

  • recase dep. updated to 2.0.0

1.0.3 #

  • Mocosoft free
  • Dart 2 compatibility with <3.0.0 constraint
  • verbose description with >60 chars
  • Example file renamed to example.dart

1.0.2 #

  • Generator+ public scaffolded structure reintroduced
  • Generator+ pubspec.yaml's constraint moved from dev dependencies

1.0.1 #

  • Generator+ public scaffolded structure removed
  • pubspec.yaml constraints updated

1.0.0 #

  • Stable and ready to use release

0.0.1 #

  • Initial version, created by Stagehand

example/main.dart

import "dart:io";

import 'package:mustache/mustache.dart';
import 'package:mustache_recase/mustache_recase.dart' as mustache_recase;

main(List<String> args) {
  stdout.write("Provide a test string: ");
  String testVar = stdin.readLineSync();

  String templateSource = '';
  //@generationAfter("new-case_example_template")
  templateSource +=
      "Dot Case: {{ # dot_case }}{{test_var}} {{ / dot_case }} \n";
  templateSource +=
      "Path Case: {{ # path_case }}{{test_var}} {{ / path_case }} \n";
  templateSource +=
      "Constant Case: {{ # constant_case }}{{test_var}} {{ / constant_case }} \n";
  templateSource +=
      "Header Case: {{ # header_case }}{{test_var}} {{ / header_case }} \n";
  templateSource +=
      "Sentence Case: {{ # sentence_case }}{{test_var}} {{ / sentence_case }} \n";
  templateSource +=
      "Title Case: {{ # title_case }}{{test_var}} {{ / title_case }} \n";
  templateSource +=
      "Param Case: {{ # param_case }}{{test_var}} {{ / param_case }} \n";
  templateSource +=
      "Pascal Case: {{ # pascal_case }}{{test_var}} {{ / pascal_case }} \n";
  templateSource +=
      "Snake Case: {{ # snake_case }}{{test_var}} {{ / snake_case }}\n";
  templateSource +=
      "Camel Case: {{ # camel_case }}{{test_var}} {{ / camel_case }}\n";

  Template template = new Template(templateSource);
  Map variables = {"test_var": testVar};
  variables.addAll(mustache_recase.cases);
  String output = template.renderString(variables);
  print(output);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mustache_recase: ^2.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mustache_recase/mustache_recase.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
mustache_template ^1.0.0 1.0.0+1
recase ^3.0.0 3.0.0
Dev dependencies
test >=0.12.0 <1.4.0