commit 6b8d98a470693c051564f6fdd06ec295547459a0
Author: Jan Palus <[email protected]>
Date:   Tue Feb 16 12:26:08 2021 +0100

    new

 maps_path.patch                     | 22 +++++++++++++++++++
 sh.patch                            | 31 +++++++++++++++++++++++++++
 vim-plugin-SpellLangIdentifier.spec | 42 +++++++++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)
---
diff --git a/vim-plugin-SpellLangIdentifier.spec 
b/vim-plugin-SpellLangIdentifier.spec
new file mode 100644
index 0000000..383b846
--- /dev/null
+++ b/vim-plugin-SpellLangIdentifier.spec
@@ -0,0 +1,42 @@
+%define                plugin  SpellLangIdentifier
+Summary:       Vim plugin: Automatically identify buffer's language and set 
the spell lang
+Name:          vim-plugin-%{plugin}
+Version:       1.0.0
+Release:       1
+License:       GPL v3+
+Group:         Applications/Editors/Vim
+Source0:       
https://github.com/daaugusto/spelllangidentifier/archive/v%{version}/sli-%{version}.tar.gz
+# Source0-md5: 615deaac501adf1ff8194688c3c0bdad
+Patch0:                sh.patch
+Patch1:                maps_path.patch
+URL:           https://www.vim.org/scripts/script.php?script_id=4988
+Requires:      mguesser
+Requires:      vim-rt >= 4:7.4.0
+BuildArch:     noarch
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define                _vimdatadir     %{_datadir}/vim
+
+%description
+SpellLangIdentifier detects the language based on the buffer contents
+through 'mguesser' (http://www.mnogosearch.org/guesser/), which in
+turn uses "N-Gram-Based Text Categorization".
+
+%prep
+%setup -qn spelllangidentifier-%{version}
+%patch0 -p1
+%patch1 -p1
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_vimdatadir}/plugin
+cp -pr LanguageIdentifier.sh SpellLangIdentifier.vim 
$RPM_BUILD_ROOT%{_vimdatadir}/plugin
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS README.md vimrc.sample
+%attr(755,root,root) %{_vimdatadir}/plugin/LanguageIdentifier.sh
+%{_vimdatadir}/plugin/SpellLangIdentifier.vim
diff --git a/maps_path.patch b/maps_path.patch
new file mode 100644
index 0000000..d78c8de
--- /dev/null
+++ b/maps_path.patch
@@ -0,0 +1,22 @@
+--- spelllangidentifier-1.0.0/LanguageIdentifier.sh.orig       2021-02-16 
12:18:50.323362430 +0100
++++ spelllangidentifier-1.0.0/LanguageIdentifier.sh    2021-02-16 
12:20:17.002886928 +0100
+@@ -102,10 +102,6 @@
+ done
+ 
################################################################################
+ 
+-# Try to guess the mguesser's maps directory
+-[ -z "$MGMAPS" ] && MGMAPS="$(dirname "$MG")/maps"
+-
+-
+ TMP="`mktemp -d`"
+ FILE="$TMP/sli-$FILE"
+ 
+@@ -141,7 +137,7 @@
+ #  2) all punctuation chars are transformed into single spaces, which are 
then squeezed and
+ #     all characters that are not letters or spaces are deleted.
+ #  3) the resulting content are then given to 'mguesser'
+-CMD="$FILTER 2>/dev/null | tr -d '[:digit:][:cntrl:]' | tr 
'[:punct:][:space:]' ' ' | tr -s ' ' | "$MG" -d "$MGMAPS" - 2>/dev/null"
++CMD="$FILTER 2>/dev/null | tr -d '[:digit:][:cntrl:]' | tr 
'[:punct:][:space:]' ' ' | tr -s ' ' | "$MG" ${MGMAPS:+-d "$MGMAPS"} - 
2>/dev/null"
+ 
+ # Evaluate the assembled command and check if it has succeeded
+ OUT="`eval "$CMD" 2>/dev/null`"
diff --git a/sh.patch b/sh.patch
new file mode 100644
index 0000000..6d4731b
--- /dev/null
+++ b/sh.patch
@@ -0,0 +1,31 @@
+From 3ade16f51cccd661d773ca053da326bbd83d7d25 Mon Sep 17 00:00:00 2001
+From: "Douglas A. Augusto" <[email protected]>
+Date: Tue, 6 Feb 2018 15:24:59 -0200
+Subject: [PATCH] Integrates Ingo Heimbach's OSX compatibility changes. Thanks.
+
+---
+ LanguageIdentifier.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/LanguageIdentifier.sh b/LanguageIdentifier.sh
+index 00f04fc..3f9f835 100755
+--- a/LanguageIdentifier.sh
++++ b/LanguageIdentifier.sh
+@@ -80,7 +80,7 @@ NLANGS=1
+ #    af ar az be bg br bs ca cs cy da de el en eo eo-h eo-x es et eu fi fr ga
+ #    he hi hr hu hy is it ja la lt lv nl no pl pt-br pt-pt ro ru sk sl sq sr 
sv
+ #    sw ta th tl tr ua vi zh
+-SUBS=":"   # sed ':' does nothing (same as cat)
++SUBS=""
+ 
+ # Explicitly specify the file type
+ FT=""
+@@ -152,7 +152,7 @@ then
+    # guessings | perform the substitutions (if any)| remove possible duplicate
+    # languages | filter out undesired languages (matches whole line) | replace
+    # EOL with comma
+-   LANG="$(printf "%s\n" "$OUT" | awk '$1 !~ /^0.000/ {print $2}' | sed -E 
"$SUBS" | awk '!a[$0]++' | grep -E -x -m $NLANGS "$LANGS" | paste -sd',')"
++   LANG="$(printf "%s\n" "$OUT" | awk '$1 !~ /^0.000/ {print $2}' | sed -E 
"$SUBS" | awk '!a[$0]++' | grep -E -x -m $NLANGS "$LANGS" | paste -sd',' -)"
+ 
+    # Output guessed language (empty if it could not identify)
+    printf "%s" "$LANG"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/vim-plugin-SpellLangIdentifier.git/commitdiff/6b8d98a470693c051564f6fdd06ec295547459a0

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to