;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307#\207" [require url json thingatpt custom-declare-variable wiki-summary-language-string "en" "Language string for the API URL call, i.e.: 'en', 'fr', etc."] 4) (defvar wiki--pre-url-format-string "https://%s.wikipedia.org/w/api.php?continue=&action=query&titles=") (defvar wiki--post-url-format-string "&prop=extracts&exintro=&explaintext=&format=json&redirects") #@84 Given a wiki page title, generate the url for the API call to get the page info (defalias 'wiki-summary/make-api-query #[(s) "\306 \"\n\307\310\311\312 #!\211 \f Q+\207" [wiki--pre-url-format-string wiki-summary-language-string wiki--post-url-format-string s term post format url-hexify-string replace-regexp-in-string " " "_" pre] 8 (#$ . 518)]) #@71 Given the JSON reponse from the webpage, grab the summary as a string (defalias 'wiki-summary/extract-summary #[(resp) "\304\301\"\304 \302\"\211A@\304 \305\"+\207" [resp query pages info plist-get extract] 4 (#$ . 878)]) #@79 Given a summary, stick it in the *wiki-summary* buffer and display the buffer (defalias 'wiki-summary/format-summary-in-buffer #[(summary) "\302\303!rq\210\304 \"\210\305 \210eb\210\306 \210\307 \210)\310!)\207" [buf summary generate-new-buffer "*wiki-summary*" princ fill-paragraph text-mode view-mode pop-to-buffer] 3 (#$ . 1110)]) #@79 Given a summary, stick it in the *wiki-summary* buffer and display the buffer (defalias 'wiki-summary/format-summary-into-buffer #[(summary buffer) "\303!r\303 !q\210\304 \210\nc\210\305 \210)\306\303 !!)\207" [buffer this-buffer summary get-buffer barf-if-buffer-read-only fill-paragraph display-buffer] 3 (#$ . 1454)]) #@48 Return the wikipedia page's summary for a term (defalias 'wiki-summary #[(s) "\212\301\302!\303\")\207" [s url-retrieve wiki-summary/make-api-query #[(events) "\306\307!\210b\210\310\311\312\313 \314\f!\211\204\306\315!\202!\316 !-\207" [url-http-end-of-headers json-array-type json-key-type json-object-type result summary message "" plist symbol vector json-read wiki-summary/extract-summary "No article found" wiki-summary/format-summary-in-buffer] 4]] 3 (#$ . 1783) (list (read-string (concat "Wikipedia Article" (if (thing-at-point 'word) (concat " (" (thing-at-point 'word) ")") "") ": ") nil nil (thing-at-point 'word)))]) #@48 Return the wikipedia page's summary for a term (defalias 'wiki-summary-insert #[(s) "\212\301\302!\303\304p!C#)\207" [s url-retrieve wiki-summary/make-api-query #[(events buf) "\306\307!\210b\210\310\311\312\313 \314\f!\211\204\306\315!\202#\316 \"-\207" [url-http-end-of-headers json-array-type json-key-type json-object-type result summary message "" plist symbol vector json-read wiki-summary/extract-summary "No article found" wiki-summary/format-summary-into-buffer buf] 4] buffer-name] 5 (#$ . 2429) (list (read-string (concat "Wikipedia Article" (if (thing-at-point 'word) (concat " (" (thing-at-point 'word) ")") "") ": ") nil nil (thing-at-point 'word)))]) (provide 'wiki-summary)