1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Experimental html source highlight using libdom

This commit is contained in:
Witold Filipczyk 2016-12-11 16:52:44 +01:00
parent be94fb4b1d
commit 06fb11baee
6 changed files with 1109 additions and 0 deletions

View File

@ -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

View File

@ -3,6 +3,7 @@ include $(top_builddir)/Makefile.config
SUBDIRS-$(CONFIG_CSS) += css
SUBDIRS-$(CONFIG_DOM) += dom
SUBDIRS-$(CONFIG_LIBDOM) += libdom
SUBDIRS = html plain

View File

@ -0,0 +1,8 @@
top_builddir=../../..
include $(top_builddir)/Makefile.config
INCLUDES += $(LIBDOM_CFLAGS)
OBJS = renderer.o
include $(top_srcdir)/Makefile.lib

File diff suppressed because it is too large Load Diff

View 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

View File

@ -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