Last active
October 7, 2015 08:28
-
-
Save ysakmrkm/3134999 to your computer and use it in GitHub Desktop.
Dummy text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @function dummytext($length:0,$lang:'ja'){ | |
| $base:''; | |
| @if $lang == 'ja' { | |
| $base:こ こ に 文 章 が 入 り ま す 。; | |
| } @else if $lang == 'en' { | |
| $base:t h i s \ i s \ d u m m y \ t e x t \.; | |
| } | |
| $text:''; | |
| $num:floor($length / length($base)); | |
| $rest:$length % length($base); | |
| @if $length <= length($base){ | |
| @for $i from 1 through $length { | |
| @if nth($base,$i) == '\ ' { | |
| $text:$text+' '; | |
| } @else if nth($base,$i) == '\.' { | |
| $text:$text+'.'; | |
| } @else if nth($base,$i) == '\,' { | |
| $text:$text+','; | |
| } @else { | |
| $text:$text+nth($base,$i); | |
| } | |
| } | |
| } @else { | |
| @for $i from 1 through $num { | |
| @for $j from 1 through length($base) { | |
| @if nth($base,$j) == '\ ' { | |
| $text:$text+' '; | |
| } @else if nth($base,$j) == '\.' { | |
| $text:$text+'.'; | |
| } @else if nth($base,$j) == '\,' { | |
| $text:$text+','; | |
| } @else { | |
| $text:$text+nth($base,$j); | |
| } | |
| } | |
| } | |
| @if $rest != 0 { | |
| @for $k from 1 through $rest { | |
| @if nth($base,$k) == '\ ' { | |
| $text:$text+' '; | |
| } @else if nth($base,$k) == '\.' { | |
| $text:$text+'.'; | |
| } @else if nth($base,$k) == '\,' { | |
| $text:$text+','; | |
| } @else { | |
| $text:$text+nth($base,$k); | |
| } | |
| } | |
| } | |
| } | |
| @return $text; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment