1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-28 01:35:32 +00:00
Commit Graph

61 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
03b112796d bug 153, 1066: Add codepage parameter to update_bookmark().
This also makes the bookmark-update event carry strings in UTF-8.
The only current consumer of that event is bookmark_change_hook(),
which ignores the strings, so no changes are needed there.
2009-02-08 18:26:18 +02:00
Kalle Olavi Niemitalo
73f925ce21 bug 153, 1066: Convert XBEL bookmarks to/from UTF-8.
When the file is being read, Expat provides the strings to ELinks in
UTF-8, so ELinks can put them in struct bookmark without conversions.
Make sure gettext returns any placeholder strings in UTF-8, too.
Replace '\r' with ' ' in bookmark titles and URLs.

When the file is being written, put encoding="UTF-8" in the XML
declaration, and then write out the strings from struct bookmark
without character set conversions.  Do replace some characters
with entity references though, by calling add_html_to_string().
2009-02-08 18:26:04 +02:00
Kalle Olavi Niemitalo
8c0ae2a215 bug 153, 1066: Convert ~/.elinks/bookmarks to/from UTF-8.
The ~/.elinks/bookmarks file is in the system charset,
for compatibility with earlier ELinks releases,
but internally the strings are in UTF-8.
2009-01-24 14:38:59 +02:00
Kalle Olavi Niemitalo
1cb81679f4 bug 153, 1066: Add add_bookmark_cp(). 2009-01-24 12:18:28 +02:00
Kalle Olavi Niemitalo
d1f2f8df80 bug 153, 1066: init_bookmark() and add_bookmark() expect UTF-8.
Comment changes only.
2009-01-24 12:17:48 +02:00
Kalle Olavi Niemitalo
37de386051 bug 153, 1066: Document that bookmarks should be UTF-8.
Comment changes only.
2009-01-24 12:12:45 +02:00
Kalle Olavi Niemitalo
a82a5cc6d5 XBEL bug 761: Distinguish between names and values of attributes.
When ELinks is parsing an XML element in from an XBEL bookmark file,
it collects the attributes of the element to the current_node->attrs
list.  Previously, struct attributes had room for one string only:
the last element of current_node->attrs was the name of the first
attribute, and it was preceded by the value of the first attribute,
the name of the second attribute, the value of the second attribute,
and so on.  However, when get_attribute_value() was looking for a
given name, it compared the values as well.  So, if you had for
example <bookmark id="href" href="http://elinks.cz/">, then
get_attribute_value("href") would incorrectly return "href".

To fix this confusion, store values in the new member
attributes.value, rather than in attributes.name.
2009-01-04 15:15:21 +02:00
M. Vefa Bicakci
20a7a6c460 Patch 3: Further fixes including strcasestr and convert_to_lowercase 2008-11-01 22:32:43 +02:00
Kalle Olavi Niemitalo
96176a8c77 Declare element types of lists. 2007-07-26 22:47:23 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Kalle Olavi Niemitalo
5d22006f93 do_move_bookmark: Update comment to match reality.
[ From commit 22d051925e in ELinks
  0.11.2.GIT.  --KON ]
2007-04-01 15:02:47 +03:00
Kalle Olavi Niemitalo
7645a836fc Cast the NULL argument of straconcat to unsigned char *.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
2007-03-11 12:59:11 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
e325b748be XBEL: Fix us-ascii charset lookup.
Previously, print_xml_entities did look up the charset, but did not
save the result anywhere and just used 0, leading to further lookups
in subsequent calls.  It worked by accident though, because the
codepage index of us-ascii currently is 0.
2007-03-11 10:36:44 +02:00
Kalle Olavi Niemitalo
d7e4b57146 Make instances of struct listbox_ops const. 2007-02-04 15:17:49 +02:00
Kalle Olavi Niemitalo
a5e321cb2b Make instances of struct hierbox_browser_button const.
And explicitly disable the "Save" buttons in anonymous mode,
even though they are currently inside #if 0.
2007-02-04 13:54:07 +02:00
Kalle Olavi Niemitalo
22f7468013 Make arrays of option change hooks const. 2007-01-27 19:00:47 +02:00
Kalle Olavi Niemitalo
ef96caad01 Make u2cp and u2cp_no_nbsp return a pointer to const. 2007-01-02 20:08:59 +02:00
Kalle Olavi Niemitalo
cb02b46154 Bug 153: Refer to the bug from the docstring of bookmarks.file_format.
When I first read the warning about "NO NATIONAL CHARS SUPPORT!"
I was amazed: XML is based on Unicode, so why would the authors of the
XBEL specification have botched support for those characters?  The bug
is actually in the ELinks implementation of XBEL, and it has already
been entered in the ELinks bugzilla.  Make the documentation string
refer to that.
2006-11-12 18:47:07 +02:00
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Miciah Dashiel Butler Masters
32ec5d1db3 do_move_bookmarks: replace destb and desti parameters with insert_as_child flag
Simplify do_move_bookmarks (from a readability perspective) by replacing
the destb and desti parameters with a new insert_as_child flag. Inspired
by Kalle Olavi Niemitalo.
2006-06-16 21:13:32 +00:00
Miciah Dashiel Butler Masters
6f98f5fd96 Bookmarks: Fix update after move
do_move_bookmark was only updating the selection in the bookmarks manager
window in which the Move button was pressed. Now all windows are updated.

This patch also prevents a crash when the first item that was displayed
in a box was the last child of a folder and was being moved (the comment
removed in this patch was incorrect in assuming that bm->box->next must
be valid because it neglected to account for non-root children).

This change required that I move the definition of struct
hierbox_dialog_list_item from src/bfu/hierbox.c to src/bfu/hierbox.h.

Thanks to Kalle Olavi Niemitalo for finding both the update problem
and the crash.
2006-06-16 21:13:31 +00:00
Miciah Dashiel Butler Masters
fed0d6bd54 Bookmarks: Include bfu/listbox.h and bfu/hierbox.h 2006-06-16 21:13:31 +00:00
Miciah Dashiel Butler Masters
fde874ad35 Remove a useless comment
The comment was added in commit 0a44083e7b63cf51c7347a289c6d953cb7c15bcd.
2006-06-06 05:18:40 +00:00
Miciah Dashiel Butler Masters
819ea129af Bookmarks: Avoid a dangling pointer on malloc failure
In memorize_last_searched_bookmark, when malloc of bm_last_searched_url
fails, set bm_last_searched_title to NULL after freeing it.
2006-06-06 05:18:39 +00:00
Miciah Dashiel Butler Masters
9d6ec1ee59 Remove a superfluous check.
This thoroughly ridiculous check was added in commit
bfa309e192caf6f1dd1f1bc112490b2f3dad1ebb.
2006-06-06 05:18:39 +00:00
Miciah Dashiel Butler Masters
d3bc3eb7e9 Drop an unnecessary prototype (it is in the header file). 2006-06-06 05:18:38 +00:00
Miciah Dashiel Butler Masters
1a3c8734d4 Utilise mem_free_set. 2006-06-06 05:18:38 +00:00
Miciah Dashiel Butler Masters
551ff4587a Drop a stale comment.
The return value to delete_bookmark was changed to void in commit
7f47389e41a1bd2d9a0e05b74df49c26cd8e155a.
2006-06-06 02:43:00 +00:00
Miciah Dashiel Butler Masters
938d9c860b Drop an unnecessary prototype (it is in the header file). 2006-06-06 02:41:09 +00:00
Kalle Olavi Niemitalo
e5ed5bce80 bookmarks: CONFIG_SMALL elides explanations of why Move failed.
(I added them in commit 3090e3a25077a19a7b2d5361543e28ca19cc7b84.)
2006-06-02 21:16:57 +00:00
Kalle Olavi Niemitalo
403a4ac2a2 bookmarks: Turn tree_node::attrs into a struct list_head.
Previously, it was a pointer to a separately allocated struct attributes,
of which only the LIST_HEAD members were actually used.
All init_list calls now operate on struct list_head.
This change may also reduce memory usage for reading bookmarks.
2006-06-02 19:14:59 +00:00
Kalle Olavi Niemitalo
d10a489a14 BFU: Mark format strings in struct listbox_ops_messages.
With regular comments in the definition of the structure itself,
and with xgettext:c-format comments in constants of that type,
if xgettext would otherwise guess wrong; so that translators
will know they'll have to double any percent signs they add.
I didn't regenerate PO files, though.
2006-06-02 19:08:09 +00:00
Laurent MONIN
1d3656a317 Pass a pointer to a hash pointer to free_hash() to ensure hash pointer
is NULL on return.
2006-05-31 19:33:36 +02:00
Laurent MONIN
54099f5286 Do not export init_hash(),strhash() and hash_size() anymore, use a
wrapper named init_hash8() instead.
2006-05-31 19:17:01 +02:00
Miciah Dashiel Butler Masters
4398613413 Use listbox_sel instead of focus_bookmark and delete focus_bookmark 2006-05-28 00:12:08 +00:00
Kalle Olavi Niemitalo
3090e3a250 BOOKMARKS: Tell the user why the Move button didn't work.
Thanks to Jonas Fonseca.
2006-05-21 16:46:23 +03:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
Jonas Fonseca
3f878c6ce7 BOOKMARKS: Fix XBEL calling add_bookmark() with NULL title
It didn't check that both title and title->text was non NULL. In either
case it now passes "No title" string to add_bookmark().

Reported by Neuromancer.

Tested with both:

	<bookmark href="empty://title"><title></title><bookmark>
	<bookmark href="no://title"></bookmark>
2006-01-31 03:52:48 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Kalle Olavi Niemitalo
89fe822f70 Merge with 6a9ea02f3a
(via http://elinks.cz/elinks.git)
2006-01-14 21:30:12 +02:00
Laurent MONIN
b8e64a5ee0 Simplify secure_open() call, make it a wrapper around secure_open_umask(). 2006-01-10 23:49:35 +01:00
Laurent MONIN
9b88da873a Use mode_t and mode macros everywhere. 2006-01-10 23:35:22 +01:00
Kalle Olavi Niemitalo
345ba7afcd Merge with http://elinks.cz/elinks.git 2006-01-01 19:05:44 +02:00
Kalle Olavi Niemitalo
4c2831677a Here is a framework that detects cases where a PO file assigns
the same accelerator key to multiple buttons in a dialog box or
to multiple items in a menu.  ELinks already has some support for
this but it requires the translator to run ELinks and manually
scan through all menus and dialogs.  The attached changes make it
possible to quickly detect and list any conflicts, including ones
that can only occur on operating systems or configurations that
the translator is not currently using.

The changes have no immediate effect on the elinks executable or
the MO files.  PO files become larger, however.

The scheme works like this:

- Like before, accelerator keys in translatable strings are
  tagged with the tilde (~) character.

- Whenever a C source file defines an accelerator key, it must
  assign one or more named "contexts" to it.  The translations in
  the PO files inherit these contexts.  If multiple strings use
  the same accelerator (case insensitive) in the same context,
  that's a conflict and can be detected automatically.

- The contexts are defined with "gettext_accelerator_context"
  comments in source files.  These comments delimit regions where
  all translatable strings containing tildes are given the same
  contexts.  There must be one special comment at the top of the
  region; it lists the contexts assigned to that region.  The
  region automatically ends at the end of the function (found
  with regexp /^\}/), but it can also be closed explicitly with
  another special comment.  The comments are formatted like this:

    /* [gettext_accelerator_context(foo, bar, baz)]
         begins a region that uses the contexts "foo", "bar", and "baz".
         The comma is the delimiter; whitespace is optional.

       [gettext_accelerator_context()]
         ends the region.  */

  The scripts don't currently check whether this syntax occurs
  inside or outside comments.

- The names of contexts consist of C identifiers delimited with
  periods.  I typically used the name of a function that sets
  up a dialog, or the name of an array where the items of a
  menu are listed.  There is a special feature for static
  functions: if the name begins with a period, then the period
  will be replaced with the name of the source file and a colon.

- If a menu is programmatically generated from multiple parts,
  of which some are never used together, so that it is safe to
  use the same accelerators in them, then it is necessary to
  define multiple contexts for the same menu.  link_menu() in
  src/viewer/text/link.c is the most complex example of this.

- During make update-po:

  - A Perl script (po/gather-accelerator-contexts.pl) reads
    po/elinks.pot, scans the source files listed in it for
    "gettext_accelerator_context" comments, and rewrites
    po/elinks.pot with "accelerator_context" comments that
    indicate the contexts of each msgid: the union of all
    contexts of all of its uses in the source files.  It also
    removes any "gettext_accelerator_context" comments that
    xgettext --add-comments has copied to elinks.pot.

  - If po/gather-accelerator-contexts.pl does not find any
    contexts for some use of an msgid that seems to contain an
    accelerator (because it contains a tilde), it warns.  If the
    tilde refers to e.g. "~/.elinks" and does not actually mark
    an accelerator, the warning can be silenced by specifying the
    special context "IGNORE", which the script otherwise ignores.

  - msgmerge copies the "accelerator_context" comments from
    po/elinks.pot to po/*.po.  Translators do not edit those
    comments.

- During make check-po:

  - Another Perl script (po/check-accelerator-contexts.pl) reads
    po/*.po and keeps track of which accelerators have been bound
    in each context.  It warns about any conflicts it finds.
    This script does not access the C source files; thus it does
    not matter if the line numbers in "#:" lines are out of date.

This implementation is not perfect and I am not proposing to
add it to the main source tree at this time.  Specifically:

- It introduces compile-time dependencies on Perl and Locale::PO.
  There should be a configure-time or compile-time check so that
  the new features are skipped if the prerequisites are missing.

- When the scripts include msgstr strings in warnings, they
  should transcode them from the charset of the PO file to the
  one specified by the user's locale.

- It is not adequately documented (well, except perhaps here).

- po/check-accelerator-contexts.pl reports the same conflict
  multiple times if it occurs in multiple contexts.

- The warning messages should include line numbers, so that users
  of Emacs could conveniently edit the conflicting part of the PO
  file.  This is not feasible with the current version of
  Locale::PO.

- Locale::PO does not understand #~ lines and spews warnings
  about them.  There is an ugly hack to hide these warnings.

- Jonas Fonseca suggested the script could propose accelerators
  that are still available.  This has not been implemented.

There are three files attached:

- po/gather-accelerator-contexts.pl: Augments elinks.pot with
  context information.

- po/check-accelerator-contexts.pl: Checks conflicts.

- accelerator-contexts.diff: Makes po/Makefile run the scripts,
  and adds special comments to source files.
2006-01-01 18:55:18 +02:00
Miciah Dashiel Butler Masters
ceb9222ee4 Drop a silly 'Setup box_item' comment in add_bookmark. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
9d713ff41d Write the bookmarks whether or not they are dirty if the backend has
changed since reading.
2005-12-30 21:08:50 +00:00
Miciah Dashiel Butler Masters
17b7ffc7df Add elinks.bookmarks interface for reading bookmarks. 2005-12-29 07:05:31 +00:00
Jonas Fonseca
48c113b114 Fix non-ANSI function declaration 2005-11-25 18:51:21 +01:00
Jonas Fonseca
5dffe2e8ac Fix various sparse warnings
Mostly non-ANSI function declarations, using 0 as NULL and inline
function prototypes. Also removed unused S_HTTP_100 network state
enum type, which text message contained unknown escape sequence: '\?'.
2005-11-24 15:38:47 +01:00