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