<commit_before>[![](https://jitpack.io/v/neworld/spanner.svg)](https://jitpack.io/#neworld/spanner)

This lib provides simple and fluent API for creating [Android Spannable](https://developer.android.com/reference/android/text/Spannable.html).
Features:
- Simple and fluent API
- Helpers to create spans
- Small method footprint (<100 methods, 6kb AAR package)

This library focuses on building spannable. 
If you prefer put full text first and then apply spans, take a look at [another awesome library](https://github.com/jaychang0917/SimpleText)

#### Examples:

```java
Spannable spannable = new Spanner()
        .append("Original text\n\n")
        .append("big\n", Spans.sizePX(100))
        .append("big in DP\n", sizeDP(30))
        .append("50% of original size\n", scaleSize(0.5f))
        .append("bold\n", bold())
        .append("italic\n", italic())
        .append("bold and italic\n", boldItalic())
        .append("custom typeface\n", font("sans-serif-black"))
        .append("strike through\n", strikeThrough())
        .append("underline\n", underline())
        .append("background\n", background(Color.YELLOW))
        .append("foreground\n", foreground(Color.RED))
        .append("subscript\n", subscript())
        .append("superscript\n", superscript())
        .append(" \n", image(getResources().getDrawable(R.drawable.ic_android_16dp)))
        .append("quite\n", quote())
        .append("The quick brown fox jumps over the lazy dog\n", bold(), foreground(0xFF904f1c), quote())
        ;
```

```java
Spannable spannable = new Spanner("The quick brown fox jumps over the lazy dog")
        .replace("dog", "cat", strikeThrough() /* any number of spans */)
        .insert(5, "foo", bold(), italic() /* any number of spans */)
        .append("bar", underline() /* any number of spans */);
```
#### How to use
```
    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
	
    dependencies {
        compile 'com.github.neworld:spanner:0.1'
    }
```

#### License

```
Copyright 2017 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```<commit_msg>Fix dependency example<commit_after>[![](https://jitpack.io/v/neworld/spanner.svg)](https://jitpack.io/#neworld/spanner)

This lib provides simple and fluent API for creating [Android Spannable](https://developer.android.com/reference/android/text/Spannable.html).
Features:
- Simple and fluent API
- Helpers to create spans
- Small method footprint (<100 methods, 6kb AAR package)

This library focuses on building spannable. 
If you prefer put full text first and then apply spans, take a look at [another awesome library](https://github.com/jaychang0917/SimpleText)

#### Examples:

```java
Spannable spannable = new Spanner()
        .append("Original text\n\n")
        .append("big\n", Spans.sizePX(100))
        .append("big in DP\n", sizeDP(30))
        .append("50% of original size\n", scaleSize(0.5f))
        .append("bold\n", bold())
        .append("italic\n", italic())
        .append("bold and italic\n", boldItalic())
        .append("custom typeface\n", font("sans-serif-black"))
        .append("strike through\n", strikeThrough())
        .append("underline\n", underline())
        .append("background\n", background(Color.YELLOW))
        .append("foreground\n", foreground(Color.RED))
        .append("subscript\n", subscript())
        .append("superscript\n", superscript())
        .append(" \n", image(getResources().getDrawable(R.drawable.ic_android_16dp)))
        .append("quite\n", quote())
        .append("The quick brown fox jumps over the lazy dog\n", bold(), foreground(0xFF904f1c), quote())
        ;
```

```java
Spannable spannable = new Spanner("The quick brown fox jumps over the lazy dog")
        .replace("dog", "cat", strikeThrough() /* any number of spans */)
        .insert(5, "foo", bold(), italic() /* any number of spans */)
        .append("bar", underline() /* any number of spans */);
```
#### How to use
```
    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
	
    dependencies {
        compile 'com.github.neworld:spanner:v0.1'
    }
```

#### License

```
Copyright 2017 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
{'fraction_non_alphanumeric': 0.14269406392694065, 'fraction_numerical': 0.013318112633181126, 'mean_word_length': 3.2157177225340816, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5658631', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1523, 'n_words': 482}