typohero 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff8d499ae2977dcbc2c7c6bbf0a581740c376d7c
4
- data.tar.gz: b7603831d86dd6bfaea59d8ac2e023af3c908f47
3
+ metadata.gz: 6e1601fa507395ff5380983659eb920e745028be
4
+ data.tar.gz: 9d4b8a981513c84ed843cdacc24956839ca18959
5
5
  SHA512:
6
- metadata.gz: 3893749dd178a09eb301d4df37424231096cd3a40803d09f76bbc7a55f8c7f26d77c99470c8b0c35089a58b84a417be40f0c4367daf94e0f18048df175c9b27b
7
- data.tar.gz: 618e3119d1f16e60e1a25a5f4e22946d5398f7ad52ff7712af112149ff05126c66d6cc1e12b1b05d8559d8ce1ca41c7e6eda5c61712b9b6f24276d30eb4ef608
6
+ metadata.gz: bcb638d198532592fafe7dede571f585c70d430b64a2a5814bcddadddda4955943c3db9f83caf216b4bfcb692d9c0c1109098b00c9085138c24de773e3d97b8a
7
+ data.tar.gz: c1e3e1f076b1cf66c12c6263de789c2d0ab755a020f436fb5b282205aab1773f6832f98ce8bea8541f0f6f90be15533f301b13e06b418f40a290d1c60b8d69a4
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ Gemfile.lock
7
7
  .yardoc
8
8
  coverage
9
9
  pkg
10
+ .#*
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
3
4
  - 2.0.0
4
5
  - 2.1.0
5
6
  - ruby-head
data/README.md CHANGED
@@ -1,26 +1,35 @@
1
1
  # TypoHero
2
2
 
3
- TypoHero enhances your typography. There are no options, there is no documentation.
3
+ TypoHero has come to enhance your typography. There are no options, there is no documentation. He knows what you need.
4
4
 
5
5
  ~~~ ruby
6
6
  require 'typohero'
7
7
  TypoHero.enhance('Some text...')
8
+ TypoHero.truncate('Long text with tags...', max_words_or_separator)
9
+ TypoHero.strip_tags('Text with tags...')
8
10
  ~~~
9
11
 
10
12
  ![](https://raw.github.com/minad/typohero/master/hero.jpg)
11
13
 
12
14
  ## Features
13
15
 
14
- * Special character treatment for quotes, dashes and ellipsis
15
- * Widon't with Unicode non-breaking space
16
- * Skips special tags like `<script>`
17
- * Styling enhancements
18
- * Captial letters are wrapped in `<span class="caps">`
19
- * Initial quotes are wrapped in `<span class="quo">`
20
- * Ampersands are wrapped in `<span class="amp">`
21
- * LaTeX support
22
- * Some LaTeX commands are replaced by their Unicode counterpart
23
- * Mathjax code is skipped
16
+ * `TypoHero.enhance` - Typography enhancer
17
+ * Special character treatment for quotes, dashes and ellipsis
18
+ * Widon't with Unicode non-breaking space
19
+ * Skips special tags like `<script>`
20
+ * Styling enhancements
21
+ * Captial letters are wrapped in `<span class="caps">`
22
+ * Initial quotes are wrapped in `<span class="quo">`
23
+ * Ampersands are wrapped in `<span class="amp">`
24
+ * Ordinals are wrapped in `<span class="ord">`
25
+ * Hyphenated words are wrapped in `<span class="nobr">`
26
+ * LaTeX support
27
+ * Some LaTeX commands are replaced by their Unicode counterpart
28
+ * Mathjax code is skipped
29
+ * `TypoHero.truncate` - Truncate which ensures that all tags are closed correctly
30
+ * Supports maximum number of words and/or separator `String`/`Regexp`
31
+ * `TypoHero.strip_tags` - Strip tags from content, keep only text
32
+ * All methods keeps the string `html_safe?`
24
33
 
25
34
  ## Why?
26
35
 
@@ -38,6 +47,22 @@ But why not improve the existing libraries?
38
47
  * Typogrify is Python
39
48
  * Fast-Aleck is C, but I don't want to use C since Ruby is already a perfect text processing language!
40
49
 
50
+ ## Similar libraries
51
+
52
+ [Smartypants (Perl)](http://daringfireball.net/projects/smartypants/),
53
+ [Typogrify (Python)](https://github.com/mintchaos/typogrify),
54
+ [Typography-Helper (Ruby)](https://code.google.com/p/typography-helper/),
55
+ [RubyPants (Ruby)](http://chneukirchen.org/repos/rubypants/),
56
+ [Tyogruby (Ruby)](http://avdgaag.github.io/typogruby/),
57
+ [Typography (Ruby)](https://github.com/fxposter/typography),
58
+ [Typographer (Ruby)](https://github.com/Slotos/typographer),
59
+ [Typogrify (Ruby)](http://rubygems.org/gems/typogrify),
60
+ [Typogrowth (Ruby)](https://github.com/mudasobwa/typogrowth),
61
+ [Typogr.js (Javascript)](https://github.com/ekalinin/typogr.js/blob/master/typogr.js),
62
+ [Richtypo.js (Javascript)](https://github.com/sapegin/richtypo.js),
63
+ [List of javascript typography libraries](https://github.com/yumyo/js-type-master)
64
+ ...
65
+
41
66
  ## License
42
67
 
43
68
  ~~~
data/latex.pl CHANGED
@@ -5,12 +5,19 @@ my %WORDMAC = ( %WORDMACROS, %WORDMACROSEXTRA, %PUNCTUATION, %SYMBOLS,
5
5
  %GREEK );
6
6
 
7
7
  print "module TypoHero\n LATEX = {\n";
8
- foreach (keys(%WORDMAC)) {
8
+ foreach (sort(keys(%WORDMAC))) {
9
+ # Hack: Don't distinguish variants
10
+ if (/^var/) {
11
+ my $x = $';
12
+ my $v = sprintf('\\u%04x', ord($WORDMAC{$_}));
13
+ print " '\\$x' => \"$v\",\n";
14
+ }
9
15
  my $v = sprintf('\\u%04x', ord($WORDMAC{$_}));
10
- print " '\\\\$_' => \"$v\",\n";
16
+ print " '\\$_' => \"$v\",\n";
11
17
  }
12
- foreach (keys(%NEGATEDSYMBOLS)) {
18
+ foreach (sort(keys(%NEGATEDSYMBOLS))) {
13
19
  my $v = sprintf('\\u%04x', ord($NEGATEDSYMBOLS{$_}));
14
- print " '\\\\not\\\\$_' => \"$v\",\n";
20
+ print " '\\not\\$_' => \"$v\",\n";
15
21
  }
22
+
16
23
  print " }\nend\n";