diff --git a/NEWS b/NEWS index 6711698f..748df831 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,20 @@ You can see the complete list of recent changes, bugfixes and new features in the https://github.com/rkd77/felinks.git[gitweb interface]. See the ChangeLog file for details. + + +ELinks 0.16.1 +------------- + +Released on 2023-04-30 + +* handle SECTION html element #207 +* allocate more memory for BLOCKQUOTE #214 +* encode A href to terminal codepage and encode bytes with highest bit set as %HEX #221 +* Serbian translation update +* install doc by default in meson #224 +* tests fixes + ELinks 0.16.0 ------------- diff --git a/README b/README deleted file mode 100644 index 8e240deb..00000000 --- a/README +++ /dev/null @@ -1,77 +0,0 @@ -ELinks - an advanced web browser -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -ELinks is an advanced and well-established feature-rich text mode web -(HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly -customizable and can be extended via scripts. It is very portable and runs -on a variety of platforms. - -The ELinks official website is available at - - http://elinks.cz/ - -Please see the SITES file for mirrors or other recommended sites. If you -want to install ELinks on your computer, see the INSTALL file for further -instructions. - -A good starting point is documentation files available in doc/, especially the -file index.txt. - -If you want to request features or report bugs, see community information at -http://elinks.cz/community.html and feedback information available at -http://elinks.cz/feedback.html. - -If you want to write some patches, please first read the doc/hacking.txt -document. - -If you want to add a new language or update the translation for an existing -one, please read po/README document. - -If you want to write some documentation, well, you're welcome! ;) - - - -Historical notes -~~~~~~~~~~~~~~~~ - -Initially, ELinks was a development version of Links (Lynx-like text WWW -browser), with more liberal features policy and development style. Its purpose -was to provide an alternative to Links, and to test and tune various new -features, but still provide good rock-solid releases inside stable branches. - -Why not contribute to Links instead? Well, first I made a bunch of patches for -the original Links, but Mikulas wasn't around to integrate them, so I started -releasing my fork. When he came back, a significant number of them got refused -because Mikulas did not like them as he just wouldn't have any use for them -himself. He aims to keep Links at a relatively closed feature set and merge -only new features which he himself needs. It has the advantage that the tree is -very narrow and the code is small and contains very little bloat. - -ELinks, on the contrary, aims to provide a full-featured web browser, superior -to both lynx and w3m and with the power (but not slowness and memory usage) of -Mozilla, Konqueror and similar browsers. However, to prevent drastic bloating -of the code, the development is driven in the course of modularization and -separation of add-on modules (like cookies, bookmarks, ssl, scripting etc). - -For more details about ELinks history, please see - - http://elinks.cz/history.html - -If you are more interested in the history and various Links clones and versions, -you can examine the website at - - http://links.sf.net/ - -Old ELinks team lost interest in ELinks development somehow. felinks is -continuation of elinks based on the master branch of the original elinks repo -with main releases (new features and other incompatible changes) no more often -than 1 yearly, and point releases (bugfixes) no more often than once a month. - -Repository was renamed to elinks on 2020-12-01 with Petr's approval. - -Main repo is at - - https://github.com/rkd77/elinks.git - - -vim: textwidth=80 diff --git a/README.md b/README.md index 73161337..95e8a5f1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,78 @@ -# felinks -Fork of elinks +# ELinks - an advanced web browser +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +ELinks is an advanced and well-established feature-rich text mode web +(HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly +customizable and can be extended via scripts. It is very portable and runs +on a variety of platforms. + +The ELinks official website is available at + + http://elinks.cz/ + +Please see the SITES file for mirrors or other recommended sites. If you +want to install ELinks on your computer, see the INSTALL file for further +instructions. + +A good starting point is documentation files available in doc/, especially the +file index.txt. + +If you want to request features or report bugs, see community information at +http://elinks.cz/community.html and feedback information available at +http://elinks.cz/feedback.html. + +If you want to write some patches, please first read the doc/hacking.txt +document. + +If you want to add a new language or update the translation for an existing +one, please read po/README document. + +If you want to write some documentation, well, you're welcome! ;) + + + +Historical notes +~~~~~~~~~~~~~~~~ + +Initially, ELinks was a development version of Links (Lynx-like text WWW +browser), with more liberal features policy and development style. Its purpose +was to provide an alternative to Links, and to test and tune various new +features, but still provide good rock-solid releases inside stable branches. + +Why not contribute to Links instead? Well, first I made a bunch of patches for +the original Links, but Mikulas wasn't around to integrate them, so I started +releasing my fork. When he came back, a significant number of them got refused +because Mikulas did not like them as he just wouldn't have any use for them +himself. He aims to keep Links at a relatively closed feature set and merge +only new features which he himself needs. It has the advantage that the tree is +very narrow and the code is small and contains very little bloat. + +ELinks, on the contrary, aims to provide a full-featured web browser, superior +to both lynx and w3m and with the power (but not slowness and memory usage) of +Mozilla, Konqueror and similar browsers. However, to prevent drastic bloating +of the code, the development is driven in the course of modularization and +separation of add-on modules (like cookies, bookmarks, ssl, scripting etc). + +For more details about ELinks history, please see + + http://elinks.cz/history.html + +If you are more interested in the history and various Links clones and versions, +you can examine the website at + + http://links.sf.net/ + +Old ELinks team lost interest in ELinks development somehow. felinks (fork of +elinks) is continuation of elinks based on the master branch of the original +elinks repo with main releases (new features and other incompatible changes) no +more often than 1 yearly, and point releases (bugfixes) no more often than once +a month. + +Repository was renamed to elinks on 2020-12-01 with Petr's approval. + +Main repo is at + + https://github.com/rkd77/elinks.git + + +vim: textwidth=80 diff --git a/doc/meson.build b/doc/meson.build index 79d76875..965c4b7d 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -16,15 +16,25 @@ else asciidoc_env = [] endif +doc_dir = get_option('docdir') + +if doc_dir == '' + doc_dir = get_option('prefix') / 'share/doc/elinks' +endif + if pod2html.found() perl_html = custom_target('perl.html', input: ['perl.pod'], output: ['perl.html'], + install: true, + install_dir: doc_dir, command: [pod2html, '--outfile=@OUTPUT@', '--infile=@INPUT@']) perl_hooks_html = custom_target('perl-hooks.html', input: ['../contrib/perl/hooks.pl'], output: ['perl-hooks.html'], + install: true, + install_dir: doc_dir, command: [pod2html, '--outfile=@OUTPUT@', '--infile=@INPUT@']) endif @@ -32,6 +42,8 @@ features_txt = custom_target('features.txt', input: ['../features.conf'], output: 'features.txt', capture: true, + install: true, + install_dir: doc_dir, command: [meson.current_source_dir() + '/tools/conf2doc', '@INPUT@']) keymap_actions_txt = custom_target('keymap-actions.txt', @@ -44,6 +56,8 @@ keymap_defaults_txt = custom_target('keymap-defaults.txt', input: ['../src/config/kbdbind.c'], output: 'keymap-defaults.txt', capture: true, + install: true, + install_dir: doc_dir, command: [meson.current_source_dir() + '/tools/keys2doc', '@INPUT@', 'keymap-defaults.txt']) option_command_frag_xml = custom_target('option-command.frag.xml', @@ -62,6 +76,8 @@ option_command_frag_xhtml = custom_target('option-command.frag.xhtml', input: [], output: 'option-command.frag.xhtml', env: ['LC_ALL=C', 'LANGUAGE=en'], + install: true, + install_dir: doc_dir, command: [meson.current_source_dir() + '/tools/help2xml', elinks, '@OUTPUT@']) option_config_frag_xhtml = custom_target('option-config.frag.xhtml', @@ -75,6 +91,8 @@ elinks_1_html = custom_target('elinks.1.html', output: 'elinks.1.html', depends: option_command_frag_xhtml, env: asciidoc_env, + install: true, + install_dir: doc_dir, command: [meson.current_source_dir() + '/tools/asciidoc/asciidoc.py', '--no-conf', '-f', meson.current_source_dir() + '/tools/asciidoc/asciidoc.conf', '-f', meson.current_source_dir() + '/tools/asciidoc/xhtml11.conf', @@ -103,6 +121,8 @@ elinkskeys_5_html = custom_target('elinkskeys.5.html', output: 'elinkskeys.5.html', depends: [keymap_actions_txt, keymap_defaults_txt], env: asciidoc_env, + install: true, + install_dir: doc_dir, command: [meson.current_source_dir() + '/tools/asciidoc/asciidoc.py', '--no-conf', '-f', meson.current_source_dir() + '/tools/asciidoc/asciidoc.conf', '-f', meson.current_source_dir() + '/tools/asciidoc/xhtml11.conf', @@ -130,6 +150,8 @@ manual_html = custom_target('manual.html', output: 'manual.html', depends: features_txt, env: asciidoc_env, + install: true, + install_dir: doc_dir, command: [meson.current_source_dir() + '/tools/asciidoc/asciidoc.py', '--no-conf', '-f', meson.current_source_dir() + '/tools/asciidoc/asciidoc.conf', '-f', meson.current_source_dir() + '/tools/asciidoc/xhtml11.conf', @@ -219,7 +241,7 @@ manual_html_chunked = [] man1_dir = join_paths(get_option('prefix'), get_option('mandir'), 'man1') man5_dir = join_paths(get_option('prefix'), get_option('mandir'), 'man5') -if xmlto.found() +if xmlto.found() and get_option('htmldoc') elinks_1 = custom_target('elinks.1', input: [], output: 'elinks.1', @@ -248,25 +270,31 @@ if xmlto.found() input: [], output: 'manual.html-chunked', depends: manual_xml, + install: true, + install_dir: doc_dir, command: [xmlto, '-o', meson.current_build_dir() + '/manual.html-chunked', 'html', meson.current_build_dir()+'/manual.xml']) endif manual_pdf = [] -if dblatex.found() +if dblatex.found() and get_option('pdfdoc') manual_pdf = custom_target('manual.pdf', input: [], output: 'manual.pdf', depends: manual_xml, + install: true, + install_dir: doc_dir, command: [dblatex, meson.current_build_dir() + '/manual.xml']) endif doxygen_api = [] -if doxygen.found() +if doxygen.found() and get_option('apidoc') doxygen_api = custom_target('api', input: [], output: 'api', env: ['OUTPUT_DIRECTORY='+meson.current_build_dir()+'/'], + install: true, + install_dir: doc_dir, command: [doxygen, meson.current_build_dir()+'/Doxyfile']) endif diff --git a/doc/remote.txt b/doc/remote.txt index d22732ea..e89321db 100644 --- a/doc/remote.txt +++ b/doc/remote.txt @@ -74,7 +74,7 @@ xfeDoCommand(openBrowser) Opens an ELinks instance in a new window. \ `-------------------------------`---------------------------------------------- Command Description ------------------------------------------------------------------------------- -addBookmark(URL) Bookmarks the passed URL. +addBookmark(URL, title) Bookmarks the passed URL and set title. infoBox(text) Show text in a message box. reload() Reload the document in the current tab. search(string) Search for the string in the current tab diff --git a/meson.build b/meson.build index 77d0cdea..d30c1c04 100644 --- a/meson.build +++ b/meson.build @@ -3,14 +3,21 @@ srcs=[] srcdir = meson.source_root() -txt = run_command('git', '--git-dir=' + srcdir + '/.git', 'rev-parse', 'HEAD', check:false).stdout().strip() -dirty = run_command(srcdir + '/git-dirty.sh', check:false).stdout().strip() +git = find_program('git', required: false) + +if git.found() + txt = run_command('git', '--git-dir=' + srcdir + '/.git', 'rev-parse', 'HEAD', check:false).stdout().strip() + dirty = run_command(srcdir + '/git-dirty.sh', check:false).stdout().strip() +else + txt = '' + dirty = '' +endif add_global_arguments('-DBUILD_ID="' + txt + dirty + '"', language : 'c') conf_data = configuration_data() conf_data.set('VERSION', meson.project_version()) conf_data.set('PACKAGE', meson.project_name()) - +conf_data.set('DATE', run_command('date', '%Y-%m-%d', check:false).stdout().strip()) conf_data.set('CONFIG_LARGEFILE', get_option('largefile')) conf_data.set('CONFIG_BOOKMARKS', get_option('bookmarks')) diff --git a/meson_options.txt b/meson_options.txt index 3e410630..47c4a95f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -73,3 +73,7 @@ option('dgi', type: 'boolean', value: false, description: 'DOS Gateway Interface option('mujs', type: 'boolean', value: false, description: 'use mujs library') option('codepoint', type: 'boolean', value: true, description: 'whether check codepoints on Linux console') option('test', type: 'boolean', value: false, description: 'whether build test programs') +option('docdir', type: 'string', value: '', description: 'Documentation installation directory. Default $prefix/share/doc/elinks.') +option('apidoc', type: 'boolean', value: true, description: 'whether to generate API docs with doxygen') +option('htmldoc', type: 'boolean', value: true, description: 'whether to build html docs') +option('pdfdoc', type: 'boolean', value: true, description: 'whether to build manual.pdf') diff --git a/src/bookmarks/bookmarks.c b/src/bookmarks/bookmarks.c index 815fdccf..f5287d3d 100644 --- a/src/bookmarks/bookmarks.c +++ b/src/bookmarks/bookmarks.c @@ -312,7 +312,7 @@ init_bookmark(struct bookmark *root, const char *title, const char *url) bm = (struct bookmark *)mem_calloc(1, sizeof(*bm)); if (!bm) return NULL; - bm->title = stracpy(title); + bm->title = null_or_stracpy(title); if (!bm->title) { mem_free(bm); return NULL; diff --git a/src/config/cmdline.c b/src/config/cmdline.c index a5808ff8..3adce9cc 100644 --- a/src/config/cmdline.c +++ b/src/config/cmdline.c @@ -405,7 +405,11 @@ remote_cmd(struct option *o, char ***argv, int *argc) case REMOTE_METHOD_ADDBOOKMARK: if (remote_argc < 1) break; - remote_url = stracpy(remote_argv[0]); + if (remote_argc == 2) { + remote_url = straconcat(remote_argv[0], POST_CHAR_S, remote_argv[1], NULL); + } else { + remote_url = stracpy(remote_argv[0]); + } remote_session_flags = SES_REMOTE_ADD_BOOKMARK; break; @@ -960,7 +964,7 @@ union option_info cmdline_options_info[] = { "\topenURL(URL) : open URL in current tab\n" "\topenURL(URL, new-tab) : open URL in new tab\n" "\topenURL(URL, new-window) : open URL in new window\n" - "\taddBookmark(URL) : bookmark URL\n" + "\taddBookmark(URL, title) : bookmark URL with title\n" "\tinfoBox(text) : show text in a message box\n" "\treload() : reload the document in the current tab\n" "\tsearch(string) : search in the current tab\n" diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c index 6e0051ce..fbce1578 100644 --- a/src/document/html/parser/link.c +++ b/src/document/html/parser/link.c @@ -54,13 +54,17 @@ html_a(struct html_context *html_context, char *a, char *href; href = get_url_val(a, "href", html_context->doc_cp); + if (href) { char *target; + char *href_converted = convert_string(renderer_context.convert_table, href, strlen(href), + html_context->options->cp, CSM_NONE, NULL, NULL, NULL); - mem_free_set(&elformat.link, - join_urls(html_context->base_href, - trim_chars(href, ' ', 0))); - + if (href_converted) { + mem_free_set(&elformat.link, + join_urls(html_context->base_href, trim_chars(href_converted, ' ', 0))); + mem_free(href_converted); + } mem_free(href); target = get_target(html_context->options, a); diff --git a/src/mime/backend/Makefile b/src/mime/backend/Makefile index 9f9e2014..d6ed40f0 100644 --- a/src/mime/backend/Makefile +++ b/src/mime/backend/Makefile @@ -18,5 +18,6 @@ TESTDEPS = \ $(top_builddir)/src/osdep/osdep.o TESTDEPS-$(CONFIG_NLS) += $(top_builddir)/src/intl/gettext/lib.o +TESTDEPS-$(CONFIG_GETTEXT) += $(top_builddir)/src/intl/libintl.o $(top_builddir)/src/util/env.o include $(top_srcdir)/Makefile.lib diff --git a/src/osdep/dos/elinks.lsm.in b/src/osdep/dos/elinks.lsm.in new file mode 100644 index 00000000..7d6e7c1c --- /dev/null +++ b/src/osdep/dos/elinks.lsm.in @@ -0,0 +1,14 @@ +Begin3 +Title: @PACKAGE@ +Version: @VERSION@ +Entered-date: @DATE@ +Description: lynx-like alternative character mode WWW browser +Keywords: browser, internet, www +Author: +Maintained-by: Witold Filipczyk +Primary-site: https://github.com/rkd77/elinks +Alternate-site: +Original-site: +Platforms: DOS, FreeDOS +Copying-policy: GPLv2 +End diff --git a/src/osdep/dos/meson.build b/src/osdep/dos/meson.build index f5bab831..7236fce4 100644 --- a/src/osdep/dos/meson.build +++ b/src/osdep/dos/meson.build @@ -1 +1,5 @@ +configure_file(input : 'elinks.lsm.in', + output : 'elinks.lsm', + configuration : conf_data) + srcs += files('dos.cpp') diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 9f42b21a..7461c736 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -350,10 +350,22 @@ add_url_to_http_string(struct string *header, struct uri *uri, uri_component_T c * before. We should probably encode all URLs as early as * possible, and possibly decode them back in protocol * backends. --pasky */ - char *string = get_uri_string(uri, components); - char *data = string; + struct string encoded; + char *string; + char *data; - if (!string) return; + if (!init_string(&encoded)) { + return; + } + string = get_uri_string(uri, components); + + if (!string) { + done_string(&encoded); + return; + } + encode_uri_string_percent(&encoded, string, -1); + mem_free(string); + data = encoded.source; while (*data) { int len = strcspn(data, " \t\r\n\\"); @@ -369,8 +381,7 @@ add_url_to_http_string(struct string *header, struct uri *uri, uri_component_T c data += len; } - - mem_free(string); + done_string(&encoded); } /* Parse from @end - 1 to @start and set *@value to integer found. diff --git a/src/protocol/test/Makefile b/src/protocol/test/Makefile index 4eb6cd7c..706d0d24 100644 --- a/src/protocol/test/Makefile +++ b/src/protocol/test/Makefile @@ -9,8 +9,6 @@ TESTDEPS = \ $(top_builddir)/src/protocol/uri.o \ stub.o -TESTDEPS-$(CONFIG_NLS) += $(top_builddir)/src/intl/gettext/lib.o - CLEAN = stub.o uri-test:: stub.o diff --git a/src/protocol/uri.c b/src/protocol/uri.c index 90d9df14..6ee4af65 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -1422,6 +1422,29 @@ encode_uri_string(struct string *string, const char *name, int namelen, } } +void +encode_uri_string_percent(struct string *string, const char *name, int namelen) +{ + char n[4]; + const char *end; + + n[0] = '%'; + n[3] = '\0'; + + if (namelen < 0) namelen = strlen(name); + + for (end = name + namelen; name < end; name++) { + if ((unsigned char)(*name) < 128) { + add_char_to_string(string, *name); + } else { + /* Hex it. */ + n[1] = Hx((((int) *name) & 0xF0) >> 4); + n[2] = Hx(((int) *name) & 0xF); + add_bytes_to_string(string, n, sizeof(n) - 1); + } + } +} + void encode_win32_uri_string(struct string *string, char *name, int namelen) { diff --git a/src/protocol/uri.h b/src/protocol/uri.h index 837cd697..0337ae50 100644 --- a/src/protocol/uri.h +++ b/src/protocol/uri.h @@ -321,6 +321,8 @@ int get_uri_port(const struct uri *uri); void encode_uri_string(struct string *string, const char *name, int namelen, int convert_slashes); +void encode_uri_string_percent(struct string *string, const char *name, int namelen); + /* special version for Windows directory listing */ void encode_win32_uri_string(struct string *string, char *name, int namelen); diff --git a/src/session/session.cpp b/src/session/session.cpp index da06dcc9..20cf5b04 100644 --- a/src/session/session.cpp +++ b/src/session/session.cpp @@ -1144,9 +1144,18 @@ init_remote_session(struct session *ses, remote_session_flags_T *remote_ptr, * then have a function that reversibly converts them * to IRIs for display in a given encoding. */ uri_cp = get_cp_index("System"); - add_bookmark_cp(NULL, 1, uri_cp, struri(uri), struri(uri)); -#endif + if (uri->post) { + char *title = stracpy(uri->post); + char *url = get_uri_string(uri, URI_ORIGINAL); + + add_bookmark_cp(NULL, 1, uri_cp, title, url); + mem_free_if(url); + mem_free_if(title); + } else { + add_bookmark_cp(NULL, 1, uri_cp, struri(uri), struri(uri)); + } +#endif } else if (remote & SES_REMOTE_INFO_BOX) { char *text; diff --git a/src/setup.h b/src/setup.h index 161cf8dc..8ae0e935 100644 --- a/src/setup.h +++ b/src/setup.h @@ -73,7 +73,7 @@ #define HTML_TABLE_2ND_PASS #define HTML_DEFAULT_INPUT_SIZE 20 #define HTML_MAX_COLSPAN 32768 -#define HTML_MAX_ROWSPAN 32768 +#define HTML_MAX_ROWSPAN 16384 #define HTML_MAX_CELLS_MEMORY 32*1024*1024 #define MAX_STR_LEN 1024