On Sun, Nov 01, 2020 at 02:45:28AM EST, Tekki wrote:
Now let's take this one step further.
What I am really trying to do is get rid of this file and do the
processing in-core using a vim dictionary.
In other words I have iterated over my source buffers and created a temp
file that contains key/value pairs that will serve as the basis for my
HTML index.
Now instead of this temp file that (as a reminder) contains something
like:
| Ï
| O
| E
| A
| É
| Æ
| I
| Œ
I create a vim dictionary that contains the same data:
| :let g:dict
| {'A': ' ', 'E': ' ', 'Æ': ' ', 'É': ' ', 'I': ' ', 'Œ': ' ', 'Ï': ' ', 'O': ' '}
I know I can loop over the contents of the dictionary like so:
| :for l in items(g:dict)
| : let l
| : endfor
handing me back the (unsorted) output:
| l ['A', ' ']
| l ['E', ' ']
| l ['Æ', ' ']
| l ['É', ' ']
| l ['I', ' ']
| l ['Œ', ' ']
| l ['Ï', ' ']
| l ['O', ' ']
Now I need this sorted alphabetically following French collating rules
... 'Æ' follows 'A'... 'É' follows 'E' etc.
So I have two problems:
1. sort the output by key value (couldn't think of a simple way
to do this off the bat¹...
2. until the issue I described earlier in this thread is addressed
I need to invoke gnu/coreutils' sort utility...
The solution to problem #1 should be pretty straightforward.
As to the second problem I need to pass my dictionary's entries to
gnu/sort in a way that somehow will return them sorted alphabetically.
Is this feasible using an external sort program?
Thanks,
CJ
¹ In python:
| for k, v in sorted(dict.items()):
| print(k, v)