emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/webpaste a9c4aa4 288/298: Merge branch 'provider-paste-rs'


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste a9c4aa4 288/298: Merge branch 'provider-paste-rs'
Date: Thu, 9 Dec 2021 19:00:31 -0500 (EST)

branch: elpa/webpaste
commit a9c4aa418526dbaf19348325ca30c249e2cf8440
Merge: 9ffa782 7d8e0d4
Author: Elis Hirwing <elis@hirwing.se>
Commit: Elis Hirwing <elis@hirwing.se>

    Merge branch 'provider-paste-rs'
---
 README.org                                   |  3 ++-
 tests/integration/test-webpaste-providers.el |  7 +++++++
 webpaste.el                                  | 13 ++++++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index 563f269..7414417 100644
--- a/README.org
+++ b/README.org
@@ -188,10 +188,11 @@ webpaste first and then just read the documentation by 
running this:
   (describe-function 'webpaste--provider)
 #+end_src
 
-* TODO Providers to implement [6/13]
+* TODO Providers to implement [7/14]
  - [ ] clbin.com
  - [ ] 0x0.st
  - [X] ix.io
+ - [X] paste.rs
  - [X] dpaste.com
  - [X] dpaste.org
  - [X] gist.github.com
diff --git a/tests/integration/test-webpaste-providers.el 
b/tests/integration/test-webpaste-providers.el
index e9273a7..5103582 100644
--- a/tests/integration/test-webpaste-providers.el
+++ b/tests/integration/test-webpaste-providers.el
@@ -26,6 +26,13 @@
   (expect (spy-calls-count 'webpaste--return-url) :to-equal 1)
   (expect (spy-calls-count 'webpaste--paste-text) :to-equal 0))
 
+ (it
+  "can paste with paste.rs [ci]"
+
+  (funcall (webpaste--get-provider-by-name "paste.rs") paste-message :sync t)
+
+  (expect (spy-calls-count 'webpaste--return-url) :to-equal 1)
+  (expect (spy-calls-count 'webpaste--paste-text) :to-equal 0))
 
  (it
   "can paste with dpaste.com [ci]"
diff --git a/webpaste.el b/webpaste.el
index 1f6d4b8..da89aa0 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -101,6 +101,11 @@ This uses `browse-url-generic' to open URLs."
                       (nix-mode . "nix"))
      :success-lambda webpaste--providers-success-returned-string)
 
+    ("paste.rs"
+     :uri "https://paste.rs";
+     :post-field nil
+     :success-lambda webpaste--providers-success-returned-string)
+
     ("dpaste.com"
      :uri "http://dpaste.com/api/v2/";
      :post-data (("title" . "")
@@ -287,7 +292,13 @@ This is the default failover hook that we use for most 
providers."
                        ;; Append language to the post-data
                        (cl-pushnew (cons post-lang-field-name language-name) 
post-data)))
 
-                 post-data)))
+                 ;; If there's no defined field
+                 (if (equal post-field nil)
+                     ;; Just return the plain data
+                     text
+
+                   ;; Otherwise we return the formatted post data
+                   post-data))))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]