<commit_before># angular-html5

> Change your ng-attributes to data-ng-attributes for HTML5 validation

[![NPM Version](http://img.shields.io/npm/v/angular-html5.svg?style=flat)](https://npmjs.org/package/angular-html5)
[![NPM Downloads](http://img.shields.io/npm/dm/angular-html5.svg?style=flat)](https://npmjs.org/package/angular-html5)
[![Build Status](http://img.shields.io/travis/pgilad/angular-html5.svg?style=flat)](https://travis-ci.org/pgilad/angular-html5)

Ever tried to run an Angular HTML page into w3c validator? Yeah it's a mess.

HTML5 has a preset definition of valid tag elements, and also allows data-attributes.
Angular, being as great as it is, allows you set set custom directives, that don't pass the
w3c validations. Angular default directives come with an option to be named `data-something`.

If you are like me, it isn't fun using `data-ng-include` or `data-ng-switch` and prefer to use the shorter
versions. Using this module, you can easily convert the HTML attributes of Angular (and custom prefixes you want) to
valid HTML5 tags that start with `data-something`.

**Turn this:**
```html
<html ng-app="myApp">
...
<body ng-controller="MainCtrl">
</body>
</html>
```

**Into this:**
```html
<html data-ng-app="myApp">
...
<body data-ng-controller="MainCtrl">
</body>
</html>
```
#### <img src="http://www.w3.org/html/logo/downloads/HTML5_Logo_256.png" alt="HTML5 Valid" width="64" height="64"/>

**angular-html5** looks for `ng-` directives by default and can handle the following cases:
```html
<!-- attribute -->
<ANY ng-directive>
<!-- regular element -->
<ng-directive></ng-directive>
<!-- self closing element -->
<ng-directive />
<!-- custom directive prefix -->
<ui-router></ui-router>
<!-- your name prefix -->
<gilad-cool-loader></gilad-cool-loader>
```

You can add additional prefixes using the option `customPrefixes`.

This plugin plays nice with `type="text/ng-template"` and won't break it.

## Install

Install with [npm](https://npmjs.org/package/angular-html5)

```
npm install --save-dev angular-html5
```

## Usage

```js
var htmlify = require('angular-html5')();

var str = fs.readFileSync('angular.html').toString();

var needsReplace = htmlify.test(str); //--> true if ng-attributes exist in file
if (needsReplace) {
    str = htmlify.replace(str); //--> returns the modified string with transformed attributes
}
```

## Usage in build tools

#### [Gulp](https://github.com/gulpjs/gulp) - See [gulp-angular-htmlify](https://github.com/pgilad/gulp-angular-htmlify)

#### [Grunt](http://gruntjs.com/) - ??
<commit_msg>update with grunt plugin<commit_after># angular-html5

> Change your ng-attributes to data-ng-attributes for HTML5 validation

[![NPM Version](http://img.shields.io/npm/v/angular-html5.svg?style=flat)](https://npmjs.org/package/angular-html5)
[![NPM Downloads](http://img.shields.io/npm/dm/angular-html5.svg?style=flat)](https://npmjs.org/package/angular-html5)
[![Build Status](http://img.shields.io/travis/pgilad/angular-html5.svg?style=flat)](https://travis-ci.org/pgilad/angular-html5)

Ever tried to run an Angular HTML page into w3c validator? Yeah it's a mess.

HTML5 has a preset definition of valid tag elements, and also allows data-attributes.
Angular, being as great as it is, allows you set set custom directives, that don't pass the
w3c validations. Angular default directives come with an option to be named `data-something`.

If you are like me, it isn't fun using `data-ng-include` or `data-ng-switch` and prefer to use the shorter
versions. Using this module, you can easily convert the HTML attributes of Angular (and custom prefixes you want) to
valid HTML5 tags that start with `data-something`.

**Turn this:**
```html
<html ng-app="myApp">
...
<body ng-controller="MainCtrl">
</body>
</html>
```

**Into this:**
```html
<html data-ng-app="myApp">
...
<body data-ng-controller="MainCtrl">
</body>
</html>
```
#### <img src="http://www.w3.org/html/logo/downloads/HTML5_Logo_256.png" alt="HTML5 Valid" width="64" height="64"/>

**angular-html5** looks for `ng-` directives by default and can handle the following cases:
```html
<!-- attribute -->
<ANY ng-directive>
<!-- regular element -->
<ng-directive></ng-directive>
<!-- self closing element -->
<ng-directive />
<!-- custom directive prefix -->
<ui-router></ui-router>
<!-- your name prefix -->
<gilad-cool-loader></gilad-cool-loader>
```

You can add additional prefixes using the option `customPrefixes`.

This plugin plays nice with `type="text/ng-template"` and won't break it.

## Install

Install with [npm](https://npmjs.org/package/angular-html5)

```
npm install --save-dev angular-html5
```

## Usage

```js
var htmlify = require('angular-html5')();

var str = fs.readFileSync('angular.html').toString();

var needsReplace = htmlify.test(str); //--> true if ng-attributes exist in file
if (needsReplace) {
    str = htmlify.replace(str); //--> returns the modified string with transformed attributes
}
```

## Usage in build tools

#### [Gulp](https://github.com/gulpjs/gulp) - See [gulp-angular-htmlify](https://github.com/pgilad/gulp-angular-htmlify)

#### [Grunt](http://gruntjs.com/) - See [grunt-angular-htmlify](https://github.com/pgilad/grunt-angular-htmlify)

{'fraction_non_alphanumeric': 0.16969929132350126, 'fraction_numerical': 0.00995977782034093, 'mean_word_length': 4.450939457202505, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 53, 'https://': 13, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '38677', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1671, 'n_words': 479}