diff --git a/.gitignore b/.gitignore index 934b15e..e41e6ae 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,7 @@ packages .pub refreshChromium-1.0.applescript *.lockSiteGen.iml + +# Files and directories created by pub +.dart_tool/ +.packages diff --git a/lib/sitegen.dart b/lib/sitegen.dart index 24369e2..280a1b9 100755 --- a/lib/sitegen.dart +++ b/lib/sitegen.dart @@ -7,6 +7,7 @@ import 'dart:math'; import 'package:intl/intl.dart'; import 'package:args/args.dart'; +import 'package:markdown/markdown.dart'; import 'package:where/where.dart'; import 'package:logging/logging.dart'; @@ -16,7 +17,7 @@ import 'package:validate/validate.dart'; import "package:path/path.dart" as path; import "package:markdown/markdown.dart" as md; -import "package:mustache/mustache.dart" as mustache; +import "package:reflected_mustache/mustache.dart" as mustache; import "package:yaml/yaml.dart" as yaml; import 'package:http_server/http_server.dart'; @@ -36,11 +37,7 @@ bool _runsOnOSX() => (SysInfo.operatingSystemName == "Mac OS X"); // final _commands = new List(); Future main(List arguments) async { - final Application application = new Application(); + final Application application = new Application(); - application.run( arguments ); + application.run(arguments); } - - - - diff --git a/lib/src/Application.dart b/lib/src/Application.dart index a1337b2..711891f 100644 --- a/lib/src/Application.dart +++ b/lib/src/Application.dart @@ -29,7 +29,7 @@ class Application { _configLogging(config.loglevel); try { - _testPreconditions(cm); + _testPreconditions(cm, config); } catch(error) { stderr.writeln(error.toString()); @@ -320,7 +320,12 @@ class Application { // -- private ------------------------------------------------------------- - void _testPreconditions(final CommandManager cm) { + void _testPreconditions(final CommandManager cm, final Config config) { + // if not using sass or prefixer, dont check for them being available + if (!config.usesass && !config.useautoprefixer) { + return; + } + if((cm.containsKey(CommandManager.SASS) || cm.containsKey(CommandManager.SASSC)) && cm.containsKey(CommandManager.AUTOPREFIXER)) { return; diff --git a/lib/src/Generator.dart b/lib/src/Generator.dart index 89b6177..be957bb 100644 --- a/lib/src/Generator.dart +++ b/lib/src/Generator.dart @@ -66,8 +66,15 @@ class Generator { final String block = yamlBlock.join('\n'); final yaml.YamlMap ym = yaml.loadYaml(block); - pageOptions.addAll(ym.map((key,value) - => MapEntry(key.toString(),value.toString()))); + pageOptions.addAll(ym.map((key, value) { + if (value is yaml.YamlList) { + return MapEntry(key.toString(), value); + } + if (value is yaml.YamlMap) { + return MapEntry(key.toString(), value); + } + return MapEntry(key.toString(), value.toString()); + })); _resolvePartialsInYamlBlock(partialsDir,pageOptions,config.usemarkdown); @@ -89,7 +96,10 @@ class Generator { String outputExtension = extension; if (isMarkdown(file) && _isMarkdownSupported(config.usemarkdown, pageOptions)) { - pageOptions['_content'] = md.markdownToHtml(pageOptions['_content']); + pageOptions['_content'] = md.markdownToHtml(pageOptions['_content'], + inlineSyntaxes: [InlineHtmlSyntax()], + extensionSet: ExtensionSet.gitHubWeb + ); outputExtension = "html"; } @@ -186,7 +196,10 @@ class Generator { } else if(partialMd.existsSync()) { content = partialMd.readAsStringSync(); if(isMarkdownSupported) { - content = md.markdownToHtml(content); + content = md.markdownToHtml(content, + inlineSyntaxes: [InlineHtmlSyntax()], + extensionSet: ExtensionSet.gitHubWeb, + ); } } @@ -239,7 +252,9 @@ class Generator { file.path.endsWith('.png') || file.path.endsWith(".jpg") || - file.path.endsWith(".gif") + file.path.endsWith(".gif") || + file.path.endsWith(".woff") || + file.path.endsWith(".tff") ) && !file.path.contains("packages") ) .map((final FileSystemEntity entity) => entity as File) diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..ff7c34f --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,607 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "0.39.10" + ansicolor: + dependency: transitive + description: + name: ansicolor + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + args: + dependency: "direct main" + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + build: + dependency: transitive + description: + name: build + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + build_cli_annotations: + dependency: transitive + description: + name: build_cli_annotations + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + build_config: + dependency: transitive + description: + name: build_config + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.2" + build_daemon: + dependency: transitive + description: + name: build_daemon + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.9" + build_runner: + dependency: "direct dev" + description: + name: build_runner + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + url: "https://pub.dartlang.org" + source: hosted + version: "5.2.0" + build_test: + dependency: "direct dev" + description: + name: build_test + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + built_collection: + dependency: transitive + description: + name: built_collection + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.2" + built_value: + dependency: transitive + description: + name: built_value + url: "https://pub.dartlang.org" + source: hosted + version: "7.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" + code_builder: + dependency: transitive + description: + name: code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.13" + console_log_handler: + dependency: "direct main" + description: + name: console_log_handler + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + coverage: + dependency: transitive + description: + name: coverage + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.1" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.6" + file_utils: + dependency: transitive + description: + name: file_utils + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.11" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + globbing: + dependency: transitive + description: + name: globbing + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.1" + graphs: + dependency: transitive + description: + name: graphs + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" + grinder: + dependency: "direct dev" + description: + name: grinder + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.5" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+3" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.1" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" + http_server: + dependency: "direct main" + description: + name: http_server + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.8+3" + intl: + dependency: "direct main" + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.8" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.2" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + logging: + dependency: "direct main" + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.4" + markdown: + dependency: "direct main" + description: + name: markdown + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.8" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.6+3" + node_interop: + dependency: transitive + description: + name: node_interop + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + node_io: + dependency: transitive + description: + name: node_io + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + node_preamble: + dependency: transitive + description: + name: node_preamble + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.12" + optional: + dependency: transitive + description: + name: optional + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + packages: + dependency: "direct main" + description: + name: packages + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.4" + path: + dependency: "direct main" + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + reflectable: + dependency: transitive + description: + name: reflectable + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.5" + reflected_mustache: + dependency: "direct main" + description: + name: reflected_mustache + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.11" + shelf: + dependency: transitive + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.7" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + shelf_static: + dependency: transitive + description: + name: shelf_static + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.8" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.3" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.9" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.5" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + system_info: + dependency: "direct main" + description: + name: system_info + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test: + dependency: "direct dev" + description: + name: test + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.17" + test_core: + dependency: transitive + description: + name: test_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.9" + timing: + dependency: transitive + description: + name: timing + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1+2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + validate: + dependency: "direct main" + description: + name: validate + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + vm_service: + dependency: transitive + description: + name: vm_service + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+15" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.3" + where: + dependency: "direct main" + description: + name: where + url: "https://pub.dartlang.org" + source: hosted + version: "6.6.0" + yaml: + dependency: "direct main" + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" +sdks: + dart: ">=2.7.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 419e9a1..787090d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,8 +25,8 @@ dependencies: args: ^1.4.0 yaml: ^2.1.0 path: ^1.0.0 - markdown: ^2.0.0 - mustache: ^1.0.0 + markdown: ^2.1.5 + reflected_mustache: ^1.0.0 intl: ^0.15.0 http_server: ^0.9.0