I still plan to go on vacation in April. I will be spending a week in Berlin. I am putting a lot more effort into learning German in order to prepare for my trip. I have been studying German for over a year, but not very intensely. I have created a custom help file for my notes on the German language. Many of the pages in this help file are HTML tables of vocabulary lists with the German and English words in columns. As I add words and rows to the list, the alphabetical order may be lost. Fortunately there is a plugin for jQuery which allows you to sort a HTML table in alphabetical order. I have been using the tablesorter plugin to sort my tables without a page refresh or server side code.
The only problem with that solution is the definite articles. I usually include the definite article before the nouns because you need to know the gender of a German noun. For example, Katze is a feminine noun so I place it in the Deutsch table column as die Katze so I will remember the noun’s gender. Unfortunately, that causes Katze to appear below every other masculine and neuter noun. A neuter noun requires the definite article das which comes before die when sorted in alphabetical order. So das Schwein (the pig) appears before die Katze (the cat) even though K words should be listed before S words. I could have solved this problem by placing the definite article after the word: Katze, die but that looks awkward. What I really wanted was to sort the column based on the second word.
Fortunately, you can create a custom parser for the tablesorter plugin which sorts the column based on the logic you provide in your code. I was able to write a custom parser that replaces the definite and indefinite articles in the table cell with empty strings so they do not affect the sort order. I can add to my logic to handle additional requirements like disregarding possessive pronouns when sorting the column, mein Vater.