1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-19 01:36:33 -04:00
Commit Graph

56 Commits

Author SHA1 Message Date
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
0e2eefcb82 Add missing HTML_(SCRIPT, ...) definition 2005-12-27 01:58:54 +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
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
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
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
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
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
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
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
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
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
45861c68e1 pop_dom_state(): Drop unused left-over argument 2005-12-15 22:05:30 +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
87aad88c96 Use dom_string throughout the DOM stack interface 2005-12-10 21:42:49 +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
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
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
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
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
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
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
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
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
94e6b2def5 Revert DOM stack member renames and fix compile errors 2005-11-25 00:16:22 +01:00
Jonas Fonseca
7c0b6809b9 HTML_NODE_INFO -> HTML_, HTML_NODE_INF2 -> HTM2_ 2005-11-24 13:32:04 +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
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +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
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