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

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.
This commit is contained in:
Jonas Fonseca 2006-01-01 23:22:10 +01:00 committed by Jonas Fonseca
parent 7d64cb893c
commit 021af4e87c
13 changed files with 324 additions and 2 deletions

View File

@ -687,9 +687,13 @@ render_dom_document(struct cache_entry *cached, struct document *document,
document->bgcolor = document->options.default_bg;
/* FIXME: Refactor the doctype lookup. */
if (!strcasecmp("application/rss+xml", cached->content_type)) {
doctype = SGML_DOCTYPE_RSS;
} else if (!strcasecmp("application/docbook+xml", cached->content_type)) {
doctype = SGML_DOCTYPE_DOCBOOK;
} else if (!strcasecmp("application/xbel+xml", cached->content_type)
|| !strcasecmp("application/x-xbel", cached->content_type)
|| !strcasecmp("application/xbel", cached->content_type)) {

View File

@ -243,6 +243,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
if (cached->content_type
&& (!strcasecmp("text/html", cached->content_type)
|| !strcasecmp("application/xhtml+xml", cached->content_type)
|| !strcasecmp("application/docbook+xml", cached->content_type)
|| !strcasecmp("application/rss+xml", cached->content_type)
|| !strcasecmp("application/xbel+xml", cached->content_type)
|| !strcasecmp("application/x-xbel", cached->content_type)

View File

@ -1,7 +1,7 @@
top_builddir=../../..
include $(top_builddir)/Makefile.config
SUBDIRS = html rss xbel
SUBDIRS = docbook html rss xbel
OBJS = sgml.o parser.o scanner.o
include $(top_srcdir)/Makefile.lib

View File

@ -0,0 +1,2 @@
:set runtimepath+=.
:runtime ../../../.vimrc

View File

@ -0,0 +1,6 @@
top_builddir=../../../..
include $(top_builddir)/Makefile.config
OBJS = docbook.o
include $(top_srcdir)/Makefile.lib

View File

@ -0,0 +1,37 @@
/* SGML node handling */
/* $Id: docbook.c,v 1.1.2.24 2004/02/29 02:47:30 jonas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "dom/sgml/docbook/docbook.h"
#include "dom/sgml/sgml.h"
#define DOCBOOK_(node, name, id) \
SGML_NODE_INFO(DOCBOOK, node, name, id)
static struct sgml_node_info docbook_attributes[DOCBOOK_ATTRIBUTES] = {
SGML_NODE_HEAD(DOCBOOK, ATTRIBUTE),
#include "dom/sgml/docbook/attribute.inc"
};
static struct sgml_node_info docbook_elements[DOCBOOK_ELEMENTS] = {
SGML_NODE_HEAD(DOCBOOK, ELEMENT),
#include "dom/sgml/docbook/element.inc"
};
struct sgml_info sgml_docbook_info = {
SGML_DOCTYPE_DOCBOOK,
docbook_attributes,
docbook_elements,
};

View File

@ -0,0 +1,30 @@
#ifndef EL__DOM_SGML_DOCBOOK_DOCBOOK_H
#define EL__DOM_SGML_DOCBOOK_DOCBOOK_H
#include "dom/stack.h"
#include "dom/sgml/sgml.h"
extern struct sgml_info sgml_docbook_info;
#define DOCBOOK_(node, name, flags) \
SGML_NODE_INFO_TYPE(DOCBOOK, node, name)
enum docbook_element_type {
DOCBOOK_ELEMENT_UNKNOWN,
#include "dom/sgml/docbook/element.inc"
DOCBOOK_ELEMENTS,
};
enum docbook_attribute_type {
DOCBOOK_ATTRIBUTE_UNKNOWN,
#include "dom/sgml/docbook/attribute.inc"
DOCBOOK_ATTRIBUTES,
};
#undef DOCBOOK_
#endif

View File

@ -0,0 +1,87 @@
/* SGML node handling */
/* $Id: docbook.c,v 1.1.2.24 2004/02/29 02:47:30 jonas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "document/dom/navigator.h"
#include "document/dom/node.h"
#include "document/sgml/docbook/info.h"
#include "document/sgml/parser.h"
#include "document/sgml/scanner.h"
#include "document/sgml/sgml.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
#define DOCBOOK_NODE_INFO(node, name, id) SGML_NODE_INFO(DOCBOOK, node, name, id)
#define DOCBOOK_NODE_INF2(node, name, str, id) SGML_NODE_INF2(DOCBOOK, node, name, str, id)
static struct sgml_node_info docbook_attributes[DOCBOOK_ATTRIBUTES] = {
SGML_NODE_HEAD(DOCBOOK, ATTRIBUTE),
#include "document/sgml/docbook/attribute.inc"
};
static struct sgml_node_info docbook_elements[DOCBOOK_ELEMENTS] = {
SGML_NODE_HEAD(DOCBOOK, ELEMENT),
#include "document/sgml/docbook/element.inc"
};
static struct dom_node *
add_docbook_element_end_node(struct dom_navigator *navigator, struct dom_node *node, void *data)
{
struct sgml_parser *parser = navigator->data;
struct dom_node *parent;
struct scanner_token *token;
assert(navigator && parser && node);
assert(dom_navigator_has_parents(navigator));
if (!(parser->flags & SGML_PARSER_ADD_ELEMENT_ENDS))
return NULL;
/* Are we the actual node being popped? */
if (node != get_dom_navigator_top(navigator)->node)
return NULL;
parent = get_dom_navigator_parent(navigator)->node;
token = get_scanner_token(&parser->scanner);
assertm(token, "No token found in callback");
assertm(token->type == SGML_TOKEN_ELEMENT_END, "Bad token found in callback");
if (!token->length) return NULL;
return add_dom_element(parent, token->string, token->length);
}
struct sgml_info sgml_docbook_info = {
docbook_attributes,
docbook_elements,
{
/* */ NULL,
/* DOM_NODE_ELEMENT */ add_docbook_element_end_node,
/* DOM_NODE_ATTRIBUTE */ NULL,
/* DOM_NODE_TEXT */ NULL,
/* DOM_NODE_CDATA_SECTION */ NULL,
/* DOM_NODE_ENTITY_REFERENCE */ NULL,
/* DOM_NODE_ENTITY */ NULL,
/* DOM_NODE_PROC_INSTRUCTION */ NULL,
/* DOM_NODE_COMMENT */ NULL,
/* DOM_NODE_DOCUMENT */ NULL,
/* DOM_NODE_DOCUMENT_TYPE */ NULL,
/* DOM_NODE_DOCUMENT_FRAGMENT */ NULL,
/* DOM_NODE_NOTATION */ NULL,
}
};

View File

@ -16,6 +16,7 @@
/* Backend includes: */
#include "dom/sgml/docbook/docbook.h"
#include "dom/sgml/html/html.h"
#include "dom/sgml/rss/rss.h"
#include "dom/sgml/xbel/xbel.h"
@ -31,6 +32,7 @@ sgml_info_strcmp(const void *key_, const void *node_)
}
struct sgml_info *sgml_info[SGML_DOCTYPES] = {
&sgml_docbook_info,
&sgml_html_info,
&sgml_rss_info,
&sgml_xbel_info,

View File

@ -76,6 +76,7 @@ get_sgml_node_info(struct sgml_node_info list[], struct dom_node *node)
}
enum sgml_document_type {
SGML_DOCTYPE_DOCBOOK,
SGML_DOCTYPE_HTML,
SGML_DOCTYPE_RSS,
SGML_DOCTYPE_XBEL,

View File

@ -100,6 +100,7 @@ static struct option_info default_mime_options[] = {
#ifdef CONFIG_DOM
INIT_OPT_MIME_EXTENSION("rss", "application/rss+xml"),
INIT_OPT_MIME_EXTENSION("xbel", "application/xbel+xml"),
INIT_OPT_MIME_EXTENSION("sgml", "application/docbook+xml"),
#endif
NULL_OPTION_INFO,

View File

@ -1145,14 +1145,15 @@ struct {
unsigned int plain:1;
} static known_types[] = {
{ "text/html", 0 },
{ "text/plain", 1 },
{ "application/xhtml+xml", 0 }, /* RFC 3236 */
#if CONFIG_DOM
{ "application/docbook+xml", 1 },
{ "application/rss+xml", 1 },
{ "application/xbel+xml", 1 },
{ "application/xbel", 1 },
{ "application/x-xbel", 1 },
#endif
{ "text/plain", 1 },
{ NULL, 1 },
};

150
test/docbook/elinks.1.sgml Normal file
View File

@ -0,0 +1,150 @@
<!-- $Id: elinks.1.xml,v 1.9 2003/06/11 01:40:20 jonas Exp $ -->
<!DOCTYPE refentry SYSTEM "../elinksbook.dtd">
<refentry id="elinks.1">
<refmeta>
<refentrytitle>elinks</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>elinks</refname>
<refpurpose>lynx-like alternative character mode WWW browser</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>elinks</command>
<arg choice="opt">options</arg>
<arg choice="req">url</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title> DESCRIPTION </title>
<para>
ELinks is a text mode WWW browser, supporting colors,
table rendering, background downloading, menu driven
configuration interface, tabbed browsing and slim code.
</para>
<para>
Frames are supported. You can have different file formats associated
with external viewers. mailto: and telnet: are supported via external
clients.
</para>
<para>
ELinks can handle local (<varname>file://</varname>) or remote
(<varname>http://,</varname> <varname>ftp://</varname> or
<varname>https://</varname> if there's compiled-in SSL support) URLs.
It has also basic support for <varname>finger:</varname>.
</para>
</refsect1>
<refsect1><title> OPTIONS </title>
<para>
Most options can be set in the user interface or config file, so
usually you do not need to care about them. Note that this list is by
no means complete and it is not kept up-to-date. To get complete list
of commandline options, start ELinks with parameter
<parameter>--help</parameter>.
</para>
&config-cmdoptions;
</refsect1>
<refsect1><title> ENVIRONMENT VARIABLES </title>
&config-envvars;
</refsect1>
<refsect1><title> FILES </title>
&config-files;
</refsect1>
<refsect1><title> PLATFORMS </title>
<para>
ELinks is known to work on Linux, FreeBSD, OpenBSD, Solaris, IRIX,
HPUX, Digital Unix, AIX, OS/2, BeOS and RISC OS. Port for Win32 is in
state of beta testing.
</para>
</refsect1>
<refsect1><title> BUGS </title>
<para>
See the <filename>BUGS</filename> file coming with ELinks distribution
tarball for list of known bugs.
</para>
<para>
Please report any other bugs you find to the ELinks mailing list
<ulink url="http://elinks.or.cz/community.html">
elinks-users@linuxfromscratch.org</ulink> or
<ulink url="http://bugzilla.elinks.or.cz/">the bug system</ulink>.
</para>
</refsect1>
<refsect1><title> LICENSE </title>
<para>
ELinks is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
</para>
</refsect1>
<refsect1><title> AUTHORS </title>
<para>
<command>Links</command> was written by Mikulas Patocka
<email>mikulas@artax.karlin.mff.cuni.cz</email>. ELinks - which is
based on Links - was written by Petr Baudis
<email>pasky@ucw.cz</email>. See file <filename>AUTHORS</filename> in
the source tree for a list of people contributing to this project.
</para>
<para>
The homepage of ELinks can be found at <ulink
url="http://elinks.or.cz">http://elinks.or.cz/</ulink>
</para>
<para>
This manual page was written by Peter Gervai
<email>grin@tolna.net</email>, using excerpts from a (yet?) unknown
Links fan for the Debian GNU/Linux system (but may be used by others).
Contributions from Francis A. Holop. Extended, clarified and made more
up-to-date by Petr Baudis <email>pasky@ucw.cz</email>. Updated by Zas
<email>zas@norz.org</email>. The conversion to DocBook for ELinks 0.5
and trimming was done by Jonas Fonseca <email>fonseca@diku.dk</email>.
</para>
</refsect1>
<refsect1><title> SEE ALSO </title>
<para>
<command>elinkskeys(5)</command>,
<command>elinks.conf(5)</command>,
<command>links(1)</command>,
<command>lynx(1)</command>,
<command>w3m(1)</command>,
<command>wget(1)</command>
</para>
</refsect1>
</refentry>