Hi all,

 I would like to initiate some conversation about specific aspects of the 
codebase, so that we gradually build some shared knowledge which is not 
necessarily distillable in more permanent documentation.

I was looking at the way the \hlink tag works, and in particular what happens 
when links are clicked.

I noted that TeXmacs allow very few schema:

url
url_general (string name, int type= URL_SYSTEM) {
  if (starts (name, "local:")) return url_local (name (6, N (name)));
  if (starts (name, "file://")) return url_file (name (7, N (name)));
  if (starts (name, "http://";)) return url_http (name (7, N (name)));
  if (starts (name, "https://";)) return url_https (name (8, N (name)));
  if (starts (name, "ftp://";)) return url_ftp (name (6, N (name)));
  if (starts (name, "tmfs://")) return url_tmfs (name (7, N (name)));
  if (starts (name, "//")) return url_blank (name (2, N (name)));
  #ifdef OS_ANDROID
  if (starts (name, "content://")) return url_content (name (10, N (name)));
  #endif
  if (heuristic_is_path (name, type)) return url_path (name, type);
  if (heuristic_is_default (name, type)) return url_default (name, type);
  if (heuristic_is_mingw_default (name, type)) return url_mingw_default (name, 
type);
  if (type != URL_CLEAN_UNIX) {
    if (heuristic_is_http (name)) return url_http (name);
    if (heuristic_is_ftp (name)) return url_ftp (name);
  }
  return url_get_name (name, type);
}

I would like to handle some more (some are OS specific, and this is ok). In 
general would be better that if a schema is not recognised, we just invoke the 
standard OS handler. (MacOS for example can handle a wide variety of schemas, 
some of them which are not standard, e.g. to refer to email in the Mail.app or 
to dates in Calendar.app).

What is the reason of the code duplication there? all the functions url_XXXX 
perform more or less all the same operations. Also why there is an #ifdef? 

I understand there is a problem about parsing strings, since “:” can also mean 
union of paths and not only delimit the URL schema, but we could try to have a 
more versatile handling here.


Max





_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to