Re: forcing html rendering for files without extensions

Mouse <[email protected]>
Newsgroups gmane.comp.web.lynx.devel
Message-ID <[email protected]>
> I realized I wanted it to interpret files without extensions as HTML
> [...]

Well...keying things off filename extensions is a useful heuristic.
But there is a problem with it, more or a problem in the abstract than
a pragmatic problem: what is an extension?

In most Unix variants (I'd almost say "all", as to my mind this is one
of the distinguishing charateristics of the Unix family), dots are not
special in file names except to userland programs, and only some of
those.  If a filename contains a dot, whether the part after it is an
"extension" is not well-defined; it depends on human-layer things:

saved.html
	Probably conceptually the name "saved" with "html" extension,
	presumably tagging the content as HTML.

one.two.three
	Does this have an extension?  If so, is it "three" or
	"two.three"?   Since neither one has any common semantics as an
	extension, this probably is conceptually the name
	"one.two.three" with no extension tag - but that depends on
	human-layer knowledge.

log.2026-08-04.12:14:55
	Almost certainly a name without any extension tag.

Context is also important.  If we have a directory containing files
named

	'qZUH]Qc1wtc
	zi)dvndrx~f,
	k)|BAr.(I@a"
	a\i;Dqj|")4g
	QWL0;)7s[Vee
	9=%^3Pw-,>f2
	\Zlt5K|kYQo)
	#"8PrHA>3H2{
	)(`VY2murLC3
	K45aG_Mfdv.c
	phg}7]~]}$O>
	$xQkguC\}_lq
	+r6U`09V;MFd
	r@`aHPYrt2]f

then, even in isolation, the third filename is extremely unlikely to be
a name-plus-extension.  In isolation, the tenth one might be C source
code (the rest of the name makes that seem somewhat unlikely, but I've
seen similarly cryptic names in real programs).  In context, it is all
but certain to be pure coincidence.

Similarly, if we have

	app.c
	bkgnd.c
	externs.h
	log.c
	lzw.c
	norm.c
	saves.c

in one directory and

	log.a
	log.b
	log.c
	log.d
	log.e
	log.f
	log.g

in another, then the log.c file is probably C source in the first case
and probably not in the second, despite the identical names.

The hard part, of course, is telling the difference mechanically;
that's why so many things use such heuristics.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		[email protected]
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.