Skip to content

Commit

Permalink
Add linter to build.
Browse files Browse the repository at this point in the history
Fix linter errors.
  • Loading branch information
dikmax committed Aug 8, 2015
1 parent 405d803 commit f3fceb1
Show file tree
Hide file tree
Showing 16 changed files with 180 additions and 188 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Parsing
import "package:md_proc/md_proc.dart";
void main() {
Document doc = CommonMarkParser.DEFAULT.parse('Hello world!\n===');
Document doc = CommonMarkParser.defaults.parse('Hello world!\n===');
print(doc); // Document [SetextHeader 1 [Str "Hello", Space, Str "world", Str "!"]]
}
```
Expand All @@ -37,8 +37,8 @@ Writing html
import "package:md_proc/md_proc.dart";
void main() {
Document doc = CommonMarkParser.DEFAULT.parse('Hello world!\n===');
String res = HtmlWriter.DEFAULT.write(doc);
Document doc = CommonMarkParser.defaults.parse('Hello world!\n===');
String res = HtmlWriter.defaults.write(doc);
print(res); // <h1>Hello world!</h1>
}
```
Expand All @@ -50,8 +50,8 @@ Writing markdown
import "package:md_proc/md_proc.dart";
void main() {
Document doc = CommonMarkParser.DEFAULT.parse('Hello world!\n===');
String res = MarkdownWriter.DEFAULT.write(doc);
Document doc = CommonMarkParser.defaults.parse('Hello world!\n===');
String res = MarkdownWriter.defaults.write(doc);
print(res); // Hello world!
// ============
}
Expand All @@ -69,8 +69,8 @@ By default smart punctuation is enabled. To disable it use STRICT version of par
import "package:md_proc/md_proc.dart";
void main() {
Document doc = CommonMarkParser.STRICT.parse('...'); // STRICT here
String res = HtmlWriter.STRICT.write(doc); // and here
Document doc = CommonMarkParser.strict.parse('...'); // STRICT here
String res = HtmlWriter.strict.write(doc); // and here
print(res); // <p>...</p>
}
```
Expand Down Expand Up @@ -104,7 +104,7 @@ Target linkResolver(String normalizedReference, String reference) {
CommonMarkParser parser = new CommonMarkParser(new Options(linkResolver: linkResolver));
Document doc = parser.parse('Hello world!\n===');
String res = HtmlWriter.DEFAULT.write(doc);
String res = HtmlWriter.defaults.write(doc);
```

High-level plan for development
Expand Down
36 changes: 18 additions & 18 deletions lib/src/definitions.dart → lib/definitions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Target {

Target(this.link, this.title);

String toString() => 'Target "${link}" ${title == null ? "null" : "\"${title}\""}';
String toString() => 'Target "$link" ${title == null ? "null" : "\"$title\""}';

bool operator== (obj) => obj is Target &&
link == obj.link && title == obj.title;
Expand Down Expand Up @@ -131,8 +131,8 @@ class SetextHeader extends Header {


class FenceType {
static const FenceType BacktickFence = const FenceType._(0, "BacktickFence");
static const FenceType TildeFence = const FenceType._(1, "TildeFence");
static const FenceType backtick = const FenceType._(0, "backtick");
static const FenceType tilde = const FenceType._(1, "tilde");

final int value;
final String name;
Expand Down Expand Up @@ -167,7 +167,7 @@ class IndentedCodeBlock extends CodeBlock {
class FencedCodeBlock extends CodeBlock {
FenceType fenceType;
int fenceSize;
FencedCodeBlock(String contents, {this.fenceType: FenceType.BacktickFence, this.fenceSize: 3, Attr attributes})
FencedCodeBlock(String contents, {this.fenceType: FenceType.backtick, this.fenceSize: 3, Attr attributes})
: super(contents, attributes == null ? new EmptyAttr() : attributes);

String toString() => "FencedCodeBlock $attributes $contents";
Expand Down Expand Up @@ -222,9 +222,9 @@ class ListItem {


class BulletType {
static const BulletType MinusBullet = const BulletType._(0, "MinusBullet", "-");
static const BulletType PlusBullet = const BulletType._(1, "PlusBullet", "+");
static const BulletType StarBullet = const BulletType._(2, "StarBullet", "*");
static const BulletType minus = const BulletType._(0, "minus", "-");
static const BulletType plus = const BulletType._(1, "plus", "+");
static const BulletType star = const BulletType._(2, "star", "*");

final int value;
final String name;
Expand All @@ -236,20 +236,20 @@ class BulletType {
BulletType type;
switch(markerChar) {
case '+':
type = BulletType.PlusBullet;
type = BulletType.plus;
break;

case '-':
type = BulletType.MinusBullet;
type = BulletType.minus;
break;

case '*':
type = BulletType.StarBullet;
type = BulletType.star;
break;

default:
assert(false);
type = BulletType.PlusBullet;
type = BulletType.plus;
}

return type;
Expand All @@ -263,8 +263,8 @@ class BulletType {


class IndexSeparator {
static const IndexSeparator DotSeparator = const IndexSeparator._(0, "DotSeparator", ".");
static const IndexSeparator ParenthesisSeparator = const IndexSeparator._(1, "ParenthesisSeparator", ")");
static const IndexSeparator dot = const IndexSeparator._(0, "dot", ".");
static const IndexSeparator parenthesis = const IndexSeparator._(1, "parenthesis", ")");

final int value;
final String name;
Expand All @@ -276,16 +276,16 @@ class IndexSeparator {
IndexSeparator separator;
switch(indexSeparator) {
case '.':
separator = IndexSeparator.DotSeparator;
separator = IndexSeparator.dot;
break;

case ')':
separator = IndexSeparator.ParenthesisSeparator;
separator = IndexSeparator.parenthesis;
break;

default:
assert(false);
separator = IndexSeparator.DotSeparator;
separator = IndexSeparator.dot;
}

return separator;
Expand All @@ -310,7 +310,7 @@ abstract class ListBlock extends Block {
class UnorderedList extends ListBlock {
BulletType bulletType;

UnorderedList(Iterable<ListItem> items, {this.bulletType: BulletType.MinusBullet, bool tight: false})
UnorderedList(Iterable<ListItem> items, {this.bulletType: BulletType.minus, bool tight: false})
: super(items, tight);

String toString() => "UnorderedList $bulletType $items";
Expand All @@ -327,7 +327,7 @@ class OrderedList extends ListBlock {
int startIndex;

OrderedList(Iterable<ListItem> items, {bool tight: false,
this.indexSeparator: IndexSeparator.DotSeparator, this.startIndex: 1}) : super(items, tight);
this.indexSeparator: IndexSeparator.dot, this.startIndex: 1}) : super(items, tight);

String toString() => "OrderedList start=$startIndex $indexSeparator $items";

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/src/html_writer.dart → lib/html_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,6 @@ class HtmlWriter {
return builder.toString();
}

static HtmlWriter STRICT = new HtmlWriter(Options.STRICT);
static HtmlWriter DEFAULT = new HtmlWriter(Options.DEFAULT);
static HtmlWriter strict = new HtmlWriter(Options.strict);
static HtmlWriter defaults = new HtmlWriter(Options.defaults);
}
Loading

0 comments on commit f3fceb1

Please sign in to comment.