Notes
- In v2.17.8, added a new option
ignoreArticlesExcept
option which allows ignoring a set pattern. - This parser can not be applied to the original plugin.
Setup
- Set the language (French shown below; English is set by default) to use by adding any of the following (they all do the same thing), set in order of priority (v2.8.2):
- jQuery data
data-ignore-articles="fr"
. - metadata
class="{ ignoreArticles : 'fr' }"
. This requires the metadata plugin. - headers option
headers : { 0 : { ignoreArticles : 'fr' } }
. - header class name
class="ignoreArticles-fr"
.
- jQuery data
- In v2.17.8, you can set up a string to ignore, e.g. keep a title intact like "A to Z", as follows:
- jQuery data
data-ignore-articles-except="a to"
. - metadata
class="{ ignoreArticlesExcept : 'a to' }"
. This requires the metadata plugin. - headers option
headers : { 0 : { ignoreArticlesExcept : 'a to' } }
.
- jQuery data
- To add more than one title to ignore, separate them using a vertical bar (shift+\)
headers: { 0: { ignoreArticles : 'en', // no special parsing for titles like "A to Z" or "A B C" or "A One" ignoreArticlesExcept : 'a to|a b |a one' } }
Note If your title needs a space (e.g. "A B C") make sure it isn't at the end of theignoreArticlesExcept
string; spaces on either end get stripped away.
Customizing
- To add a custom language to the parser, use the following code:
$.extend( $.tablesorter.ignoreArticles, { "xx" : "a, l'_, de la" }); $('table').tablesorter({ headers: { 2: { sorter: 'ignoreArticles', ignoreArticles : 'xx', ignoreArticlesExcept : 'a to' } } });
- where
xx
is theignoreArticles
id (abbreviation for the language) - Each leading article must be separated by a comma and will be case-insensitive.
- Leading articles will only be removed if they are followed by a space; spaces are automatically included when parsed unless the article definition is followed by an underscore. See the
l'_
note below. a
is an example of a leading article which will be removed. So, "A Fistfull of Dollars" will only parse "Fistfull of Dollars" and will sort with the other words that start with an "F".l'_
includes an underscore (_
); this tells the parser to not add a space after the word. So a title like "l'enfant" will parse as "enfant".de la
is an example showing that the parser can remove a multiple-word article.
- where
- Some languages have been included by default. The information below was obtained from this wikipedia page, so if you discover any errors, or if you want to contribute another language, please open an issue.
$.tablesorter.ignoreArticles = { "en" : "the, a, an", "de" : "der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen", "nl" : "de, het, de, een", "es" : "el, la, lo, los, las, un, una, unos, unas", "pt" : "o, a, os, as, um, uma, uns, umas", "fr" : "le, la, l'_, les, un, une, des", "it" : "il, lo, la, l'_, i, gli, le, un', uno, una, un", "hu" : "a, az, egy" };
Demo
IMDB top 250 movies (3/27/2013)
Rank | Rating | Title | Votes |
1. | 9.2 | The Shawshank Redemption (1994) | 941,067 |
2. | 9.2 | The Godfather (1972) | 673,484 |
3. | 9.0 | The Godfather: Part II (1974) | 434,176 |
4. | 8.9 | Pulp Fiction (1994) | 732,799 |
5. | 8.9 | The Good, the Bad and the Ugly (1966) | 286,482 |
6. | 8.9 | 12 Angry Men (1957) | 231,572 |
7. | 8.9 | The Dark Knight (2008) | 917,028 |
8. | 8.9 | Schindler's List (1993) | 483,623 |
9. | 8.8 | The Lord of the Rings: The Return of the King (2003) | 672,581 |
10. | 8.8 | Fight Club (1999) | 716,995 |
11. | 8.8 | Star Wars: Episode V - The Empire Strikes Back (1980) | 462,561 |
12. | 8.8 | The Lord of the Rings: The Fellowship of the Ring (2001) | 697,724 |
13. | 8.8 | One Flew Over the Cuckoo's Nest (1975) | 393,499 |
14. | 8.7 | Inception (2010) | 732,630 |
15. | 8.7 | Goodfellas (1990) | 411,044 |
16. | 8.7 | Star Wars (1977) | 518,660 |
17. | 8.7 | Seven Samurai (1954) | 146,754 |
18. | 8.7 | Forrest Gump (1994) | 617,489 |
19. | 8.7 | The Matrix (1999) | 679,951 |
20. | 8.7 | The Lord of the Rings: The Two Towers (2002) | 603,969 |
21. | 8.7 | City of God (2002) | 308,820 |
22. | 8.6 | Se7en (1995) | 547,794 |
23. | 8.6 | The Silence of the Lambs (1991) | 459,251 |
24. | 8.6 | Once Upon a Time in the West (1968) | 129,773 |
25. | 8.6 | Casablanca (1942) | 252,435 |
26. | 8.6 | The Usual Suspects (1995) | 431,028 |
27. | 8.6 | Raiders of the Lost Ark (1981) | 394,043 |
28. | 8.6 | Rear Window (1954) | 190,219 |
29. | 8.6 | It's a Wonderful Life (1946) | 163,164 |
30. | 8.6 | Psycho (1960) | 239,467 |
31. | 8.6 | Léon: The Professional (1994) | 399,997 |
32. | 8.5 | Sunset Blvd. (1950) | 85,756 |
33. | 8.5 | American History X (1998) | 433,917 |
34. | 8.5 | Memento (2000) | 495,175 |
35. | 8.5 | Apocalypse Now (1979) | 276,646 |
36. | 8.5 | Terminator 2: Judgment Day (1991) | 425,770 |
37. | 8.5 | Saving Private Ryan (1998) | 482,123 |
38. | 8.5 | Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1964) | 226,703 |
39. | 8.5 | City Lights (1931) | 54,820 |
40. | 8.5 | Alien (1979) | 319,629 |
41. | 8.5 | Django Unchained (2012) | 263,202 |
42. | 8.5 | North by Northwest (1959) | 139,339 |
43. | 8.5 | Spirited Away (2001) | 211,121 |
44. | 8.5 | Modern Times (1936) | 69,431 |
45. | 8.5 | Citizen Kane (1941) | 197,473 |
46. | 8.5 | The Dark Knight Rises (2012) | 568,024 |
47. | 8.5 | The Shining (1980) | 333,295 |
48. | 8.5 | Back to the Future (1985) | 377,606 |
49. | 8.4 | The Pianist (2002) | 260,234 |
50. | 8.4 | The Departed (2006) | 478,100 |
51. | 8.4 | Life Is Beautiful (1997) | 206,585 |
52. | 8.4 | M (1931) | 62,112 |
53. | 8.4 | Vertigo (1958) | 145,330 |
54. | 8.4 | American Beauty (1999) | 495,829 |
55. | 8.4 | Paths of Glory (1957) | 70,416 |
56. | 8.4 | Taxi Driver (1976) | 285,135 |
57. | 8.4 | Double Indemnity (1944) | 59,206 |
58. | 8.4 | Aliens (1986) | 289,891 |
59. | 8.4 | Toy Story 3 (2010) | 277,784 |
60. | 8.4 | WALL·E (2008) | 376,223 |
61. | 8.4 | The Lives of Others (2006) | 147,553 |
62. | 8.4 | Gladiator (2000) | 528,198 |
63. | 8.4 | The Green Mile (1999) | 390,685 |
64. | 8.4 | The Intouchables (2011) | 164,584 |
65. | 8.4 | A Clockwork Orange (1971) | 318,549 |
66. | 8.4 | Amélie (2001) | 314,747 |
67. | 8.4 | The Great Dictator (1940) | 68,287 |
68. | 8.4 | The Prestige (2006) | 432,239 |
69. | 8.4 | Lawrence of Arabia (1962) | 117,981 |
70. | 8.4 | To Kill a Mockingbird (1962) | 128,498 |
71. | 8.4 | Reservoir Dogs (1992) | 369,352 |
72. | 8.4 | Das Boot (1981) | 106,465 |
73. | 8.4 | The Third Man (1949) | 73,465 |
74. | 8.4 | Requiem for a Dream (2000) | 336,877 |
75. | 8.3 | Cinema Paradiso (1988) | 81,418 |
76. | 8.3 | The Treasure of the Sierra Madre (1948) | 49,807 |
77. | 8.3 | Eternal Sunshine of the Spotless Mind (2004) | 389,500 |
78. | 8.3 | The Lion King (1994) | 313,388 |
79. | 8.3 | Once Upon a Time in America (1984) | 129,414 |
80. | 8.3 | Star Wars: Episode VI - Return of the Jedi (1983) | 361,397 |
81. | 8.3 | Full Metal Jacket (1987) | 270,902 |
82. | 8.3 | L.A. Confidential (1997) | 264,295 |
83. | 8.3 | Chinatown (1974) | 130,976 |
84. | 8.3 | Braveheart (1995) | 426,632 |
85. | 8.3 | Oldboy (2003) | 189,333 |
86. | 8.3 | Monty Python and the Holy Grail (1975) | 239,427 |
87. | 8.3 | Singin' in the Rain (1952) | 89,152 |
88. | 8.3 | Some Like It Hot (1959) | 107,775 |
89. | 8.3 | Metropolis (1927) | 66,774 |
90. | 8.3 | Amadeus (1984) | 162,968 |
91. | 8.3 | Bicycle Thieves (1948) | 50,266 |
92. | 8.3 | Rashomon (1950) | 61,981 |
93. | 8.3 | 2001: A Space Odyssey (1968) | 246,317 |
94. | 8.3 | All About Eve (1950) | 51,722 |
95. | 8.3 | Unforgiven (1992) | 169,421 |
96. | 8.3 | The Sting (1973) | 104,985 |
97. | 8.3 | Indiana Jones and the Last Crusade (1989) | 298,740 |
98. | 8.3 | The Apartment (1960) | 62,712 |
99. | 8.3 | Raging Bull (1980) | 144,339 |
100. | 8.3 | The Bridge on the River Kwai (1957) | 92,073 |
101. | 8.3 | Witness for the Prosecution (1957) | 31,562 |
102. | 8.3 | Grave of the Fireflies (1988) | 65,417 |
103. | 8.3 | Die Hard (1988) | 349,451 |
104. | 8.3 | Batman Begins (2005) | 535,306 |
105. | 8.3 | A Separation (2011) | 79,685 |
106. | 8.3 | Yojimbo (1961) | 44,988 |
107. | 8.3 | Snatch. (2000) | 344,587 |
108. | 8.3 | Inglourious Basterds (2009) | 436,200 |
109. | 8.3 | For a Few Dollars More (1965) | 83,738 |
110. | 8.3 | Downfall (2004) | 149,623 |
111. | 8.3 | Pan's Labyrinth (2006) | 277,965 |
112. | 8.2 | The Great Escape (1963) | 98,813 |
113. | 8.2 | Mr. Smith Goes to Washington (1939) | 49,357 |
114. | 8.2 | Up (2009) | 319,413 |
115. | 8.2 | On the Waterfront (1954) | 62,092 |
116. | 8.2 | Toy Story (1995) | 319,895 |
117. | 8.2 | The Elephant Man (1980) | 98,958 |
118. | 8.2 | The Seventh Seal (1957) | 66,074 |
119. | 8.2 | Heat (1995) | 261,142 |
120. | 8.2 | The General (1926) | 31,115 |
121. | 8.2 | The Maltese Falcon (1941) | 73,450 |
122. | 8.2 | Blade Runner (1982) | 293,867 |
123. | 8.2 | Gran Torino (2008) | 316,184 |
124. | 8.2 | Rebecca (1940) | 54,605 |
125. | 8.2 | The Kid (1921) | 30,188 |
126. | 8.2 | Wild Strawberries (1957) | 36,922 |
127. | 8.2 | Scarface (1983) | 301,908 |
128. | 8.2 | Fargo (1996) | 256,474 |
129. | 8.2 | The Big Lebowski (1998) | 308,325 |
130. | 8.2 | Touch of Evil (1958) | 47,592 |
131. | 8.2 | Ran (1985) | 50,064 |
132. | 8.2 | The Deer Hunter (1978) | 145,262 |
133. | 8.2 | Cool Hand Luke (1967) | 75,625 |
134. | 8.2 | The Gold Rush (1925) | 36,715 |
135. | 8.1 | Lock, Stock and Two Smoking Barrels (1998) | 244,635 |
136. | 8.1 | Sin City (2005) | 415,871 |
137. | 8.1 | No Country for Old Men (2007) | 353,912 |
138. | 8.1 | It Happened One Night (1934) | 38,738 |
139. | 8.1 | Strangers on a Train (1951) | 56,857 |
140. | 8.1 | The Avengers (2012) | 475,869 |
141. | 8.1 | Jaws (1975) | 236,363 |
142. | 8.1 | The Sixth Sense (1999) | 422,262 |
143. | 8.1 | Platoon (1986) | 180,937 |
144. | 8.1 | Casino (1995) | 192,252 |
145. | 8.1 | The Thing (1982) | 155,679 |
146. | 8.1 | Trainspotting (1996) | 273,789 |
147. | 8.1 | High Noon (1952) | 51,097 |
148. | 8.1 | Butch Cassidy and the Sundance Kid (1969) | 91,992 |
149. | 8.1 | The Wizard of Oz (1939) | 169,985 |
150. | 8.1 | Hotel Rwanda (2004) | 161,201 |
151. | 8.1 | Kill Bill: Vol. 1 (2003) | 419,696 |
152. | 8.1 | Good Will Hunting (1997) | 312,846 |
153. | 8.1 | Warrior (2011) | 159,949 |
154. | 8.1 | The Secret in Their Eyes (2009) | 63,447 |
155. | 8.1 | Annie Hall (1977) | 112,605 |
156. | 8.1 | Gone with the Wind (1939) | 133,071 |
157. | 8.1 | Notorious (1946) | 47,266 |
158. | 8.1 | The Grapes of Wrath (1940) | 37,590 |
159. | 8.1 | Into the Wild (2007) | 226,286 |
160. | 8.1 | My Neighbor Totoro (1988) | 74,354 |
161. | 8.1 | V for Vendetta (2005) | 445,345 |
162. | 8.1 | Life of Brian (1979) | 163,492 |
163. | 8.1 | Finding Nemo (2003) | 351,617 |
164. | 8.1 | How to Train Your Dragon (2010) | 207,521 |
165. | 8.1 | Dial M for Murder (1954) | 57,132 |
166. | 8.1 | The King's Speech (2010) | 247,037 |
167. | 8.1 | There Will Be Blood (2007) | 224,943 |
168. | 8.1 | Ben-Hur (1959) | 95,091 |
169. | 8.1 | The Terminator (1984) | 334,304 |
170. | 8.1 | The Big Sleep (1946) | 42,449 |
171. | 8.1 | Network (1976) | 61,922 |
172. | 8.1 | The Night of the Hunter (1955) | 39,940 |
173. | 8.1 | Million Dollar Baby (2004) | 267,944 |
174. | 8.1 | Stand by Me (1986) | 159,982 |
175. | 8.1 | Groundhog Day (1993) | 250,675 |
176. | 8.1 | Donnie Darko (2001) | 358,003 |
177. | 8.1 | The Hobbit: An Unexpected Journey (2012) | 260,350 |
178. | 8.1 | Twelve Monkeys (1995) | 282,004 |
179. | 8.1 | Dog Day Afternoon (1975) | 111,658 |
180. | 8.1 | Black Swan (2010) | 325,866 |
181. | 8.1 | Amores Perros (2000) | 108,303 |
182. | 8.1 | The 400 Blows (1959) | 40,671 |
183. | 8.1 | Mary and Max (2009) | 57,268 |
184. | 8.1 | The Bourne Ultimatum (2007) | 285,964 |
185. | 8.1 | Life of Pi (2012) | 156,722 |
186. | 8.1 | Gandhi (1982) | 96,275 |
187. | 8.1 | Persona (1966) | 31,689 |
188. | 8.0 | Howl's Moving Castle (2004) | 104,225 |
189. | 8.0 | The Killing (1956) | 39,702 |
190. | 8.0 | The Graduate (1967) | 133,213 |
191. | 8.0 | The Princess Bride (1987) | 186,593 |
192. | 8.0 | A Beautiful Mind (2001) | 296,347 |
193. | 8.0 | 8½ (1963) | 48,845 |
194. | 8.0 | Slumdog Millionaire (2008) | 373,963 |
195. | 8.0 | The Hustler (1961) | 38,935 |
196. | 8.0 | Who's Afraid of Virginia Woolf? (1966) | 33,649 |
197. | 8.0 | La strada (1954) | 28,752 |
198. | 8.0 | Rocky (1976) | 193,474 |
199. | 8.0 | The Manchurian Candidate (1962) | 48,813 |
200. | 8.0 | Anatomy of a Murder (1959) | 28,092 |
201. | 8.0 | The Artist (2011/I) | 113,331 |
202. | 8.0 | The Wild Bunch (1969) | 46,187 |
203. | 8.0 | The Exorcist (1973) | 188,999 |
204. | 8.0 | Stalag 17 (1953) | 30,022 |
205. | 8.0 | Rope (1948) | 57,554 |
206. | 8.0 | The Man Who Shot Liberty Valance (1962) | 35,292 |
207. | 8.0 | Barry Lyndon (1975) | 62,239 |
208. | 8.0 | Sleuth (1972) | 26,820 |
209. | 8.0 | Stalker (1979) | 38,428 |
210. | 8.0 | Infernal Affairs (2002) | 57,096 |
211. | 8.0 | In the Name of the Father (1993) | 54,640 |
212. | 8.0 | The Truman Show (1998) | 345,615 |
213. | 8.0 | Roman Holiday (1953) | 55,590 |
214. | 8.0 | Memories of Murder (2003) | 27,373 |
215. | 8.0 | Pirates of the Caribbean: The Curse of the Black Pearl (2003) | 457,277 |
216. | 8.0 | District 9 (2009) | 332,916 |
217. | 8.0 | Monsters, Inc. (2001) | 277,654 |
218. | 8.0 | A Fistful of Dollars (1964) | 71,024 |
219. | 8.0 | Ip Man (2008) | 70,724 |
220. | 8.0 | The Diving Bell and the Butterfly (2007) | 61,322 |
221. | 8.0 | Ratatouille (2007) | 274,240 |
222. | 8.0 | Harry Potter and the Deathly Hallows: Part 2 (2011) | 257,398 |
223. | 8.0 | Star Trek (2009) | 291,734 |
224. | 8.0 | A Streetcar Named Desire (1951) | 54,316 |
225. | 8.0 | The Perks of Being a Wallflower (2012) | 98,357 |
226. | 8.0 | La Haine (1995) | 54,972 |
227. | 8.0 | Beauty and the Beast (1991) | 163,508 |
228. | 8.0 | Shutter Island (2010) | 370,474 |
229. | 8.0 | 3 Idiots (2009) | 63,883 |
230. | 8.0 | All Quiet on the Western Front (1930) | 34,318 |
231. | 8.0 | Rosemary's Baby (1968) | 91,657 |
232. | 8.0 | Nausicaä of the Valley of the Wind (1984) | 45,761 |
233. | 8.0 | Rain Man (1988) | 235,025 |
234. | 8.0 | Harvey (1950) | 33,525 |
235. | 8.0 | Incendies (2010) | 29,047 |
236. | 8.0 | Like Stars on Earth (2007) | 28,610 |
237. | 8.0 | Mystic River (2003) | 225,582 |
238. | 8.0 | Jurassic Park (1993) | 290,452 |
239. | 8.0 | Manhattan (1979) | 68,578 |
240. | 8.0 | Papillon (1973) | 53,163 |
241. | 8.0 | Spring, Summer, Fall, Winter... and Spring (2003) | 36,974 |
242. | 8.0 | The Wrestler (2008) | 187,480 |
243. | 8.0 | Nosferatu (1922) | 47,665 |
244. | 8.0 | The Help (2011) | 150,081 |
245. | 8.0 | In the Mood for Love (2000) | 43,683 |
246. | 8.0 | Big Fish (2003) | 253,904 |
247. | 7.9 | The Untouchables (1987) | 146,540 |
248. | 7.9 | Arsenic and Old Lace (1944) | 41,392 |
249. | 7.9 | Castle in the Sky (1986) | 47,537 |
250. | 7.9 | Rio Bravo (1959) | 29,442 |
Page Header
<!-- tablesorter --> <link rel="stylesheet" href="../css/theme.blue.css"> <script src="../js/jquery.tablesorter.js"></script> <!-- load ignore-articles parser --> <script src="../js/parsers/parser-ignore-articles.js"></script> <script> $(function() { $('table').tablesorter({ theme: 'blue', widgets: ['zebra'], sortList: [[2, 0]], headers: { 2: { sorter: 'ignoreArticles', ignoreArticles : 'fr', ignoreArticlesExcept : '' } } }); }); </script>