xing/wysihtml5 — pull request #152 by Mipme (2012-07-17 21:37:18+00:00)
Title: additional parsing option, conditional parsing and callbacks for attribute checking

Added support for "extract" tag parser option:

consider following case:
```

some text

```
parser rule
```
"div": "extract"
```
gives you
```

some text

```

Added support for conditions on parser options:

```

text A

text B

```
parser rule
```
"div": {
"extract": {
"if": {
"class": "^dontlike$"
}
}
}
```
result:
```

text A

text B

```

and finally callbacks for attribute checking:

```
"a": {
"check_attributes": {
"rel": { "func": "checkLinkRelation" }
}
}
```

```
function checkLinkRelation(attr, node) {
var l = node.getAttribute('href');
var p = new RegExp('^((ht|f)tps?:\/\/)');
if (l.match(p)) { return 'nofollow'; }
return false;
}
```

So if link text gets pasted or link set, then no rel-attribute is set.
On the other hand inserting to Goggles results in: rel="nofollow"

Oh, yes - and for convenience reasons, i sorted the advanced tag roles...