mustache_recase 1.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 64

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

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: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support 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';
  
Version Uploaded Documentation Archive
1.0.3 Aug 2, 2018 Go to the documentation of mustache_recase 1.0.3 Download mustache_recase 1.0.3 archive
1.0.2 Jan 30, 2018 Go to the documentation of mustache_recase 1.0.2 Download mustache_recase 1.0.2 archive
1.0.1 Jan 29, 2018 Go to the documentation of mustache_recase 1.0.1 Download mustache_recase 1.0.1 archive
1.0.0 Oct 2, 2017 Go to the documentation of mustache_recase 1.0.0 Download mustache_recase 1.0.0 archive
0.0.1 Oct 2, 2017 Go to the documentation of mustache_recase 0.0.1 Download mustache_recase 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Aug 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0.
 
 Because mustache_recase depends on recase <2.0.0 which requires SDK version >=1.20.0 <2.0.0, version solving failed.

Fix platform conflicts.

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0