summaryrefslogtreecommitdiffstats
path: root/runtime/spell/sr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 08:50:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 08:50:31 +0000
commitaed8ce9da277f5ecffe968b324f242c41c3b752a (patch)
treed2e538394cb7a8a7c42a4aac6ccf1a8e3256999b /runtime/spell/sr
parentInitial commit. (diff)
downloadvim-aed8ce9da277f5ecffe968b324f242c41c3b752a.tar.xz
vim-aed8ce9da277f5ecffe968b324f242c41c3b752a.zip
Adding upstream version 2:9.0.1378.upstream/2%9.0.1378upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/spell/sr')
-rw-r--r--runtime/spell/sr/README_sr.txt59
-rw-r--r--runtime/spell/sr/convert.vim30
-rw-r--r--runtime/spell/sr/main.aap23
3 files changed, 112 insertions, 0 deletions
diff --git a/runtime/spell/sr/README_sr.txt b/runtime/spell/sr/README_sr.txt
new file mode 100644
index 0000000..6a3b10a
--- /dev/null
+++ b/runtime/spell/sr/README_sr.txt
@@ -0,0 +1,59 @@
+The location of source files for Serbian spelling dictionary were downloaded
+from https://github.com/LibreOffice/dictionaries/tree/master/sr (Serbian
+Spelling and Hyphenation for LibreOffice).
+
+Here is the content of original README file from the repository:
+
+ "LibreOffice Spelling and Hyphenation
+ extension package for Serbian (Cyrillic and Latin)
+
+ This extension package includes the Hunspell dictionary and Hyphen
+ hyphenation patterns for the Serbian language adapted for usage in
+ LibreOffice.
+
+ Serbian spelling dictionary is developed by Milutin Smiljanic
+ <msmiljanic.gm@gmail.com> and is released under GNU LGPL version 3 or
+ later / MPL version 2 or later / GNU GPL version 3 or later, giving
+ you the choice of one of the three sets of free software licensing
+ terms.
+
+ Serbian hyphenation patterns are derived from the official TeX
+ patterns for Serbocroatian language (Cyrillic and Latin) created by
+ Dejan Muhamedagić, version 2.02 from 22 June 2008 adopted for usage
+ with Hyphen hyphenation library and released under GNU LGPL version
+ 2.1 or later."
+
+
+This dictionary used to create Vim spl file is the result of merging the two
+LibreOffice dictionaries for cyrillic and latin script.
+
+The merge was accomplished by concatenating two .dic and .aff files (appending
+the latin to cyrillic).
+
+The first step was to fix both .aff files by adding a '.' at the end of every
+SFX and PFX directive and removing directives that are not supported by Vim
+(KEY, MIDWORD).
+
+Next, update the flags in latin .dic and .aff files so that the flag sequence
+continues monotonically after the last flag number in cyrillic .aff file.
+
+A couple of words in cyrillic dict used a latin codepoints for 'a' and 'e',
+that was also corrected.
+
+You should be able to reproduce this with these steps:
+ * Save the existing sr.aff and sr.dic files, if you have them, they will be
+ overwritten.
+ * Create a subfolder "new".
+ * Put 4 files downloaded from LibreOffice dictionaries GitHub repository in
+ it: sr.aff, sr-Latn.aff, sr.dic and sr-Latn.dic
+ * Open Vim and cd into "new"
+ * Execute: :so ../convert.vim
+ * The resulting sr.aff and sr.dic are created in the parent spell folder
+ (here).
+ * Now one can generate spl file as usual using the merged dic and aff
+ files:
+ env LANG=sr_RS.UTF-8 vim -u NONE -e -c "set enc=utf-8" -c "mkspell! ../sr sr" -c q
+
+
+Ivan Pešić
+28.06.2022.
diff --git a/runtime/spell/sr/convert.vim b/runtime/spell/sr/convert.vim
new file mode 100644
index 0000000..731986e
--- /dev/null
+++ b/runtime/spell/sr/convert.vim
@@ -0,0 +1,30 @@
+:e sr.aff
+:normal gg
+:normal wgu$
+:3d
+:4d
+:normal G
+:normal o
+:r sr-Latn.aff
+:%s#^\(SFX\|PFX\).*[а-џa-ž]\zs$# .#g
+:normal G
+?SET
+:.,+5d
+:.,$s#^\(SFX\|PFX\) \zs\(\d\+\)#\= eval(submatch(2) .. ' + 1903')#
+:w ../sr.aff
+:bd!
+:e sr.dic
+:%s#a#а#g
+:%s#e#е#g
+:normal G
+:normal o
+:r sr-Latn.dic
+:normal 201dd
+:.,$s#/\zs\(\d\+\)\(,\(\d\+\)\)\?$#\=(submatch(2) == '') ? eval(submatch(1) + '1903') : eval(submatch(1) + '1903') .. ',' .. eval(submatch(3) + '1903')#
+:normal {
+:normal dd
+:normal gg
+:normal C502898
+:w ../sr.dic
+:bd!
+:q!
diff --git a/runtime/spell/sr/main.aap b/runtime/spell/sr/main.aap
new file mode 100644
index 0000000..5b2d95e
--- /dev/null
+++ b/runtime/spell/sr/main.aap
@@ -0,0 +1,23 @@
+# Aap recipe for Serbian Vim spell files.
+# See README_sr.txt for instructions to get the .aff and .dic files.
+
+# Use a freshly compiled Vim if it exists.
+@if os.path.exists('../../../src/vim'):
+ VIM = ../../../src/vim
+@else:
+ :progsearch VIM vim
+
+SPELLDIR = ..
+FILES = sr.aff sr.dic
+
+all: $SPELLDIR/sr.utf-8.spl ../README_sr.txt
+
+$SPELLDIR/sr.utf-8.spl : $FILES
+ :sys env LANG=sr_RS.UTF-8
+ $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr sr" -c q
+
+../README_sr.txt : README_sr.txt
+ :copy README_sr.txt $target
+
+
+vim: set sts=4 sw=4 :