diff --git a/TeXmacs/progs/link/link-navigate.scm b/TeXmacs/progs/link/link-navigate.scm index 8f1adc72e1..ad3007c08e 100644 --- a/TeXmacs/progs/link/link-navigate.scm +++ b/TeXmacs/progs/link/link-navigate.scm @@ -469,9 +469,10 @@ (default-root-handler (url-relative (current-buffer) u))) ((url-or? (url-expand u)) (default-root-disambiguator (url-expand u))) - (else (with (base qry) (process-url u) - (if (!= "" (url->system base)) - (load-browse-buffer base)))))) + (else + (with (base qry) (process-url u) + (if (!= "" (url->system base)) + (load-browse-buffer base)))))) (define (tmfs-root-handler u) (load-browse-buffer u)) @@ -489,8 +490,8 @@ (list http-root-handler http-post-handler)) ((or (== root "http") (== root "https")) (list http-root-handler http-post-handler)) - (else (display* "Unhandled url root: " root "\n") - (list default-root-handler default-post-handler))))) + (else + (list default-root-handler default-post-handler))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Actual navigation diff --git a/TeXmacs/progs/network/url-test.scm b/TeXmacs/progs/network/url-test.scm index 1e7c6bf68e..e2ec73f406 100644 --- a/TeXmacs/progs/network/url-test.scm +++ b/TeXmacs/progs/network/url-test.scm @@ -14,6 +14,21 @@ (texmacs-module (network url-test) (:use (network url))) +(define (regtest-zotero-url) + (regression-test-group + "url" "(url-or? u)" + url-or? :none + (test "case 1" "zotero://a/b/c" #f)) + (regression-test-group + "url" "(url-complete u flags)" + (lambda (x) + (== (url-complete "zotero://a/b/c" x) + (string->url "zotero://a/b/c"))) + :none + (test "r" "r" #t) + (test "df" "df" #t) + (test "rf" "rf" #t))) + (define (regtest-url-host) (regression-test-group "url" "host of the url" @@ -23,6 +38,7 @@ (test "local file 1" "/tmp" ""))) (tm-define (regtest-url) - (let ((n (+ (regtest-url-host)))) + (let ((n (+ (regtest-url-host) + (regtest-zotero-url)))) (display* "Total: " (object->string n) " tests.\n") (display "Test suite of url: ok\n"))) diff --git a/TeXmacs/progs/source/shortcut-widgets.scm b/TeXmacs/progs/source/shortcut-widgets.scm index 6869c74566..f537a3a079 100644 --- a/TeXmacs/progs/source/shortcut-widgets.scm +++ b/TeXmacs/progs/source/shortcut-widgets.scm @@ -76,7 +76,7 @@ (tm-define (open-shortcuts-editor . opt) (:interactive #t) (let* ((b (current-buffer)) - (u (string->url (string-append "tmfs://aux/edit-shortcuts"))) + (u (string-append "tmfs://aux/edit-shortcuts")) (sh (if (null? opt) "" (car opt))) (cmd (if (or (null? opt) (null? (cdr opt))) "" (cadr opt)))) (dialogue-window (shortcuts-editor u sh cmd) diff --git a/TeXmacs/progs/texmacs/texmacs/tm-files.scm b/TeXmacs/progs/texmacs/texmacs/tm-files.scm index 6d0d7b8c7b..2807e263b2 100644 --- a/TeXmacs/progs/texmacs/texmacs/tm-files.scm +++ b/TeXmacs/progs/texmacs/texmacs/tm-files.scm @@ -413,6 +413,7 @@ (or (and (url-rooted-web? u) ;; FIXME: Use HTTP HEADERS to determine the real file format (!= (file-format u) "texmacs-file")) + (not (in? (url-root u) (list "tmfs" "file" "default" "blank" "ramdisc"))) (file-of-format? u "image") (file-of-format? u "pdf") (file-of-format? u "postscript") diff --git a/src/Plugins/Qt/qt_sys_utils.cpp b/src/Plugins/Qt/qt_sys_utils.cpp index d587fcbc1e..3c4c7f316b 100644 --- a/src/Plugins/Qt/qt_sys_utils.cpp +++ b/src/Plugins/Qt/qt_sys_utils.cpp @@ -34,12 +34,13 @@ qt_get_pretty_os_name () { void qt_open_url (url u) { - if (is_rooted_web (u) || is_rooted (u, "file")) { - QString link= to_qstring (as_string (u)); + debug_io << "open-url\t" << u << LF; + if (is_local_and_single (u)) { + QString link= to_qstring ("file:///" * as_string (u)); QDesktopServices::openUrl (QUrl (link)); } - else if (is_local_and_single (u)) { - QString link= to_qstring ("file:///" * as_string (u)); + else { + QString link= to_qstring (as_string (u)); QDesktopServices::openUrl (QUrl (link)); } } diff --git a/src/Scheme/L3/glue_url.lua b/src/Scheme/L3/glue_url.lua index 8cb6e61fe9..f4e7d361f4 100644 --- a/src/Scheme/L3/glue_url.lua +++ b/src/Scheme/L3/glue_url.lua @@ -100,7 +100,7 @@ function main() }, { scm_name = "string->url", - cpp_name = "tm_url", + cpp_name = "url", ret_type = "url", arg_list = { "string" @@ -125,7 +125,7 @@ function main() }, { scm_name = "unix->url", - cpp_name = "tm_url", + cpp_name = "url", ret_type = "url", arg_list = { "string" diff --git a/src/System/Classes/tm_url.cpp b/src/System/Classes/tm_url.cpp index 3ca9b9b996..ba66eab7ec 100644 --- a/src/System/Classes/tm_url.cpp +++ b/src/System/Classes/tm_url.cpp @@ -70,11 +70,6 @@ #include "analyze.hpp" #include "scheme.hpp" -url tm_url (string name) { - if (starts (name, "tmfs://")) return tmfs_url (name (7, N (name))); - else return url_general (name, URL_UNIX); -} - bool url_test (url name, string filter) { if (filter == "") return true; int i, n= N(filter); @@ -174,11 +169,7 @@ complete (url base, url u, string filter, bool flag) { if (url_test (comp, filter)) return u; return url_none (); } - failed_error << "base = " << base << LF; - failed_error << "u = " << u << LF; - failed_error << "filter= " << filter << LF; - ASSERT (is_rooted (comp), "unrooted url"); - TM_FAILED ("bad protocol in url"); + return u; } if (is_root (u)) { // FIXME: test filter flags here diff --git a/src/System/Classes/tm_url.hpp b/src/System/Classes/tm_url.hpp index 1c76965a66..9b8747b708 100644 --- a/src/System/Classes/tm_url.hpp +++ b/src/System/Classes/tm_url.hpp @@ -15,7 +15,6 @@ #include "tree.hpp" #include "tm_debug.hpp" -url tm_url (string name); bool is_secure (url u); // is u secure? /****************************************************************************** diff --git a/src/System/Classes/tmfs_url.cpp b/src/System/Classes/tmfs_url.cpp index da028a2576..61a5d7f1cd 100644 --- a/src/System/Classes/tmfs_url.cpp +++ b/src/System/Classes/tmfs_url.cpp @@ -12,12 +12,6 @@ #include "tmfs_url.hpp" -tmfs_url::tmfs_url (string name) - : url (url_root ("tmfs") * url_get_name (name)) {} - -tmfs_url::tmfs_url (const char* name) - : url (url_root ("tmfs") * url_get_name (string (name))) {} - bool is_tmfs_protocol (url u, string protocol) { return u->t == protocol || diff --git a/src/Texmacs/Data/new_buffer.cpp b/src/Texmacs/Data/new_buffer.cpp index 65eb1f5e66..66b6406ca6 100644 --- a/src/Texmacs/Data/new_buffer.cpp +++ b/src/Texmacs/Data/new_buffer.cpp @@ -588,7 +588,7 @@ latex_expand (tree doc, url name) { tree latex_expand (tree doc) { - tm_view vw= concrete_view (tm_url (as_string (extract (doc, "view")))); + tm_view vw= concrete_view (url_system (as_string (extract (doc, "view")))); tree body= vw->ed->exec_latex (extract (doc, "body")); doc= change_doc_attr (doc, "body", body); return remove_doc_attr (doc, "view"); diff --git a/src/Texmacs/Data/new_view.cpp b/src/Texmacs/Data/new_view.cpp index f7b60ab5f4..f589694d93 100644 --- a/src/Texmacs/Data/new_view.cpp +++ b/src/Texmacs/Data/new_view.cpp @@ -72,7 +72,7 @@ abstract_view (tm_view vw) { string name= encode_url (vw->buf->buf->name); //cout << vw->buf->buf->name << " -> " << name << "\n"; string nr = as_string (vw->nr); - return tm_url ("tmfs://view/" * nr * "/" * name); + return url_system ("tmfs://view/" * nr * "/" * name); } tm_view diff --git a/src/Texmacs/Window/tm_window.cpp b/src/Texmacs/Window/tm_window.cpp index 6a0e61294b..a4271f4415 100644 --- a/src/Texmacs/Window/tm_window.cpp +++ b/src/Texmacs/Window/tm_window.cpp @@ -268,7 +268,7 @@ embedded_name (url name) { static int nr= 0; if (!is_none (name)) return name; nr++; - return tm_url (string ("tmfs://aux/TeXmacs-input-" * as_string (nr))); + return url_system (string ("tmfs://aux/TeXmacs-input-" * as_string (nr))); } tree diff --git a/xmake/packages.lua b/xmake/packages.lua index cdcbc9f7fc..fd297fd3e0 100644 --- a/xmake/packages.lua +++ b/xmake/packages.lua @@ -21,7 +21,7 @@ -- The following versions are adopted on macOS/Windows/ArchLinux -- We will use the system provided packages on Ubuntu 22.04/Debian 12/... -local LOLLY_VERSION = "1.3.5" +local LOLLY_VERSION = "1.3.6" local TBOX_VERSION = "1.7.5" local CPR_VERSION = "1.10.5" local CURL_VERSION = "8.4.0" @@ -47,7 +47,7 @@ package("lolly") add_deps("cpr") end - add_versions("v" .. LOLLY_VERSION, "95f371e041c69b2a287cf6735c7ae39de7f9bce7") + add_versions("v" .. LOLLY_VERSION, "3c0502ac6a090742c9d3b4eaaf4b2f770ef61fa3") on_install("linux", "macosx", "mingw", "wasm", "windows", function (package) local configs = {}