mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-06 23:44:43 -04:00
Experimental html source highlight using libdom
This commit is contained in:
parent
be94fb4b1d
commit
06fb11baee
@ -1585,6 +1585,7 @@ else
|
||||
LIBDOM_LIBS=`$PKG_CONFIG --libs libdom`
|
||||
LIBS="$LIBDOM_LIBS $LIBS"
|
||||
CONFIG_LIBDOM=yes
|
||||
AC_DEFINE([CONFIG_LIBDOM], [1], [Define as 1 to use the libdom library.])
|
||||
AC_MSG_RESULT([[yes]])
|
||||
else
|
||||
enable_libdom=no
|
||||
|
@ -3,6 +3,7 @@ include $(top_builddir)/Makefile.config
|
||||
|
||||
SUBDIRS-$(CONFIG_CSS) += css
|
||||
SUBDIRS-$(CONFIG_DOM) += dom
|
||||
SUBDIRS-$(CONFIG_LIBDOM) += libdom
|
||||
|
||||
SUBDIRS = html plain
|
||||
|
||||
|
8
src/document/libdom/Makefile
Normal file
8
src/document/libdom/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
top_builddir=../../..
|
||||
include $(top_builddir)/Makefile.config
|
||||
|
||||
INCLUDES += $(LIBDOM_CFLAGS)
|
||||
|
||||
OBJS = renderer.o
|
||||
|
||||
include $(top_srcdir)/Makefile.lib
|
1079
src/document/libdom/renderer.c
Normal file
1079
src/document/libdom/renderer.c
Normal file
File diff suppressed because it is too large
Load Diff
11
src/document/libdom/renderer.h
Normal file
11
src/document/libdom/renderer.h
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
#ifndef EL__DOCUMENT_LIBDOM_RENDERER_H
|
||||
#define EL__DOCUMENT_LIBDOM_RENDERER_H
|
||||
|
||||
struct cache_entry;
|
||||
struct document;
|
||||
struct string;
|
||||
|
||||
void render_source_document(struct cache_entry *cached, struct document *document, struct string *buffer);
|
||||
|
||||
#endif
|
@ -18,6 +18,7 @@
|
||||
#include "document/dom/renderer.h"
|
||||
#include "document/html/frames.h"
|
||||
#include "document/html/renderer.h"
|
||||
#include "document/libdom/renderer.h"
|
||||
#include "document/plain/renderer.h"
|
||||
#include "document/renderer.h"
|
||||
#include "document/view.h"
|
||||
@ -248,6 +249,14 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LIBDOM
|
||||
if (document->options.plain && cached->content_type
|
||||
&& (!c_strcasecmp("text/html", cached->content_type)
|
||||
|| !c_strcasecmp("application/xhtml+xml", cached->content_type))) {
|
||||
render_source_document(cached, document, &buffer);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (document->options.plain) {
|
||||
#ifdef CONFIG_DOM
|
||||
if (cached->content_type
|
||||
|
Loading…
Reference in New Issue
Block a user