Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mustache4dart copy inside dartdoc and use 'mustache' pub package #1894

Merged
merged 10 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/src/html/html_generator_instance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import 'package:dartdoc/src/html/templates.dart';
import 'package:dartdoc/src/logging.dart';
import 'package:dartdoc/src/model.dart';
import 'package:dartdoc/src/model_utils.dart';
import 'package:dartdoc/src/third_party/pkg/mustache4dart/lib/mustache4dart.dart';
import 'package:dartdoc/src/warnings.dart';
import 'package:mustache/mustache.dart';
import 'package:path/path.dart' as pathLib;

typedef void FileWriter(String path, Object content, {bool allowOverwrite});
Expand Down Expand Up @@ -377,9 +377,8 @@ class HtmlGeneratorInstance {
}
}

void _build(String filename, TemplateRenderer template, TemplateData data) {
String content = template(data,
assumeNullNonExistingProperty: false, errorOnMissingProperty: true);
void _build(String filename, Template template, TemplateData data) {
String content = template.renderString(data);

_writer(filename, content);
if (data.self is Indexable) _indexedElements.add(data.self as Indexable);
Expand Down
40 changes: 20 additions & 20 deletions lib/src/html/templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:async' show Future;
import 'dart:io' show File;

import 'package:dartdoc/src/html/resource_loader.dart' as loader;
import 'package:dartdoc/src/third_party/pkg/mustache4dart/lib/mustache4dart.dart';
import 'package:mustache/mustache.dart';

const _partials = const <String>[
'callable',
Expand Down Expand Up @@ -83,21 +83,21 @@ Future<String> _getTemplateFile(String templateFileName) =>
loader.loadAsString('package:dartdoc/templates/$templateFileName');

class Templates {
final TemplateRenderer categoryTemplate;
final TemplateRenderer classTemplate;
final TemplateRenderer enumTemplate;
final TemplateRenderer constantTemplate;
final TemplateRenderer constructorTemplate;
final TemplateRenderer errorTemplate;
final TemplateRenderer functionTemplate;
final TemplateRenderer indexTemplate;
final TemplateRenderer libraryTemplate;
final TemplateRenderer methodTemplate;
final TemplateRenderer mixinTemplate;
final TemplateRenderer propertyTemplate;
final TemplateRenderer topLevelConstantTemplate;
final TemplateRenderer topLevelPropertyTemplate;
final TemplateRenderer typeDefTemplate;
final Template categoryTemplate;
final Template classTemplate;
final Template enumTemplate;
final Template constantTemplate;
final Template constructorTemplate;
final Template errorTemplate;
final Template functionTemplate;
final Template indexTemplate;
final Template libraryTemplate;
final Template methodTemplate;
final Template mixinTemplate;
final Template propertyTemplate;
final Template topLevelConstantTemplate;
final Template topLevelPropertyTemplate;
final Template typeDefTemplate;

static Future<Templates> create(
{List<String> headerPaths,
Expand All @@ -106,17 +106,17 @@ class Templates {
var partials =
await _loadPartials(headerPaths, footerPaths, footerTextPaths);

String _partial(String name) {
Template _partial(String name) {
String partial = partials[name];
if (partial == null || partial.isEmpty) {
throw new StateError('Did not find partial "$name"');
}
return partial;
return Template(partial);
}

Future<TemplateRenderer> _loadTemplate(String templatePath) async {
Future<Template> _loadTemplate(String templatePath) async {
String templateContents = await _getTemplateFile(templatePath);
return compile(templateContents, partial: _partial);
return Template(templateContents, partialResolver: _partial);
}

var indexTemplate = await _loadTemplate('index.html');
Expand Down
11 changes: 0 additions & 11 deletions lib/src/third_party/pkg/000-mustache4dart-pubspec.patch

This file was deleted.

1,023 changes: 0 additions & 1,023 deletions lib/src/third_party/pkg/001-mustache4dart-import-rewrite.patch

This file was deleted.

8 changes: 0 additions & 8 deletions lib/src/third_party/pkg/mustache4dart/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions lib/src/third_party/pkg/mustache4dart/.gitmodules

This file was deleted.

21 changes: 0 additions & 21 deletions lib/src/third_party/pkg/mustache4dart/.travis.yml

This file was deleted.

48 changes: 0 additions & 48 deletions lib/src/third_party/pkg/mustache4dart/CHANGELOG.md

This file was deleted.

13 changes: 0 additions & 13 deletions lib/src/third_party/pkg/mustache4dart/LICENSE.txt

This file was deleted.

145 changes: 0 additions & 145 deletions lib/src/third_party/pkg/mustache4dart/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions lib/src/third_party/pkg/mustache4dart/build.sh

This file was deleted.

Loading