1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
Commit Graph

923 Commits

Author SHA1 Message Date
Petr Baudis
b457af1984 document/dom/source.c: Trivial simplification 2007-08-28 21:31:49 +02:00
Petr Baudis
baeb0cb0d5 document/dom: Move stylesheet parsing out of style loop
...for better clarity of the document initialization functions.
2007-08-28 21:31:25 +02:00
Petr Baudis
a9619bce80 document/renderer.c: Fix description 2007-08-28 21:28:32 +02:00
Petr Baudis
dc0cf23631 document/dom: Simplify init_template_by_style() usage
It doesn't take the useless styling information but just uses options->default_style.
2007-08-28 21:28:03 +02:00
Petr Baudis
55495ab655 document: Turn options' default_fg, default_bg to default_style
...as struct text_style. This way it might be possible later to
add other default formatting attributes by CSS and it allows
quite a code simplification in the DOM renderer.
2007-08-28 21:16:44 +02:00
Petr Baudis
db9431465f document: Move text_style-related stuff to dedicated format.*
We will need to include it from options.h and the include chain just
wouldn't work. And it feels like a hack to have it in renderer.h anyway.
2007-08-28 21:05:00 +02:00
Petr Baudis
b66d2bec67 document: Unify text style -> screen attribute handling
Currently, all DOM, HTML and plain renderers had their own routine for
conversion from text style to screen attribute. This moves text_style and
text_style_format from html/parser.h to renderer.h and introduces new generic
routine get_screen_chracter_template() that is used by all the specific
rendering engines.
2007-08-28 21:02:08 +02:00
Petr Baudis
38ee8a137c document/dom/util.*: Make init_template() private 2007-08-28 20:32:15 +02:00
Petr Baudis
070d335796 document: struct format_attr -> struct text_style_format 2007-08-28 20:17:53 +02:00
Petr Baudis
e133941206 document/html: struct text_attrib_style -> struct text_style 2007-08-28 20:15:30 +02:00
Petr Baudis
46e44f9298 document/dom: Move renderer-specific data from the generic struct dom_renderer
This is hopefully the final step to have the specific renderers completely
separated and self-contained.
2007-08-28 19:58:08 +02:00
Petr Baudis
91e512cca8 document/dom: Move URL regexp setup from general code to source renderer 2007-08-28 19:40:30 +02:00
Petr Baudis
afb9b6daa5 document/dom: Move styles initialization out of init_dom_renderer()
Now, CSS is initialized separately for each of the renderers, so that
also RSS doesn't just choose styles of random DOM node types.

init_template_by_style() is introduced as the common backend for
loading CSS properties.
2007-08-28 19:38:13 +02:00
Miciah Dashiel Butler Masters
fa12b10e26 Introduce session- (tab-)specific options
Introduce session-specific options for those options that have toggle-... actions.
2007-08-28 17:29:41 +00:00
Miciah Dashiel Butler Masters
ea372bd0cd get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
2007-08-28 17:24:59 +00:00
Petr Baudis
494e4a1019 document/dom/rss.c: Explain what normalizing is
As insighted by Jonas.
2007-08-28 18:12:41 +02:00
Petr Baudis
2480d1ae0a Merge branch 'master' of /srv/git/elinks 2007-08-28 17:43:14 +02:00
Petr Baudis
445a0ae600 document/dom: Some symbols should be static 2007-08-28 17:43:01 +02:00
Petr Baudis
4003e6decf document/dom: Split SGML (HTML) source renderer to source.* 2007-08-28 17:41:55 +02:00
Petr Baudis
556ae45b00 document/dom: Split RSS renderer to rss.* 2007-08-28 17:33:22 +02:00
Petr Baudis
144bd77240 document/dom: Split rendering utilities to util.*
These are functions that are commonly used by the individual renderers to put stuff on the canvas etc.
2007-08-28 17:12:23 +02:00
Miciah Dashiel Butler Masters
3975d28bce Merge commit 'origin/elinks-0.12'
Conflicts:

	doc/Doxyfile.in
	src/protocol/bittorrent/common.h
2007-08-28 14:47:39 +00:00
Miciah Dashiel Butler Masters
80259bc53e Revert "justify_line(): Re-add wordlen == 0 test"
This reverts commit 18cdce6c39.

elinks-0.12 has a different fix, and I will soon merge in that branch.
2007-08-28 13:41:14 +00:00
Petr Baudis
f88f49d955 document/dom: Explain that only renderer lives here 2007-08-28 15:15:13 +02:00
Petr Baudis
18cdce6c39 justify_line(): Re-add wordlen == 0 test
This fixes ELinks crashing on this with terminal width e.g. 103:

	<p align="justify">
	xxxx xxxx xxxx xxxxx xxxxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
	xxxxx xxxx xxxxxxx xxx xxxxxxx xxx xxxx xxxx xxxx xx xxxx x xxx xxxx
	xxxx xx xxxx xxxx xxxx xxx&mdash;xxx xxxx xx&mdash;xxx xxxx<em> </em>x
	xxxx </p>

This test was removed for an unknown reason in commit
b1cc717789.

Discovered together with Miciah.
2007-08-26 19:06:26 +02:00
Kalle Olavi Niemitalo
870df797cf Doxygen: Escape some HTML tags. 2007-07-31 13:48:20 +03:00
Kalle Olavi Niemitalo
76c6f38169 Doxygen: Begin commands with @ not \. 2007-07-31 13:47:12 +03:00
Kalle Olavi Niemitalo
0cb047b298 Bug 968: Don't use copy_chars in justify_line.
All the needed memory has been allocated before the loop so we can use
copy_screen_chars() directly.  This avoids the assertion failure in
copy_chars() for width==0 and should be a bit faster too.  According
to ISO/IEC 9899:1999 7.21.1p2, memcpy() doesn't copy anything if n==0
(but the pointers must be valid).
(original 'git cherry-pick' arguments: cherry-pick bug968-att394)
2007-07-30 16:43:46 +03:00
Kalle Olavi Niemitalo
2437d35904 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13
There were conflicts in src/document/css/ because 0.12.GIT switched
to LIST_OF(struct css_selector) and 0.13.GIT switched to struct
css_selector_set.  Resolved by using LIST_OF(struct css_selector)
inside struct css_selector_set.
2007-07-28 03:22:29 +03:00
Kalle Olavi Niemitalo
297ad024c3 const in css_appliers[] 2007-07-28 02:38:11 +03:00
Kalle Olavi Niemitalo
80f5ec1827 Doxygenate src/document/css/ 2007-07-28 02:35:36 +03:00
Kalle Olavi Niemitalo
a26db3948a Doxygenate src/document/ (but not subdirs) 2007-07-28 02:34:59 +03: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
585f8b426b Doxygen syntax fixes
Fix warnings:
dom/stack.h:70: Warning: explicit link request to 'pop_dom_node' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_nodes' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_state' could not be resolved
dom/stack.h:115: Warning: explicit link request to 'done_dom_node' could not be resolved

Use @returns instead of \return in src/document/css/parser.c,
and other such things.
2007-07-26 14:14:27 +03:00
Kalle Olavi Niemitalo
ab9e0821d6 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13 2007-07-22 18:48:45 +03:00
Kalle Olavi Niemitalo
64da6774c2 CSS: Count nested blocks when skipping.
When skipping "@media print { #foo {bar: baz} pre {white-space: normal} }",
the previous code would look for the first "{" and then the first "}", and
fail to skip the "pre" rule.  Seen at support.microsoft.com.

I originally posted this change as part of attachment 383 to bug 722.
2007-07-22 16:51:04 +03:00
Kalle Olavi Niemitalo
b1cc717789 Preserve underlines in links when justifying. 2007-07-20 17:57:01 +03:00
Kalle Olavi Niemitalo
275402f43c CSS: Fix parent selectors broken in the previous commit. 2007-07-16 01:42:15 +03:00
Kalle Olavi Niemitalo
591ff81890 CSS bug 766: Scan ancestor elements only if needed.
time elinks -no-connect -no-home 'http://rss.slashdot.org/Slashdot/slashdot/to?m=5878'
Wait until finished loading, then press q and Enter.

before	6.45user 0.17system 0:11.34elapsed 58%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3387minor)pagefaults 0swaps
after	5.51user 0.14system 0:09.85elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3469minor)pagefaults 0swaps
before	5.86user 0.17system 0:10.58elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3504minor)pagefaults 0swaps
after	5.50user 0.15system 0:10.96elapsed 51%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3645minor)pagefaults 0swaps
before	6.40user 0.14system 0:11.85elapsed 55%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3640minor)pagefaults 0swaps
after	6.17user 0.12system 0:10.80elapsed 58%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3378minor)pagefaults 0swaps
before	5.80user 0.14system 0:10.29elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3632minor)pagefaults 0swaps
after	5.56user 0.16system 0:10.08elapsed 56%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3569minor)pagefaults 0swaps
before	5.92user 0.14system 0:10.54elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3570minor)pagefaults 0swaps
after	5.52user 0.13system 0:10.10elapsed 55%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3515minor)pagefaults 0swaps

All in all, it is doubtful whether this change is worth the complexity.
Please go ahead and revert if you think it isn't.
2007-07-16 00:29:06 +03:00
Kalle Olavi Niemitalo
ace03d5093 CSS: new struct css_selector_set 2007-07-16 00:28:49 +03:00
Kalle Olavi Niemitalo
8097929290 Merge with #elinks-0.12 2007-07-16 00:18:17 +03:00
Kalle Olavi Niemitalo
98260f7970 CSS bug 766: Parse the id and class attributes in advance.
time elinks -no-connect -no-home 'http://rss.slashdot.org/Slashdot/slashdot/to?m=5878'
Wait until finished loading, then press q and Enter.

before	19.96user 0.16system 0:25.97elapsed 77%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3630minor)pagefaults 0swaps
after	6.46user 0.12system 0:12.66elapsed 52%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3630minor)pagefaults 0swaps
before	18.02user 0.19system 0:23.86elapsed 76%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3572minor)pagefaults 0swaps
after	5.73user 0.15system 0:10.02elapsed 58%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3628minor)pagefaults 0swaps
before	19.80user 0.15system 0:25.14elapsed 79%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3461minor)pagefaults 0swaps
after	6.28user 0.13system 0:11.91elapsed 53%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3626minor)pagefaults 0swaps
2007-07-15 22:19:30 +03:00
Kalle Olavi Niemitalo
5d468daf83 CSS: Document reparent_selector and make it static. 2007-07-15 19:54:22 +03:00
Kalle Olavi Niemitalo
ef815d5e25 CSS: Don't call list_empty within args of DBG. 2007-07-15 15:56:33 +03:00
Kalle Olavi Niemitalo
455432fd0b CSS: Move /* #define DEBUG_CSS */ to stylesheet.h.
That's where src/document/css/README says it should be.
2007-07-15 15:56:14 +03:00
Witold Filipczyk
438f039bda check_html_form_hierarchy: Old code was buggy.
Old code caused the assertion failure on the shutdownday's page.
2007-07-10 15:22:47 +03:00
Kalle Olavi Niemitalo
eccc8c23f0 Merge with http://elinks.cz/elinks.git#elinks-0.12 2007-07-09 16:03:06 +03:00
Kalle Olavi Niemitalo
c2ca46cb81 Bug 461: Ensure contrast when filling with spaces.
So that the cursor will be visible in the Linux console.
2007-05-20 19:23:33 +03:00
Kalle Olavi Niemitalo
45d1750d03 Bug 914: Don't let UTF-8 I/O affect internal representations.
Use it for the actual I/O only.  Previously, defining CONFIG_UTF8 and
enabling UTF-8 used to force many strings to the UTF-8 charset
regardless of the terminal charset option.  Now, those strings always
follow the terminal charset.  This fixes bug 914 which was caused
because _() returned strings in the terminal charset and functions
then assumed they were in UTF-8.  This reduction in the effects of
UTF-8 I/O may also simplify future testing.
2007-05-20 15:31:02 +03:00
Kalle Olavi Niemitalo
f8f99cc04e put_link_line: Add a comment related to bug 213. 2007-05-13 12:11:17 +03:00
Witold Filipczyk
30a502cb8c DOM renderer: One byte too much. 2007-05-01 18:06:07 +02:00
Kalle Olavi Niemitalo
68ff5a8d61 Bug 816, html_textarea: Expand entity references.
Because the renderer no longer does that.
The comment "We don't cope well with entities here" may now be
obsolete but I'm not sure about that so I'm leaving it in.
2007-04-30 02:10:25 +03:00
Kalle Olavi Niemitalo
a58345f4e7 html_textarea: Use memmove rather than memcpy.
This is an overlapping copy and memcpy is not required to support that.
2007-04-30 01:41:32 +03:00
Kalle Olavi Niemitalo
bafe47508d Bug 784: Add html_context->doc_cp and parse attributes with it.
options->cp is still used for this in seven places where html_context
is not easily available.  Those should eventually be corrected too,
but I'm checking this change in already because it's better than what
we had before.
2007-04-30 00:56:39 +03:00
Kalle Olavi Niemitalo
5e83337d49 Bug 784: Keep form_control.default_value in the document charset.
Previously, html_special_form_control converted
form_control.default_value to the terminal charset, and init_form_state
then copied the value to form_state.value.  However, when CONFIG_UTF8
is defined and UTF-8 I/O is enabled, form_state.value is supposed to
be in UTF-8, rather than in the terminal charset.

This mismatch could not be conveniently fixed in
html_special_form_control because that does not know which terminal is
being used and whether UTF-8 I/O is enabled there.  Also, constructing
a conversion table from the document charset to form_state.value could
have ruined renderer_context.convert_table, because src/intl/charsets.c
does not support multiple concurrent conversion tables.

So instead, we now keep form_control.default_value in the document
charset, and convert it in the viewer each time it is needed.  Because
the result of the conversion is kept in form_state.value between
incremental renderings, this shouldn't even slow things down too much.

I am not implementing the proper charset conversions for the DOM
defaultValue property yet, because the current code doesn't have
them for other string properties either, and bug 805 is already open
for that.
2007-04-29 22:01:13 +03:00
Kalle Olavi Niemitalo
487a047264 Document the meaning of document_options.cp.
Miciah provided part of the text.
2007-04-29 21:28:40 +03:00
Laurent Monin
084d402c51 Bug 816, html_special_form_control: Don't parse character entity references. 2007-04-29 21:25:42 +03:00
Kalle Olavi Niemitalo
ce05aa1f37 Bug 947, set_hline: Also recognize NBSP_CHAR #ifndef CONFIG_UTF8. 2007-04-26 23:46:03 +03:00
Laurent MONIN
0b98c5051b Fix trailing whitespaces 2007-04-26 15:02:04 +02:00
Kalle Olavi Niemitalo
0b7a56f89a Bug 947, set_hline: Respect wrap_nbsp also if !part->document.
This does not yet fix bug 947 for the case where the document is UTF-8
and the terminal is ISO-8859-1.  That will require changing charsets.c
too, it seems.
2007-04-26 07:48:11 +03:00
Kalle Olavi Niemitalo
fa9567653d set_hline: Outdent some code. 2007-04-26 07:38:37 +03:00
Kalle Olavi Niemitalo
0c3a871a4b Bug 879, set_hline: Discard U+00AD SOFT HYPHEN characters if UTF-8.
If not UTF-8, then charsets.c has already discarded them.
2007-04-26 07:12:28 +03:00
Kalle Olavi Niemitalo
443db69980 Don't mark undisplayed names of modules for translation.
Exclude unneeded header files.  This partially reverts commit
90980a944e, with permission.
2007-03-23 00:51:56 +02:00
Laurent MONIN
90980a944e Mark all module names for translation and include needed header files. 2007-03-21 11:01:06 +01:00
Witold Filipczyk
e347122e6d get_attr_value: do not do trim_chars
trim_chars was called only in debug mode and the results of the get_attr_val
for value=" something " in debug mode differ from normal and fastmem mode.

[ From commit c4500039b2 on the witekfl
  branch.  --KON ]
2007-03-18 13:32:25 +02: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
22af2b22e2 Cast variadic arguments of add_to_ml to void *.
getml reads the args with va_arg(ap, void *), and the NULL macro in
particular may have the wrong type.
2007-03-11 12:44:13 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Witold Filipczyk
27a66f59d9 Fix the memleak. Part II of the 927 bugfix. 2007-02-25 11:02:53 +02:00
Witold Filipczyk
e01785e462 The fix for the bug 927.
When tables were rendered first time html_format_part was called with
document==NULL. <meta http-equiv=Refresh.../> was inside a table,
so document was NULL. Second time the table knew its dimensions
and document was not NULL.
2007-02-25 11:02:48 +02:00
Kalle Olavi Niemitalo
408d86f2b1 Remove temporary indentation left in the previous commit. 2007-01-30 10:27:57 +02:00
Kalle Olavi Niemitalo
ebf549ba77 Fix document.html.wrap_nbsp in UTF-8 terminals.
!CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
!CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
!CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (drawn as "\001").
!CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (not wrapped).
CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
CONFIG_UTF8, ISO-8859-1 doc, UTF-8 terminal, UTF-8 I/O:
  all fail (not wrapped); after patch all ok.
CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (drawn as "\001").
CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (not wrapped)
CONFIG_UTF8, UTF-8 doc, UTF-8 terminal, UTF-8 I/O:
  all fail (not wrapped); after patch all ok.
2007-01-30 10:21:12 +02:00
Kalle Olavi Niemitalo
419857dce6 set_hline: Add some comments. 2007-01-29 21:07:13 +02:00
Kalle Olavi Niemitalo
4adcae682f change_hook_css: Don't use the ses parameter.
It might be NULL.
2007-01-27 22:33:02 +02:00
Kalle Olavi Niemitalo
22f7468013 Make arrays of option change hooks const. 2007-01-27 19:00:47 +02:00
Kalle Olavi Niemitalo
a287f547fd set_hline: Add a FIXME comment about invalid UTF-8. 2006-12-26 14:59:16 +02:00
Kalle Olavi Niemitalo
cd10da6f31 Bug 912, set_hline: Don't let LINE(y).length remain larger than needed. 2006-12-26 14:51:42 +02:00
Kalle Olavi Niemitalo
26cce9aab3 Bug 912, realloc_line: Return the original line->length if successful.
This will let the caller restore the length if it notices it has
allocated too much space.
2006-12-26 14:38:58 +02:00
Kalle Olavi Niemitalo
819653836a Bug 912: Callers of realloc_line treat only values < 0 as errors.
This will let me change realloc_line to return the original length.
2006-12-26 14:37:08 +02:00
Kalle Olavi Niemitalo
6b68d38131 set_hline: Define local variables as const where possible.
I hope this makes the source easier to understand.
2006-12-26 14:27:50 +02:00
Kalle Olavi Niemitalo
f396abcf19 Bug 902: set_hline: Assert that we didn't go past end of array.
This assertion detects the overflow that manifested as bug 902.
2006-12-20 23:19:24 +02:00
Kalle Olavi Niemitalo
47f7ba24c6 Bug 902: set_hline: Allocate memory for one more character cell. 2006-12-20 22:04:41 +02:00
Kalle Olavi Niemitalo
a1fe5cf975 Bug 826, UTF-8 set_hline: Don't skip the character after double-cell.
I do not fully understand this code, but I am sure skipping characters
like this is a bug, and correcting it seems to fix bug 826 (too small
table for double-cell characters).  I don't see any similar bugs in
other parts of set_hline.

The patch is from bug 826, comment 4, attachment 308.  The warning
there about unicode_to_cell(UCS_NO_CHAR) still applies but this patch
does not make the situation worse.  I have logged a separate bug 901
about those calls.
2006-12-17 18:13:28 +02:00
Kalle Olavi Niemitalo
a193632187 Make html_context.quote_level unsigned.
Continuation of 7e9fc6f33b.
2006-12-10 14:14:16 +02:00
Miciah Dashiel Butler Masters
e523504424 Add .cached to struct document
This allows code to use document->cached instead of
find_in_cache(document->uri), thereby increasing the likelihood
of getting the correct cache entry.

This should fix Bug 756 - "assertion (cached)->object.refcount >= 0 failed"
after HTTP proxy was changed.

Patches for this were written by me and then later by Jonas.
This commit combines our independent implementations.
2006-12-10 03:11:04 +00:00
Miciah Dashiel Butler Masters
1442f551aa Simplify init_dom_renderer, drop get_css_property 2006-12-08 15:02:59 +00:00
Kalle Olavi Niemitalo
bddafe5f7e Document how timer callbacks erase timer IDs; add some assertions.
Tangential to bug 868.
2006-12-02 18:35:03 +02:00
Jonas Fonseca
9d43babde2 Fix out-of-bound access to the quote_char buffer
The quote_level was decremented unconditionally and could become negative
resulting in a negative index after applying "modulus 2". Reproducable
with an HTML file contianing "</q>".

Reported by paakku.
2006-11-26 22:32:02 +01:00
Kalle Olavi Niemitalo
c283b128b6 Bug 387: Treat &#013; inside <pre>...</pre> as a newline.
Recognize all of &#13; &#10; &#xA; &#xD; with any number of leading
zeroes.  (Previously only &#13; and &#x0A; were supported.)  All of
these are case insensitive.

Treat each CR+LF combination (&#13;&#10;) as a single newline.
2006-11-11 20:31:25 +02:00
Petr Baudis
b8d8d27df4 Fix spurious gcc warning 2006-11-03 19:22:14 +01:00
Miciah Dashiel Butler Masters
061e3aeab5 Eliminate one more unnecessary recomputation in the plaintext parser 2006-11-01 06:38:31 +00:00
Miciah Dashiel Butler Masters
2430de30f4 Eliminate some unnecessary recomputation in the plaintext parser 2006-11-01 01:35:47 +00:00
Miciah Dashiel Butler Masters
d0d03d37bb Fix overflow in the plaintext parser
Remove a bogus cell++ that was added in commit
161ccf9eae. This fixes an overflow when
loading binary files, which was making pasky sad.
2006-11-01 01:19:50 +00:00
Kalle Olavi Niemitalo
1c5db85b1a Bug 821: Document the charsets of buffers for BFU and form input fields. 2006-10-25 19:46:01 +03:00
Witold Filipczyk
2fe0623298 Moved the setTimeout timer to the struct document. 2006-10-24 16:47:41 +02:00
Miciah Dashiel Butler Masters
3041ef5ff1 Use foreachbacksafe in shrink_format_cache
I hope that it isn't too confusing to re-use the local variable next
with foreachbacksafe.
2006-10-20 23:10:35 +00:00
Witold Filipczyk
461787013b Revert commit 7cb91c3213. Doble glyphs should
be displayed correctly.
2006-10-01 16:08:52 +02:00
Kalle Olavi Niemitalo
92cb452a9e Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
2006-09-17 16:12:47 +03:00
Kalle Olavi Niemitalo
e8462980e5 Change "utf_8" to "utf8" in most identifiers.
Suggested by Miciah on #elinks.

What was renamed:
  add_utf_8                      => add_utf8
  cp2utf_8                       => cp2utf8
  encode_utf_8                   => encode_utf8
  get_translation_table_to_utf_8 => get_translation_table_to_utf8
  goto invalid_utf_8_start_byte  => goto invalid_utf8_start_byte
  goto utf_8                     => goto utf8
  goto utf_8_select              => goto utf8_select
  terminal_interlink.utf_8       => terminal_interlink.utf8
  utf_8_to_unicode               => utf8_to_unicode

What was not renamed:
  terminal._template_.utf_8_io option, TERM_OPT_UTF_8_IO
    Compatibility with existing elinks.conf files would require an alias.
  --enable-utf-8
    Because the name of the charset is UTF-8, --enable-utf-8 looks better
    than --enable-utf8.
  CONFIG_UTF_8
    Will be renamed in a later commit.
  Unicode/utf_8.cp, table_utf_8, aliases_utf_8
    Will be renamed in a later commit.
2006-09-17 16:06:22 +03:00
Kalle Olavi Niemitalo
8850d85998 ECMAScript: If accessKey is a surrogate, throw an error when reading it.
Surrogates are now treated the same way as out-of-range characters
like U+110000; if a link has such an access key, then the ECMAScript
accessKey property cannot be read.  It seems currently impossible to
set such an access key though, because accesskey_string_to_unicode()
doesn't support multibyte characters yet.
2006-08-27 11:45:11 +03:00
Witold Filipczyk
a5c395cd7a Workaround for segfaults introduced by previous commit.
Why html_context->part->document isn't set ?
2006-08-05 20:17:48 +02:00
Witold Filipczyk
b7409fc5a7 The fix for bug 784. There is a wide area to cleanup and tidy up the code. 2006-08-05 18:32:05 +02:00
Witold Filipczyk
bdc3fcb7e4 I forgot about this one 2006-08-05 18:08:52 +02:00
Witold Filipczyk
049d088e8a The massive attack: the only property of options used by get_attr_val was
cp (codepage). To fix bug 784 html_context->part->document->cp should
be passed to get_attr_val instead of html_context->options->cp.
2006-08-05 18:06:28 +02:00
Miciah Dashiel Butler Masters
948d010088 Drop obsolete, commented-out code in put_chars
Drop some code for superscript and subscript handling that was deleted
in commit 65016cdca4, then added back
with the UTF-8 merge in commit 2a6125e3d0,
and then disabled in commit 1b653b9765.
2006-08-03 06:12:30 +00:00
Witold Filipczyk
7af9cf5ebc The missing line:
cells += added_chars - 1;
This is a fix for bug 778.
goto next instead of continue. Not heavilly tested
2006-07-28 22:33:16 +02:00
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Witold Filipczyk
8b4daed148 Commented out the code causing infinite loop when viewing
test/backspaces.txt.
2006-07-23 16:35:53 +02:00
Witold Filipczyk
58b158871c Decode the second char of double glyph. Still problems with a splitted
char
2006-07-23 13:14:38 +02:00
Witold Filipczyk
7cb91c3213 Decode the second char from double glyph. When that char is splitted
by convert_string and that char is the beginning of double glyph too
we have a problem. This is a rare case. Must we care about it?
2006-07-23 13:04:39 +02:00
Witold Filipczyk
a3e0caca57 Return number of really processed chars. In that case 0 2006-07-23 12:27:20 +02:00
Witold Filipczyk
f5351fc0dc Remember fragment of the splitted char and decode it next time. Idea by Jonas.
Not tested at all. UCS_NO_CHAR is returned only for <hr> or for UTF-8 char
which is splitted by convert_string
2006-07-21 22:10:18 +02:00
Witold Filipczyk
7c7a0bb890 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-07-21 19:00:49 +02:00
Witold Filipczyk
1b653b9765 Compilation fix 2006-07-21 13:21:21 +02:00
Witold Filipczyk
2a6125e3d0 Merge with utf8. src/document/plain/renderer.c replaced by utf8 version 2006-07-21 13:12:06 +02:00
Miciah Dashiel Butler Masters
ecbc2271d1 examine_element: drop html_stack parameter
The stack is available via the html_context, which is passed to
examine_element as of commit f42c86be70744e62af92282e4d64fc3066f6ba04.
2006-07-21 11:10:54 +00:00
Witold Filipczyk
8a1ef2ada9 That was missing, at least I think so 2006-07-20 02:05:56 +02:00
Witold Filipczyk
b388b4afea Avoided rerendering 2006-07-20 02:03:25 +02:00
Witold Filipczyk
70a46e12aa Fixed the issue when assummed codepage is not UTF-8 2006-07-19 19:11:03 +02:00
Witold Filipczyk
44c74ac389 Refactor is_cp_special to is_cp_utf8 2006-07-18 17:51:03 +02:00
Witold Filipczyk
1adbce8429 unicode_val_T instead of unsigned char in struct search 2006-07-17 22:14:45 +02:00
Petr Baudis
85c9c54d00 Accept float widths (ceiling them)
Especially percentages might be floats instead of integer, see
e.g. http://www.armitunes.com/cgi-bin/icecast/playing.cgi.
2006-07-16 22:22:16 +02:00
Jonas Fonseca
ef051261b3 Improve upon pasky's intro to the HTML engine 2006-07-13 21:12:24 +02:00
Petr Baudis
314dbc2dab Add short intro and talk about box model 2006-07-13 03:46:16 +02:00
Petr Baudis
1ae18267f8 Kill src/document/html/TODO
In the first paragraph it lists what's already done. In the second it
lists the obvious. And the third is obsolete.
2006-07-13 02:51:31 +02:00
Laurent MONIN
36a277540c Let be more tolerant with buggy meta refresh. It should fix bug 767. 2006-07-10 21:16:14 +02:00
Miciah Dashiel Butler Masters
bfc8b17d64 Fix a bug in the plaintext renderer when handling tabs
Commit 3ce3f01f30 introduced a bug whereby
if a tab set the current position in the line to or greater than the number
of bytes remaining in the source, the line was split after the tab.
2006-06-16 21:13:33 +00:00
Laurent MONIN
ef37161070 distribute_rows_or_cols(): merge two loops. 2006-06-06 23:10:29 +02:00
Laurent MONIN
824b4374fa distribute_rows_or_cols(): simplify code. 2006-06-06 23:09:19 +02:00
Jonas Fonseca
9f3456c872 Add support for parsing space separated CSS class attribute values
Sequentially apply style for stuff like class="class1 class2".
2006-06-06 15:21:56 +02:00
Kalle Olavi Niemitalo
819b6fab80 parse_header_param stores the string via a pointer parameter.
Its return value is now an enum that lets callers know whether an
error occurred.  However, this commit changes the callers only
minimally, so they do not yet check the return value.
2006-06-05 20:22:53 +00:00
Witold Filipczyk
966d965c11 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-06-02 19:53:36 +02:00
Witold Filipczyk
53890a9a95 The label ng moved one line down 2006-06-02 19:51:32 +02:00
Laurent MONIN
8cba76541b Code simplification and tidy up. 2006-06-02 18:54:03 +02:00
Miciah Dashiel Butler Masters
6712baaee0 Comment html_context->position 2006-06-02 06:13:31 +00:00
Miciah Dashiel Butler Masters
b1a7f3f19e Add a comment to html_context->put_chars_f explaining not to use it 2006-06-02 05:53:49 +00:00
Miciah Dashiel Butler Masters
77f5585125 Use put_chrs instead of html_context->put_chars_f in element handlers
In html_subscript, html_subscript_close, html_superscript, html_quote, and
html_quote_close, use put_chrs instead of html_context->put_chars_f.
Element handlers should use put_chrs so that it can correctly handle
whitespace and stuff.
2006-06-02 05:51:24 +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
Laurent MONIN
4c5d4bcf34 Revert d19dcaa3e7 patch that breaks table
rendering.
2006-05-31 18:50:15 +02:00
Miciah Dashiel Butler Masters
c91c763d49 Eliminate link_bg
Instead of saving the old link colours when selecting a link and using that
to restore them when unselecting it, just copy the data from the document.

 - Eliminate struct link_bg and the .link_bg and .link_bg_n members
   of struct document_view.

 - Eliminate the free_link routine and don't call it from draw_doc,
   clear_link, or detach_formatted.

 - Add a .old_current_link member to struct view_state and initialise it in
   init_vs.

 - Don't save link_bg in draw_current_link.

 - Rewrite clear_link to use the document data instead of link_bg.

 - Modify init_link_drawing not to allocate ling_bg and to return a pointer
   to a static variable for the template character.
2006-05-28 01:08:46 +00:00
Miciah Dashiel Butler Masters
36e7044948 DOM: Factor get_doctype out of render_dom_document. 2006-05-28 00:39:58 +00:00
Miciah Dashiel Butler Masters
f925adbfc9 DOM: Factor done_dom_renderer out of render_dom_document. 2006-05-28 00:39:54 +00:00
Miciah Dashiel Butler Masters
3272290189 Better <q> support
Patch by Jonas Koelker, Jonas Fonseca, and me.
2006-05-28 00:37:12 +00:00
Miciah Dashiel Butler Masters
ca3fc4f7ac Mark line_break and put_chars static 2006-05-28 00:10:14 +00:00
Miciah Dashiel Butler Masters
65016cdca4 Fix superscript and subscript support
Introduce html_subscript_close callback. Draw opening and closing brackets
and carets for subscript and superscript text directly in the element
handlers rather than performing weirdness in the renderer. This both
improves readability and fixes bug 284, misplaced brackets with subscripts.
2006-05-28 00:10:13 +00:00
Miciah Dashiel Butler Masters
6947902b57 Replace special handling in end_element with callbacks
Add close callbacks html_html_close, html_style_close, and
html_xmp_close. end_element now calls the element close callback instead
of performing special handling for certain tags.
2006-05-28 00:10:13 +00:00
Miciah Dashiel Butler Masters
0f2982aa5d end_element: inconsequential code shuffling 2006-05-28 00:10:12 +00:00
Miciah Dashiel Butler Masters
03fde090cf struct element_info: add .close callback
Rename enum element_type values, shortening ELEMENT_TYPE_ to just ET_
and reformat the elements table to squeeze everything in.
2006-05-28 00:10:12 +00:00
Miciah Dashiel Butler Masters
12b5345b9a struct element_info: rename .func to .open 2006-05-28 00:10:12 +00:00
Witold Filipczyk
9fcd5ea64e Weird. The backslash removed 2006-05-26 20:03:48 +02:00
Witold Filipczyk
d19dcaa3e7 IMHO line_break should fill lines with spaces. This is done for <pre>.
See glib documentation in 256 colors for the difference.
Some lines are 1 space longer. I have no idea how to level them.
2006-05-26 19:59:20 +02:00
Witold Filipczyk
c4c97a07bd plain renderer: return when data is invalid in some cases 2006-05-10 18:18:22 +02:00
Witold Filipczyk
82d38ff2be plain renderer: rewritten change_colors, handling 256 color ESC sequences.
TODO: mono mode
2006-05-10 17:46:31 +02:00
Witold Filipczyk
c677bc010d plain renderer: stdio.h is not required 2006-05-08 10:20:37 +02:00
Witold Filipczyk
88c146a395 plain_renderer: cg-log -c | elinks works. The code needs cleanup 2006-05-07 15:49:08 +02:00
Witold Filipczyk
1feab80c13 plain renderer: used switch instead of if, else if, else 2006-05-07 14:39:27 +02:00
Pavol Babincak
bbd24d7bf4 Corrected computing cell count for html select in UTF-8. 2006-05-07 00:51:25 +02:00
Witold Filipczyk
e56f429c9b Another workaround related to tcc 2006-05-05 22:18:27 +02:00
Witold Filipczyk
ad160766b8 Added id to the form control. id is used by scripts 2006-05-01 19:22:07 +02:00
Pavol Babincak
7951d7bf22 Added: split line after any double-width character in html renderer.
Note: there are ugly bug (feature?) - when there isn't enought room for
whole double-width char two double-chars are displayed. Can be seen on
table with double-width chars reduced as much as possible.
2006-04-09 19:17:16 +02:00
Pavol Babincak
dd05c89d49 Replaced utf8_len with cells. 2006-04-09 19:07:43 +02:00
Pavol Babincak
161ccf9eae Use unicode_val_T instead of uint16_t for unicode data + cell count fix. 2006-04-09 17:04:47 +02:00
Witold Filipczyk
18280cafbb Code generated by tcc was broken for those boolean expressions 2006-04-06 22:07:45 +02:00
Pavol Babincak
8b9d06c977 Convert link titles to correct codepage before displaying it on screen.
Don't replace UTF-8 bytes with '*'. Probably there is need to do better
check what will be displayed.

Also get_current_link_title is no longer pretty and trivial. (o:
2006-03-13 01:54:34 +01:00
witekfl
3f01c3d2fe Display optionally tabs bar at top like other browser do.
TODO: input_line_layouter, ACT_MAIN_TAB_MENU
2006-03-04 10:24:37 +01:00
Timo Lindfors
212b4a2893 Fix bug #741: "html comments shouldn't be evaluted inside STYLE elements" 2006-02-22 19:45:14 -05:00
Pavol Babincak
f4a430e480 Support for double-width glyphs in DOM renderer
Removed duplicate code for UTF-8 in DOM renderer. Modified DOM renderer
to correctly displaying multi-width glyphs.
2006-02-18 20:28:01 +01:00
Pavol Babincak
fc5f2389ed Support for double-width glyphs in plain renderer
Removed duplicate code for UTF-8 in plain renderer. Modified plain renderer
to correctly displaying multi-width glyphs.
2006-02-18 20:28:00 +01:00
Pavol Babincak
f9d67aeb73 Added configure option --enable-utf-8
For enabling better UTF-8 support by Witek and Scrool.
2006-02-18 20:28:00 +01:00
Witold Filipczyk
44a1aa9c87 Witekfl's UTF-8 patch v5. 2006-02-18 20:27:46 +01:00
Miciah Dashiel Butler Masters
190259ca22 mem_alloc_align: drop the obj type parameter
Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
2006-02-17 17:32:59 +00:00
Eric Wald
3ce3f01f30 Add support for forcing wrapping at the screen boundary
This patch modifies ELinks wrapping behavior slightly.

 * The wrap command now toggles line wrapping in HTML mode, as well as
   text mode.  Note that when the HTML view of a page is wrapped, its
   source view is unwrapped, and vice versa.
 * Tabs in text-mode lines are now handled correctly.
 * Wrapping a line that reaches exactly to the edge of the screen will
   no longer produce a blank line in text mode.
 * Text within extra-wide table cells is now wrapped to less than the
   screen width, to eliminate sideways scrolling.

The last point is only enabled by setting TABLE_LINE_PADDING to a
non-negative number, in the src/setup.h header file, because it is a
significant change of behavior from previous versions.
2006-02-15 15:50:29 +01:00
Miciah Dashiel Butler Masters
2c087e52e7 Revert unstable 'Eval embedded scripts at once'
Revert commit 2f0490cb04
('Eval embedded scripts at once') and follow-up commit
997f61bb32 ('Use document_view instead of
view_state. It is safer probably') because the change causes crashes on
numerous pages and just looks wrong.
2006-02-12 15:03:12 +00:00
Miciah Dashiel Butler Masters
b8ee886a60 sort_links: fix memory leak
Free document->lines1 and document->lines2 if they are already set. This
fixes a memory leak from commit 52d3a6411d.
2006-02-03 20:12:24 +00:00
Jonas Fonseca
92a9cafb6e DOM: Replace various DOM status/error/exception codes with dom_code enum
Replaces sgml_parser_code, dom_stack_code, and dom_exception_code and
generally tries to simplify things and remove redundant codes.
2006-01-31 22:01:35 +01:00
Jonas Fonseca
ca5a5f230a Make render_dom_node_source static 2006-01-29 12:11:35 +01:00
Jonas Fonseca
2e3e18595f Normalize all links added by the plain renderer
Fixes problems with host or protocol parts not being lowercased. This
triggers an assertion failure when trying to download such links. Reported
by lindi-.
2006-01-29 09:04:52 +01:00
52d3a6411d Sort links when necessary 2006-01-28 14:13:41 +01:00
dacb694e33 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-01-28 12:11:29 +01:00
997f61bb32 Use document_view instead of view_state. It is safer probably 2006-01-28 12:07:00 +01:00
9cc9db4e24 Handling onsubmit 2006-01-28 11:17:22 +01:00
6e4c80a29e Avoid memleak 2006-01-28 08:37:58 +01:00
Laurent MONIN
5114c9d110 Trim trailing whitespaces. 2006-01-28 01:59:22 +01:00
Laurent MONIN
bae3b58146 Fix a potential memleak. 2006-01-28 01:58:00 +01:00
b1b66db850 Success. document.write works for me. 2006-01-27 16:54:39 +01:00
9c9fa1d81c Defined document.write and document.writeln for SEE 2006-01-27 14:55:53 +01:00
8bf45d0ece Spidermonkey's document.write and document.writeln defined. They work,
but rendering doesn't work
2006-01-27 13:29:38 +01:00
2551fe3525 Render html written by document.write. I'm not sure if format_html_part
is called right way
2006-01-27 12:41:35 +01:00
62d42380f8 Added ret param for document.write 2006-01-27 12:07:45 +01:00
2f0490cb04 Eval embedded scripts at once 2006-01-27 10:26:58 +01:00
Jonas Fonseca
bea1a0c559 Handle <base href=""> for HTML source rendering
Requested by witekfl.
2006-01-25 23:16:30 +01:00
Jonas Fonseca
89a95a5fc5 Rename enum html_element_type to html_element_mortality_type
This name is reserved for DOM.
2006-01-25 23:13:10 +01:00
Miciah Dashiel Butler Masters
3b5724edd5 look_for_link: simplify string
Use stracpy(empty_string_or_(target_base)) instead of
null_or_stracpy(target_base) and then stracpy("") if that returns NULL.
2006-01-18 20:38:33 +00:00
Jonas Fonseca
1d52d67e50 Add get_dom_node_child() which searches for a node with given type 2006-01-16 07:11:02 +01:00
Jonas Fonseca
6c85c0f009 Add DOM configuration inspired module
It add support for normalizing a DOM document in various ways, such as
removing comments, converting CDATA section nodes to text nodes, cleanup
whitespace, etc.

Use it in the RSS renderer to sanitize the text to be rendered.
2006-01-16 05:12:34 +01:00
Jonas Fonseca
eecc22751d Use dom_stack_code enum for dom_stack_callback_T 2006-01-16 00:55:58 +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
Jonas Fonseca
0950996dd8 Change parse_sgml() to take buf+bufsize instead of DOM string 2006-01-14 11:32:11 +01:00
Laurent MONIN
5685221512 Trim trailing whitespaces. 2006-01-13 00:11:39 +01:00
Jonas Fonseca
63d754f85b Convert the RSS title string 2006-01-09 19:14:28 +01:00
Jonas Fonseca
4dd9db446b init_html_parser_state(): Drop local html_element variable 2006-01-09 02:56:44 +01:00
Jonas Fonseca
20bd19e4c5 The RSS document title to channel->title 2006-01-09 02:18:57 +01:00
Jonas Fonseca
5339525f1d Oops, kill_html_stack_top() -> pop_html_element() 2006-01-09 01:40:16 +01:00
Jonas Fonseca
fe10af364d Introduce pop_html_element(); wraps kill_html_stack_item(..., html_top) 2006-01-09 01:29:40 +01:00
Jonas Fonseca
94fd9303f3 Introduce html_bottom; similar to html_top 2006-01-09 01:24:54 +01:00
Jonas Fonseca
27283098f4 Clearify code a little 2006-01-09 01:24:38 +01:00
Jonas Fonseca
5808b4ae0c Make html_top have a pointer type; use it to declare format and par_format 2006-01-09 01:22:33 +01:00
Jonas Fonseca
bc55cd55cb Add the basic support for rendering RSS documents
It is very simple for now, so it only displays headlines and doesn't
support a whole lot of RSS flavours.
2006-01-08 03:44:23 +01:00
Laurent MONIN
31c30864e0 Trim trailing whitespaces. 2006-01-04 18:08:48 +01:00
Jonas Fonseca
359a29bb40 Make it possible to use more CSS properties with the source highlighting 2006-01-04 00:50:40 +01:00
Jonas Fonseca
af72dd8435 Make parse_sgml() return the sgml_parser_code enum
It is mostly just ignored for now. The SGML parser test tool will however
return parser code.
2006-01-02 17:40:42 +01:00
Jonas Fonseca
f608e2a0ae Add the concept of completeness to strings being parsed and scanned
... not used yet.
2006-01-02 02:08:20 +01:00
Laurent MONIN
54997c506f Drop trailing whitespaces. 2006-01-02 00:15:20 +01:00
Jonas Fonseca
021af4e87c Although aware ELinks doesn't need another sgml/doctype here is DocBook
It was created a long time ago so (I think) it deserves to survive. It
maps .sgml files to applicatino/docbook+xml and uses the highlighter.
2006-01-01 23:22:10 +01:00
Jonas Fonseca
7d64cb893c Improve (or rather fix) how document types are matched in the DOM renderer 2006-01-01 23:14:16 +01:00
Jonas Fonseca
c656a96a73 Use the simpler strcasecmp() instead of strcaselcmp() 2006-01-01 23:05:34 +01:00
Jonas Fonseca
479039fb9e Also highlight HTML if the MIME type is application/xhtml+xml 2006-01-01 23:02:41 +01:00
Jonas Fonseca
9a0bf83756 Add basic stuff for XBEL parsing/highlighting using the DOM engine 2005-12-30 22:19:32 +01:00
Jonas Fonseca
ff75d5086f Remove the DOM track tracer from the renderer 2005-12-30 13:08:42 +01:00
Jonas Fonseca
6e163b186c Make the dom_scanner_token store it's string in a dom_string struct 2005-12-28 16:23:36 +01:00
Jonas Fonseca
d1e275be52 Make parse_sgml() take buffer as dom_string struct 2005-12-28 15:21:45 +01:00
Jonas Fonseca
11e168aba4 Make init_sgml_parser() take URI as dom_string struct 2005-12-28 15:19:10 +01:00
Jonas Fonseca
a21f192199 Remove some left over .vimrc files 2005-12-28 14:14:12 +01:00
Jonas Fonseca
71533eef9a Elute all DOM-related code and put it in src/dom 2005-12-28 14:05:14 +01:00
Jonas Fonseca
217f905d88 call_dom_stack_callbacks(): Only acquire the state data if needed 2005-12-27 15:22:06 +01:00
Jonas Fonseca
a31eaaabdd Rename parse_sgml_document() -> parse_sgml_plain()
It really can be anything. I visited the elusive HTML parser to find the
new ending. ;)
2005-12-27 06:22:53 +01:00
Jonas Fonseca
9e7dfb1ddf Make walk_dom_nodes() use a stack context; reduces the DOM stack state size 2005-12-27 06:04:01 +01:00
Jonas Fonseca
a4831fef2d Make it easier to work with DOM stack contexts outside of the callbacks
The problem is to get access to the context when it is not the first one
and it has to happen outside of the context callbacks. This changes the
memory management so that the context adder returns the context. To further
improve the use of contexts add a context destructor which makes it
possible to unregister (temporary) contexts.
2005-12-27 05:59:12 +01:00
Jonas Fonseca
774aa70c6f Drop (now) unused get_dom_stack_parent() wrapper for get_dom_stack_state() 2005-12-27 04:44:20 +01:00
Jonas Fonseca
af19f811e3 Simplify DOM node popping
.. by turning do_pop_dom_node() into pop_dom_node() and let pop_dom_state()
handle it's own logic for reaching the wanted state.
2005-12-27 04:42:28 +01:00
Jonas Fonseca
f371de1638 Restructure the SGML parser file and add comments to the main parts 2005-12-27 03:57:56 +01:00
Jonas Fonseca
f5b32f86d1 Drop some dead code related to past rendering of DOM attribute nodes 2005-12-27 03:55:34 +01:00
Jonas Fonseca
b36229c222 Drop some unneeded #includes 2005-12-27 03:33:49 +01:00
Jonas Fonseca
0e2eefcb82 Add missing HTML_(SCRIPT, ...) definition 2005-12-27 01:58:54 +01:00
Jonas Fonseca
74a0a7b174 Highlight the 'CDATA' part of <![CDATA[ (in a bit hacky way) 2005-12-26 20:51:01 +01:00
Jonas Fonseca
c99b1cc2cc Render content of CDATA sections with orange2 (in lack of something better) 2005-12-26 19:56:07 +01:00
Jonas Fonseca
e28f3fc592 Drop macros in favour of more informative direct calls to add_sgml_node() 2005-12-26 19:45:58 +01:00
Jonas Fonseca
98d7263c2f Parse <[CDATA[ sections ]]> 2005-12-26 19:43:32 +01:00
Miciah Dashiel Butler Masters
92c9b86374 In add_document_line, check expanded + line_pos rather than just
expanded when checking whether there are enough characters on the line
to decrement expanded by 2. This fixes the problem reported by fonseca
where the linked text was offset from the URI when there were backspaces
earlier on the line.
2005-12-26 11:43:18 +00:00
Miciah Dashiel Butler Masters
e64871f5e2 Drop some dead code in add_document_line: line_pos should never be
negative.
2005-12-26 10:31:06 +00:00
Jonas Fonseca
be8c68c5f7 Fix matching of file:// URLs which of course have no host name 2005-12-25 16:22:20 +01:00
Jonas Fonseca
5dd9061a55 Allocate the string of nodes being 'linkified'
This makes the string actually NUL terminated at the right place and the
matching will never go beyond the text region of the node. One example is
<!--http://elinks.cz/--> which didn't work before.
2005-12-25 16:08:00 +01:00
Jonas Fonseca
2d020e4879 Extend the URL_REGEX to allow more protocol and stuff like %XX in path part
Thanks to peder for suggestions.
2005-12-25 15:45:47 +01:00
Jonas Fonseca
4fa0937ca5 Make URL inside cdata, comment and text nodes accessible
It depends on existence of <regex.h> system header and that can be enabled
via document.plain.display_links. The URL regex was supplied by yanek.
2005-12-25 15:16:21 +01:00
Jonas Fonseca
dda6064b47 Add support for nested calls to parse_sgml()
It introduces a secondary stack for the SGML parser which records a parsing
in progress (stuff like the scanner and depth where the parsing began).
This should make it possible to eventually call parse_sgml() with the
output created from the ECMASCript's document.write() function or even
output from processing instructions (for example <?php code ?> ;).
2005-12-25 05:43:01 +01:00
Jonas Fonseca
cb90dcd58c Remove unused variable 2005-12-25 05:19:55 +01:00
Jonas Fonseca
f2ba5e7f6b Cleanup and remove unnneded code 2005-12-25 04:40:58 +01:00
Jonas Fonseca
40ae683bfb match_attribute_value(): Actually do the matching
This is still untested like the last patch.
2005-12-25 04:38:30 +01:00
Jonas Fonseca
fc35d9ee33 Implement matching of element relations for DOM selection
It requires searching the select_data stack for all matches of the parent
selector and check the properties of matched nodes.
2005-12-25 03:48:53 +01:00
Jonas Fonseca
1347678988 Introduce get_dom_node_list_index() to lookup the index of a node in a list 2005-12-25 03:46:01 +01:00
Jonas Fonseca
d36b2d8a36 get_dom_select_data(): Move macro nearer to its users 2005-12-25 02:43:08 +01:00
Jonas Fonseca
ce2aa08cb1 Compile fix 2005-12-24 13:07:57 +01:00
Jonas Fonseca
8d30613a7f The child node list can be NULL when matching for the :empty pseudo-class
Also use the children node list and not the attribute list (aka the map).
2005-12-23 01:03:39 +01:00
Jonas Fonseca
3ea1b30fd6 Fix matching of the :root structural pseudo-class
Root nodes either have no parents or are the single child of the document
node.
2005-12-23 00:59:56 +01:00
Jonas Fonseca
755108cf95 Tidyup 2005-12-23 00:53:31 +01:00
Jonas Fonseca
4d6223f6a4 Oops, compile fix 2005-12-23 00:52:52 +01:00
Jonas Fonseca
12d34fd133 Factor out code to new match_element_selector()
'Twill make it easier to do the logic.
2005-12-23 00:51:57 +01:00
Jonas Fonseca
07fc481607 match_attribute_selectors(): Factor out matching of values to own function 2005-12-23 00:11:25 +01:00
Jonas Fonseca
262856273e Drop unused get_dom_node_attributes(), comment get_dom_node_list() 2005-12-22 23:42:23 +01:00
Jonas Fonseca
faa85adf73 dom_select_push_element(): Use dom_node_casecmp() and drop homegrown one 2005-12-22 23:40:11 +01:00
Jonas Fonseca
1f47fabf5e Rename dom_node_cmp() to dom_node_casecmp() and make it public 2005-12-22 23:37:59 +01:00
Jonas Fonseca
b13a21bbc2 dom_node_cmp(): Make it into a general node comparer 2005-12-22 23:35:17 +01:00
Jonas Fonseca
6dfd7a5988 When searching DOM node lists store the subtype in the search struct's node 2005-12-22 23:29:07 +01:00
Jonas Fonseca
558e2736e4 search_dom_stack(): Use dom_string_casecmp() for comparison 2005-12-22 22:28:38 +01:00
Jonas Fonseca
c4a1031b2e Move code for the final source highlight flushing to document pop callback
This requires the document root stack state is made mutable and is popped.
Should make render_dom_document() more generalised. For SGML_PARSER_STREAM
this has the fun property that the stack will magically free the root node.
2005-12-22 12:33:27 +01:00
Jonas Fonseca
6f3f859578 parse_sgml(): After parsing pop the stack back to the depth it was before 2005-12-22 12:28:22 +01:00
Jonas Fonseca
4eae1d4882 Add a few comment and remove an obsolete one 2005-12-22 04:00:55 +01:00
Jonas Fonseca
9c720c2cc8 Rename the DOM tree renderer to DOM stack tracer
Use add_dom_stack_tracer(stack) to have stack activity traced. It is only
active when DOM_STACK_TRACE is defined.
2005-12-22 03:55:55 +01:00
Jonas Fonseca
cb64068712 Make it so that the indent string used by the tree renderer needs no init 2005-12-22 03:33:56 +01:00
Jonas Fonseca
f21fcd132f Oops, do not define DOM_TREE_RENDERER by default 2005-12-22 03:21:52 +01:00
Jonas Fonseca
6cb9a841b6 Add FIXME about optimizing walk_dom_nodes() 2005-12-22 03:20:11 +01:00
Jonas Fonseca
eab6c19bbe Add lots of comments and FIXMEs 2005-12-22 03:19:53 +01:00
Jonas Fonseca
25e0a18b7f Misc DOM select fixes
- ensure done_dom_stack() is called after parsing is done
 - get_dom_select_data(): Use stack->current->data since it is used within
   dom_stack_callback_T
 - dom_select_pop_element(): Use stack->contexts since it is the
   select_data stack and it owns the first context
 - add the select_data context to the right stack
 - fix some comments
2005-12-21 23:26:22 +01:00
Jonas Fonseca
45592ea5a7 Make the DOM tree renderer thing usable without a dom_renderer defined
It now hardcodes the codepage to ASCII when showing entity references.
The tree debug context info is also exported.
2005-12-21 22:32:27 +01:00
Jonas Fonseca
d6c5640f29 Turn the DOM tree renderer into a debug module
Define DOM_TREE_RENDERER and run as:

	ELINKS_LOG=/tmp/dom-dump.txt ./elinks -no-connect <url>

to have a trace of DOM tree dumped into a file.
2005-12-21 14:41:28 +01:00
Jonas Fonseca
fe6637dd7d Fix the DOM tree renderer to work with the new stack interface 2005-12-21 14:05:01 +01:00
Jonas Fonseca
419d9d165a get_dom_stack_state_data(): Make static inline and handle zero object size 2005-12-21 13:56:18 +01:00
Jonas Fonseca
9360f88d65 search_dom_stack(): No need to inline this at least not while debugging 2005-12-21 13:48:37 +01:00
Jonas Fonseca
779a8a4553 Improve comments 2005-12-21 13:46:28 +01:00
Jonas Fonseca
edee14699e Reorder some struct and fix some comments 2005-12-21 04:57:25 +01:00
Jonas Fonseca
2a24ad9099 Introduce enum dom_stack_flag to make init_dom_stack() more obvious 2005-12-21 04:48:50 +01:00
Jonas Fonseca
632f12f82a init_dom_stack(): Drop unused object_size argument 2005-12-21 04:41:35 +01:00
Jonas Fonseca
f8d48e81eb Move the state_objects to the DOM stack contexts
This way all contexts are now separated, almost.
2005-12-21 04:38:04 +01:00
Jonas Fonseca
910c51abaf Remove the now unused DOM stack data member 2005-12-21 03:59:46 +01:00
Jonas Fonseca
da33827771 Use a (for now bogus) DOM stack context for holding DOM select data 2005-12-21 03:57:17 +01:00
Jonas Fonseca
225e3a6764 Use a (for now bogus) DOM stack context for holding the SGML parser data 2005-12-21 03:39:17 +01:00
Jonas Fonseca
87d8c890dd Define convinience macros for getting parser and parser states from stack 2005-12-21 03:12:35 +01:00
Jonas Fonseca
3374f3cbba Drop data member from struct sgml_parser it is at stack->current->data 2005-12-21 01:36:47 +01:00
Jonas Fonseca
c524655362 Add current member to struct dom_Stack which holds the current context 2005-12-21 01:32:43 +01:00
Jonas Fonseca
0faa8d7462 Add a data member to struct dom_stack_context (not used yet) 2005-12-21 01:25:50 +01:00
Jonas Fonseca
12a2f96920 Introduce struct dom_Stack_context
- For now it just stores the dom_stack_context_info reference.
 - Rename dom_stack members to contexts and contexts_size.
 - Use mem_alloc_align based rellocation scheme.
2005-12-21 01:15:19 +01:00
Jonas Fonseca
a77242738c Rename: add_dom_stack_callbacks() -> add_dom_stack_context() 2005-12-21 01:04:37 +01:00
Jonas Fonseca
3843be25af Rename: struct dom_stack_callbacks -> struct dom_stack_context_info 2005-12-21 00:58:22 +01:00
Jonas Fonseca
5f9583579e And the SGML parser should not add any callbacks anymore 2005-12-20 21:12:25 +01:00
Jonas Fonseca
0834e77252 Make the DOM renderer add its own DOM stack callbacks 2005-12-20 21:10:09 +01:00
Jonas Fonseca
1228ef8d48 Create the SGML parser->root node on demand
This way all callbacks added after init_sgml_parser() will have their
document node push callback invoked.
2005-12-20 21:08:47 +01:00
Jonas Fonseca
625725f0e9 Allow for multiple callbacks to be attached to the DOM stack 2005-12-20 20:27:20 +01:00
Jonas Fonseca
e309de8950 Introduce call_dom_stack_callbacks as a common way to call back 2005-12-20 20:01:18 +01:00
Jonas Fonseca
d6b125fa68 Drop the return value from dom_stack_callback_T
... since the feature with popping the node if the return value is NULL is
not used and it doesn't make a lot of sense with multiple callbacks.
2005-12-20 19:48:33 +01:00
Jonas Fonseca
990c5e0a26 Combine DOM stack push and pop callbacks into one struct 2005-12-20 19:20:04 +01:00
Miciah Dashiel Butler Masters
9559871fd0 Add src/document/sgml/rss/Makefile. 2005-12-20 05:29:05 +00:00
Miciah Dashiel Butler Masters
178bc908e1 Drop an unnecessary and non-existent #include, added in commit
56d634b946.
2005-12-20 05:28:36 +00:00
Jonas Fonseca
ec9f41c1cd Retire specialized proc-instruction DOM renderer callback
It now uses the DOM element callback. Before the proc-instruction
attributes was shown twice.
2005-12-20 03:25:51 +01:00
Jonas Fonseca
56d634b946 Add basic support for RSS parsing for application/rss+xml content types
This means the RSS source will be highlighted, but by default the HTML
renderer will be used for the default rendering.
2005-12-20 03:08:13 +01:00
Jonas Fonseca
5777941d06 DOM select: Completely rewrite the parser for nth arguments 2005-12-20 01:50:39 +01:00
Jonas Fonseca
c2e30c8eea get_child_dom_select_node(): Use the foreach_dom_node iterator 2005-12-20 01:48:21 +01:00
Jonas Fonseca
ceffe8f1a4 Make the SGML parser ready for (specializing) doctypes other than HTML 2005-12-20 01:04:33 +01:00
Jonas Fonseca
f6e551379e Remove some includes which are no longer needed 2005-12-20 00:48:34 +01:00
Jonas Fonseca
8e769d48a5 Misc cleanups and improvements 2005-12-20 00:01:18 +01:00
Jonas Fonseca
3b412553b6 match_attribute_selectors(): Fix warning about uninitialized attr variable
Outspitten on FreeBSD.
2005-12-19 22:13:23 +01:00
Jonas Fonseca
2e2c0a590e Add basic functionality for selecting DOM nodes based on CSS3 selectors
The design should more or less be in place. There is still a lot of things
missing but it should actually be enough for using it in a simple RSS renderer.

Amongst several things, :nth-* pseudo-classes and :not() syntax is not in
place.
2005-12-19 03:44:18 +01:00
Jonas Fonseca
b64e122159 Change order of variables given to foreach_dom_node iterators 2005-12-19 02:57:00 +01:00
Jonas Fonseca
330c0174e5 Rename DOM stack iterators and make them include all states when iterating
They are now called: foreach{back,}_dom_stack_state (...) and the immutable
flag together with node type restricted stack searches should ensure that
the document root node never is popped.
2005-12-19 02:51:32 +01:00
Jonas Fonseca
051db70dd4 Add boolean immutable flag to the DOM stack state
Can be used to ensure the document root node never leaves the stack while
parsing.
2005-12-19 02:34:26 +01:00
Jonas Fonseca
ee1eba9689 Rename: dom_stack_has_parents() -> dom_stack_is_empty() (with negated value) 2005-12-19 02:15:36 +01:00
Jonas Fonseca
bc338207e7 do_pop_dom_node(): move dom_stack_has_parents() to assertion
All callers already checks if the stack is empty.
2005-12-19 02:05:43 +01:00
Witold Filipczyk
d09bdf7c28 Fix problem with double decompression of local files
ELinks tries decompress local gziped files twice, which causes problems
with some files eg. with this README.gz. This patch prevents it.
2005-12-18 17:03:34 +01:00
Jonas Fonseca
45861c68e1 pop_dom_state(): Drop unused left-over argument 2005-12-15 22:05:30 +01:00
Jonas Fonseca
ef5d5fc27a dom_node_cmp(): Only use element or attribute type ID if both are set 2005-12-15 22:02:02 +01:00
Jonas Fonseca
c2d27a33d8 Rename: nav -> stack 2005-12-15 17:24:20 +01:00
Jonas Fonseca
5ef041c051 Redo the assertm() message to just show the type of the node and parent 2005-12-13 20:08:58 +01:00
Jonas Fonseca
2eebef098d Prepare the CSS scanner for tokenizing ~ and + as char tokens
They are used for "E ~ F" and "E + F" element relations.
2005-12-13 16:35:41 +01:00
Jonas Fonseca
d1635d6970 Fix wrong assertion message string
You just cannot print dom_string structs with %s.
2005-12-13 16:33:50 +01:00
Jonas Fonseca
f35026ecfb Add DOM_NODE_UNKNOWN node type for internal purposes only 2005-12-13 04:52:47 +01:00
Jonas Fonseca
771a2eea82 Prepare the CSS scanner for parsing [foo{|,*,^,$,}=bar] selectors 2005-12-13 04:50:30 +01:00
Jonas Fonseca
5ff0849eb3 set_dom_string(): take length as size_t; -1 means use strlen() to get size 2005-12-12 17:42:26 +01:00
Jonas Fonseca
27116d6385 Make the DOM stack and the SGML parser interface more general
They now both hold a single private data member. This means the parser now
holds the renderer data.
2005-12-12 17:41:09 +01:00
Jonas Fonseca
458fc5ee79 Review and change dom_string specific uint16_t value to size_t 2005-12-10 22:24:30 +01:00
Jonas Fonseca
c1136b8791 Use dom_string for storing sgml_node_info data
Reduces code redundancy for node searching. Oh, comment the purpose
of the special SGML_NODE_HEAD() macro.
2005-12-10 21:58:59 +01:00
Jonas Fonseca
cdc749def3 get_dom_node_value(): indent switch 2005-12-10 21:50:40 +01:00
Jonas Fonseca
86c9a37810 Factor out dom_string_casecmp() 2005-12-10 21:49:33 +01:00
Jonas Fonseca
87aad88c96 Use dom_string throughout the DOM stack interface 2005-12-10 21:42:49 +01:00
Jonas Fonseca
0fab644bee get_dom_node_value(): move non-compliant functionality to the tree renderer
Entity references are supposed to have a null value and the string
compression is for improving the tree view.
2005-12-10 21:37:47 +01:00
Jonas Fonseca
52f5276f92 get_dom_node_name(): indent switch statement 2005-12-10 20:05:01 +01:00
Jonas Fonseca
295679a5e6 get_dom_node_name(): return struct dom_string *
Also, simplify the rendering a bit for now.
2005-12-10 20:03:43 +01:00
Jonas Fonseca
7d6db6b152 Update the DOM tree renderer to support dom_strings 2005-12-10 19:44:01 +01:00
Jonas Fonseca
2aedeb0a67 get_dom_node_type_name(): return struct dom_string * 2005-12-10 19:28:37 +01:00
Jonas Fonseca
5f69255cbc get_dom_node_map_entry(): take name as a dom_string
Requires that dom_string->length becomes a size_t.
2005-12-10 19:21:12 +01:00
Jonas Fonseca
0546759b4b Use struct dom_string for node->proc_instruction.instruction 2005-12-10 18:59:17 +01:00
Jonas Fonseca
9935bf2083 Convert some yet unused strings to use the dom_string struct
Also remove the unneeded path member from the dom_node_id_item struct. It
was obsoleted by the addition of dom_node->parent.
2005-12-10 18:51:08 +01:00
Jonas Fonseca
ed7a292966 Use struct dom_string for node->attribute.value 2005-12-10 18:42:54 +01:00
Jonas Fonseca
ce3778c3c0 Add struct dom_string
In time it should be used for all strings in the DOM engine.
For now it is just used for node->string.
2005-12-10 18:37:47 +01:00
Miciah Dashiel Butler Masters
f9dea85126 Drop a line that should have been dropped with commit
3719e75068, 'Reduce code redundancy.'
2005-12-10 16:24:54 +00:00
Laurent MONIN
20cb9ad9ee html_option(): optimize code. 2005-12-08 16:33:37 +01:00
Laurent MONIN
8fe86a1a63 Drop trailing spaces. 2005-12-08 16:27:51 +01:00
Laurent MONIN
3719e75068 Reduce code redundancy. 2005-12-08 16:26:37 +01:00
Laurent MONIN
1f7aa841aa Simplify tests. 2005-12-08 16:25:22 +01:00
Laurent MONIN
d9f0de82f8 Use closing_tag variable in tests. 2005-12-08 16:22:53 +01:00
Laurent MONIN
37ec65247d Minor code reordering. 2005-12-08 16:20:13 +01:00
Laurent MONIN
279f2bec93 Goto see instead of se. 2005-12-08 16:19:20 +01:00
Laurent MONIN
a499bf5a61 Introduce closing_tag variable. 2005-12-08 16:16:28 +01:00
Laurent MONIN
ae00f391f2 t_name -> name, t_namelen -> namelen. 2005-12-08 16:13:21 +01:00
Laurent MONIN
5f66f98b66 Prevent useless tests when @namelen is 0. 2005-12-08 16:11:19 +01:00
Jonas Fonseca
8aa078393a Move dom_node_data union outside the dom_node struct 2005-12-08 03:26:34 +01:00
Jonas Fonseca
45958b773a Merge with dom-stack-keep-nodes 2005-12-08 03:07:20 +01:00
Jonas Fonseca
4480a9a4cd Removes node from the DOM tree when using the SGML stream parser
That should free up some short-term memory.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
2005-12-08 03:02:27 +01:00
Jonas Fonseca
8f97dc8403 done_dom_node(): remove the node from all parent lists
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
2005-12-08 02:59:40 +01:00
Jonas Fonseca
93fb17ea2a Indent switch statement
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
2005-12-08 02:32:23 +01:00
Jonas Fonseca
ce5bf8c6f8 Fix DOM node list iterators macros
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
2005-12-08 02:04:13 +01:00
Jonas Fonseca
1c2f271782 Add parent member to dom_node
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
2005-12-08 01:35:48 +01:00
Laurent MONIN
a1284ccd1f skip_table(): simplify code. 2005-12-07 20:51:09 +01:00
Laurent MONIN
f3838bac5b parse_table(): cache to_upper() result. 2005-12-07 20:36:07 +01:00
Laurent MONIN
485e16c6c9 parse_table(): optimize code a bit. 2005-12-07 20:32:36 +01:00
Laurent MONIN
53cbf3e3df parse_table(): introduce a local variable @is_header to cache test result. 2005-12-06 15:38:34 +01:00
Laurent MONIN
90d843e8fc parse_table(): re-order code. 2005-12-06 15:35:52 +01:00
Laurent MONIN
a00dfbecf9 parse_table(): fix missing goto see. 2005-12-06 15:32:02 +01:00
Laurent MONIN
29a80ce4eb parse_table(): optimize even more using @closing_tag. 2005-12-06 15:19:44 +01:00
Laurent MONIN
b63dd28500 parse_table(): use strlcasecmp() instead of strncasecmp(). 2005-12-06 15:17:56 +01:00
Laurent MONIN
3fe59e8c7a parse_table(): totally drop @t_name and @t_namelen in favor of @name
and @namelen.
2005-12-06 15:15:25 +01:00
Laurent MONIN
975a4251e8 parse_table(): reorder code to optimize even more. 2005-12-06 15:07:49 +01:00
Laurent MONIN
b6c54846ad parse_table(): reduce code redundancy. 2005-12-06 15:02:45 +01:00
Laurent MONIN
a371f22b22 parse_table(): use intermediate variables to optimize tests. 2005-12-06 14:57:25 +01:00
Jonas Fonseca
b06a8adeac Move parser root node initialization to init_sgml_parser()
... parse_sgml() in theory should be able to be called multiple times.
2005-12-06 12:30:53 +01:00
Jonas Fonseca
69b321cb5b Replace struct cache_entry member with struct uri member
Reduces the number of (unused) dependencies. Also, update the #include
list removing old entries.
2005-12-05 23:47:23 +01:00
Jonas Fonseca
38b8503161 Remove document member from struct sgml_parser
The document URI can be accessed from the cache entry.
2005-12-05 23:31:54 +01:00
Jonas Fonseca
1d24d549e4 Merge with dom-parser-stream 2005-12-05 19:41:56 +01:00
Jonas Fonseca
c7ad6f967b Introduce new pop_dom_state()
It's basically pop_dom_nodes() without the search part and is now used as a
backend in pop_dom_nodes(). Use it in parse_sgml_document() to avoid two
DOM stack searches in a row.
2005-12-05 19:40:35 +01:00
Jonas Fonseca
1c4a0d67ce Restore highlighting of element end-tags
... by installing a pop-callback for elements and responding to whatever
the parser has put in the end_token parser state member.
2005-12-05 19:33:15 +01:00
Jonas Fonseca
9aebb66bce Introduce separate push/pop callbacks
This should make it possible to do the SAX (parser stream thing) for XBEL.
And will also be used for fixing the end-tag highlighting.
2005-12-05 19:31:42 +01:00
Jonas Fonseca
d7d5fcab4d Save the end tag token in the SGML parser state
... so that the renderer eventually can pick it up and highlight it.
2005-12-05 19:28:23 +01:00
Jonas Fonseca
7a912795e1 Make the parser stream mode work as intended
This makes the parser and renderer share the stack, most importantly the
callbacks are now those of the renderer. Disable node attribute rendering
code that worked around the attributes being visited in sorted order.
2005-12-05 19:25:13 +01:00
Jonas Fonseca
2dddf86acc Initialize the renderer before initializing the parser
... so it is ready when/if the parser will push any initial states.
2005-12-05 19:20:48 +01:00
Jonas Fonseca
65b504f093 Remove all traces of the element end-tag hilighting hack
End-tags will stay uncolored for the next few commits.
2005-12-05 11:21:08 +01:00
Jonas Fonseca
4c8d871404 Introduce sgml_parser_type for specifying tree and streaming parsers
Mostly added for the future, since currently only one parser type is
supported.
2005-12-05 11:19:13 +01:00
Jonas Fonseca
05a61cd16a Update the DOM stack comment for things to come 2005-12-05 11:16:52 +01:00
Jonas Fonseca
8f25d73013 Use separate data variables for storing DOM stack data
They will eventually have to share the stack.
2005-12-05 11:16:05 +01:00
Jonas Fonseca
f85b498375 Add FIXME about using DOM node subtypes when searching the DOM stack 2005-12-05 11:11:40 +01:00
Jonas Fonseca
208515c82f Fix access to free()d memory in the DOM stack state data
There already was one work-around in the code related to clearing of the
state data after popping. Instead of storing a pointer to the state data in
the state we now store the depth of the state (in the stack) and use a
macro to access the state data. The bug occurred when reallocating the
stack state objects and the stack data pointers wasn't updated to point to
the newly allocated data.
2005-12-05 11:11:06 +01:00
Jonas Fonseca
cc416b2234 Prospone pushing of DOM nodes on the stack until they are fully initialized
Goes for both attributes and elements.
2005-12-05 10:26:55 +01:00
Laurent MONIN
eb74cdf6f9 html_button(): drop suspect line which has nothing to do with BUTTON
html element.
2005-12-05 09:57:54 +01:00
Laurent MONIN
15a7069fea Move code from html_input() to new html_input_format(). 2005-12-04 18:25:23 +01:00
Laurent MONIN
b863b65fbc html_input(): minor code reordering. 2005-12-04 12:45:42 +01:00
Laurent MONIN
a57c193ad9 html_input(): drop local variable @type, use @fc->type directly. 2005-12-04 12:43:53 +01:00
Laurent MONIN
7a443d0f73 html_input(): re-order type tests a bit. 2005-12-04 12:40:38 +01:00
Laurent MONIN
a5a731a77b html_input(): increase indentation a bit to drop a goto/label. 2005-12-04 12:38:19 +01:00
Laurent MONIN
1223850567 html_input(): improve the test logic and simplify the code. 2005-12-04 12:35:55 +01:00
Laurent MONIN
e222bb733c html_button(): improve the logic. 2005-12-04 12:27:22 +01:00
Laurent MONIN
2df9c06c46 Tidy up. 2005-12-04 12:24:39 +01:00
Laurent MONIN
d1f8b8061c html_form(): prevent useless second test by using else if instead of if. 2005-12-04 12:21:43 +01:00
Laurent MONIN
37b1fcadea distribute_table_widths(): simplify. 2005-12-01 11:39:39 +01:00
Laurent MONIN
978eff94ad Move code from format_table() to new distribute_table_widths(). 2005-12-01 11:37:08 +01:00
Laurent MONIN
ac01cbba30 draw_table_caption(): reduce indentation level. 2005-12-01 11:33:43 +01:00
Jonas Fonseca
b42c3f5bd2 Merge with git+ssh://pasky/srv/git/elinks.git 2005-11-30 01:28:34 +01:00
Laurent MONIN
40829d3e34 draw_frame_point(): use BORDER_* and enum border_char type, drop a TODO. 2005-11-29 11:21:35 +01:00
Miciah Dashiel Butler Masters
fee63d574a Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2005-11-27 19:40:49 +00:00
Jonas Fonseca
3a9cba5695 Split the parser interface up into init, parser and done steps
The parser will eventually have to live across parses for incremental
renderering. Also the renderer and parser need to share the DOM stack.
2005-11-27 09:18:40 +01:00
Jonas Fonseca
68404b5bf1 Remove some unused struct decls 2005-11-27 07:21:28 +01:00
Miciah Dashiel Butler Masters
d0eeab5b7e Merge the special handling in start_element for tables into html_table. 2005-11-26 02:38:12 +00:00
Miciah Dashiel Butler Masters
947ddc4160 In html_table, rename parameter a to attr. 2005-11-26 02:15:00 +00:00
Miciah Dashiel Butler Masters
cf2fcaa84f Shuffle code so that the do_html_select, do_html_select_multiple, and
html_select are together.
2005-11-26 01:50:46 +00:00
Miciah Dashiel Butler Masters
a781cf1894 Give do_html_select return type void instead of int. 2005-11-26 01:47:50 +00:00
Miciah Dashiel Butler Masters
321003a09e Check for the multiple attribute in html_select rather than in
do_html_select.
2005-11-26 01:46:01 +00:00
Miciah Dashiel Butler Masters
c2445f09bd Factor do_html_select_multiple out of html_select. 2005-11-26 01:43:10 +00:00
Miciah Dashiel Butler Masters
a6a67174af Drop the html_textarea wrapper for do_html_textarea and rename
do_html_textarea to html_textarea.
2005-11-26 01:35:26 +00:00
Miciah Dashiel Butler Masters
a27284611c Don't export do_html_select. 2005-11-26 01:32:10 +00:00
Miciah Dashiel Butler Masters
683c8722d2 Merge do_html_script into html_script. 2005-11-26 01:23:07 +00:00
Jonas Fonseca
2e18d752fc Kill suspicious looking empty line 2005-11-25 13:31:07 +01:00
Laurent MONIN
3dd81f003e Fix trailing whitespaces. 2005-11-25 09:38:32 +01:00
Laurent MONIN
50ffe0f2cd html_select(): fix compilation bug to recent patch. 2005-11-25 09:32:43 +01:00
Miciah Dashiel Butler Masters
9062c83b51 Let html_select, html_textarea, and html_script call do_html_select,
do_html_textarea, and do_html_script directly instead of handling them
specially in start_element.
2005-11-25 01:22:55 +00:00
Miciah Dashiel Butler Masters
08c1cdf9d4 Add parameters unsigned char *html, unsigned char *eof, and unsigned
char **end to element_handler_T.
2005-11-25 00:30:13 +00:00
Jonas Fonseca
94e6b2def5 Revert DOM stack member renames and fix compile errors 2005-11-25 00:16:22 +01:00
Jonas Fonseca
60269a7466 One missing sparse warning fix 2005-11-24 21:57:35 +01:00
Jonas Fonseca
7c0b6809b9 HTML_NODE_INFO -> HTML_, HTML_NODE_INF2 -> HTM2_ 2005-11-24 13:32:04 +01:00
Jonas Fonseca
b42b098fd4 Remove unused root member of struct dom_renderer 2005-11-15 12:11:48 +01:00
Jonas Fonseca
acf2ec806b Remove empty lines in start of header files
A left over from the CVS Id removal. Also, for a few files, normalize the
order in which things are declared in headers.
2005-11-15 11:33:27 +01:00
Jonas Fonseca
41941c64d6 Improve the DOM stack structures comments 2005-11-15 11:21:01 +01:00
Jonas Fonseca
16481d7baa Move DOM exception enum to separate file
... and remove it from the dom_stack struct.
2005-11-15 11:01:11 +01:00
Jonas Fonseca
bccfbf8647 Rename DOM navigator -> stack
This is really a much more appropriate word since it never ended up being
more than just a stack. The rename also changes the symbol names to use the
much shorter "stack".
2005-11-15 10:43:52 +01:00
Laurent MONIN
f7bc7c3497 Tidy up. 2005-11-10 15:42:35 +01:00
Laurent MONIN
2beadb8f6b html_focusable(): use mem_free_set(). 2005-11-10 15:38:52 +01:00
Laurent MONIN
29577cad31 html_focusable(): use a local variable to shorten lines. 2005-11-10 15:35:57 +01:00
Laurent MONIN
24a8ff7294 Tidy up, drop a goto. 2005-11-10 10:39:42 +01:00
Laurent MONIN
39015488d3 Optimize type of script matching. 2005-11-02 16:54:24 +01:00
Laurent MONIN
53590ee002 Attempt to match a wider range of types regarding detection of
javascript. Only text/javascript type was matched.
2005-11-02 10:38:24 +01:00
Miciah Dashiel Butler Masters
dcbb9cf909 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2005-10-24 00:32:42 +00:00
Andrzej Zaborowski
4fe6e19dc6 Fix a memory-corruption bug in the line justification algorithm. 2005-10-24 00:30:36 +00:00
Miciah Dashiel Butler Masters
5ce3f23a2e In justify_line, rename the variable 'insert' to 'diff'. 2005-10-23 23:30:12 +00:00
Miciah Dashiel Butler Masters
82c4d457d6 Add a boolean option ecmascript.ignore_noscript, default off,
that when enabled causes ELinks to ignore any content enclosed
with <noscript> tags.
2005-10-23 21:59:05 +00:00
Laurent MONIN
792e4c4355 html_special(): move va_end() call outside the switch and make variables
more local.
2005-10-21 10:15:03 +02:00
Laurent MONIN
728014118d Since is_drawing_subs_or_sups() macro is only used by put_chars(),
defined it in this function.
2005-10-21 09:46:13 +02:00
Laurent MONIN
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Laurent MONIN
956484cf57 Drop dead commented code and tidy up. 2005-10-20 17:26:22 +02:00
Laurent MONIN
d54f76bec8 Re-order code in a more logical fashion. 2005-10-20 17:23:18 +02:00
Laurent MONIN
2f8ed27eab No need to initialize @end and @start. 2005-10-20 17:22:15 +02:00
Laurent MONIN
e47f8068d9 Declare variable in inner block. 2005-10-20 17:21:17 +02:00
Laurent MONIN
c17940044c Move table cache stuff outside local renderer_context. 2005-10-20 17:17:25 +02:00
Laurent MONIN
23f7fc1b78 Move code from new_link() to new init_link_event_hooks().
Make code cleaner, and reduce indentation.
2005-10-20 11:43:42 +02:00
Laurent MONIN
d5e6110711 html_special_tag(): reduce indentation. 2005-10-20 11:21:02 +02:00
Laurent MONIN
ca27359131 Cast void * to struct tag *, instead the opposite. 2005-10-20 11:20:13 +02:00
Laurent MONIN
ee476c6eb6 shift_chars(): let it use alloca() if possible (--fastmem mode only). 2005-10-20 11:13:10 +02:00
Laurent MONIN
11564e255c Trim trailing whitespaces. 2005-10-20 10:09:19 +02:00
Laurent MONIN
6cc441f34a Introduce set_screen_char_color() and reduce code redundancy. 2005-10-20 10:07:50 +02:00
Jonas Fonseca
c88afeb1c2 path_to_top -> top_builddir 2005-10-20 04:00:35 +02:00
Jonas Fonseca
e39a4342d6 Include $(top_srcdir)/Makefile.lib instead of $(path_to_top)/Makefile.lib
A step towards out of tree builds ...
2005-10-20 01:11:47 +02:00
Laurent MONIN
7392b8c503 Attempt to improve sub/sup rendering. Now 2<sup>2<sup>2</sup></sup> is
rendered as 2^2^2 and mixed sub/sup should be rendered in a better way.
A bit hacky though.
2005-10-19 23:11:27 +02:00
Laurent MONIN
9841316755 Use bitfields for on/off flags in struct renderer_context. 2005-10-19 11:56:26 +02:00
Laurent MONIN
65f4cfcb30 Add a field did_superscript to struct renderer_context and use it instead
of a local static variable.
2005-10-19 11:49:00 +02:00
Jonas Fonseca
94ed6fa754 Finalize and cleanup the denser Makefile format
Convert remaining conditional file building to use

	OBJS-$(CONFIG_FOO) += foo.o

one problem with reverse meaining (in util/) fixed with local 'hack'.

Cleanup and remove stuff which is now default targets.
2005-09-28 12:38:17 +02:00
Jonas Fonseca
c76586e6b8 Simplify the conditional building
Use the very cool 'VAR-$(CONFIG_FOO) += foo.o' feature instead of the more
verbose current ifeq($(CONFIG_FOO),yes) wrapping.
2005-09-27 22:49:47 +02:00
Jonas Fonseca
68de9e35d3 Automagically link in subdir lib.o files
It is a little ugly since I couldn't get $(wildcard) to expand *.o files
so it just checks if there are any *.c files and then link in the lib.o
based on that.
2005-09-27 22:38:00 +02:00
Jonas Fonseca
1efab31581 Simplify building of and linking with directories
Ditch the building of an archive (.a) in favour of linking all objects in a
directory into a lib.o file. This makes it easy to link in subdirectories
and more importantly keeps the build logic in the local subdirectories.

Note: after updating you will have to rm **/*.a if you do not make clean
before updating.
2005-09-27 21:38:58 +02:00
Jonas Fonseca
b30064c0d0 Rename targets: *-l -> *-local 2005-09-27 21:11:28 +02:00
Jonas Fonseca
50f4b46616 dom_node_cmp(): Minor optimization 2005-09-27 14:39:40 +02:00
Petr Baudis
ade2ae0a69 Add simple support for the display CSS property
display: inline, display: block and display: inline-block (aliased to
inline) is now supported. I hope I didn't break anything. :-)

This makes the new yucky CSS'd slashdot look at least a bit better.
2005-09-22 22:07:33 +02:00
Petr Baudis
31bdf06d8f More detailed element*.linebreak description 2005-09-22 21:52:12 +02:00
Petr Baudis
7a91098135 Use is_*_element() to determine whether element is block or inline
Use that in the stack killing code, where we do some pretty funny checks
and stuff. The decision is based on the linebreak struct attribute,
non-zero for block elements.
2005-09-22 21:44:28 +02:00
Petr Baudis
4e2d48cc93 ELBuildize some more stuff. All for tonight, turn for the Americans. 2005-09-16 05:09:08 +02:00
Petr Baudis
1f0cd14e91 Converted another bunch of submakefiles to ELBuild 2005-09-16 04:07:37 +02:00
Jonas Fonseca
7462f22635 Remove now obsolete .cvsignore files. 2005-09-15 18:33:20 +02:00
Petr Baudis
0f6d4310ad Initial commit of the HEAD branch of the ELinks CVS repository, as of
Thu Sep 15 15:57:07 CEST 2005. The previous history can be added to this
by grafting.
2005-09-15 15:58:31 +02:00