Package hquotation provides an http.Handler middleware to render hquotation to HTML, for the Go programming language.
Find a file
2025-09-22 12:52:39 -07:00
copyuntilreplace.go copyUntilReplace() 2025-09-18 06:15:08 -07:00
copyuntilreplace_test.go copyUntilReplace() 2025-09-18 06:15:08 -07:00
fileextension.go quotation -> excerpt 2025-09-17 12:46:55 -07:00
go.mod <main> 2025-09-22 12:52:39 -07:00
go.sum <main> 2025-09-22 12:52:39 -07:00
LICENSE initial commits 2025-09-17 12:03:20 -07:00
mediatype.go quotation -> excerpt 2025-09-17 12:46:55 -07:00
README.md docs 2025-09-19 09:51:56 -07:00
transform.go transformation 2025-09-22 12:35:07 -07:00
transform_test.go transformation 2025-09-22 12:39:49 -07:00
wraphttphandler.go hexcerpt.WrapHTTPHandler() 2025-09-19 09:46:53 -07:00

go-hexcerpt

Package hexcerpt provides an http.Handler middleware to render hexcerpt (structured-HTML) to HTML, for the Go programming language.

hexcerpt is an HTML based format for creating excerpts with quotations and citations. hexcerpt uses some custom HTML elements.

An hexcerpt excerpt looks similar to this:

<x-excerpt>
	<x-quotation>
		<p>
			Yesterday I was clever, so I wanted to change the world.
			Today I am wise, so I am changing myself.
		</p>
	</x-quotation>
	<x-citation><x-who>Rumi</x-who>
	</x-citation>
</x-excerpt>

And this:

<x-excerpt>
	<x-quotation>
		<p>
			Anthropologists and linguists had long known that the way colors are classified varies from language to language.
			Careful studies conducted by anthropologists after World War II, such as Harold Conklin’s (1955) study of Hanunóo color words, made the point very clearly.
		</p>
	</x-quotation>
	<x-citation><x-who>Donald E. Brown</x-who>.
		(<x-when>1991</x-when>).
		<x-what>Human Universals</x-what>.
	</x-citation>
</x-excerpt>

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-hexcerpt

GoDoc

Example

Here is an example of using hexcerpt.WrapHTTPHandler() to wrap another handler, to provide hexcerpt (structured-HTML) to HTML rendering.

The http.Handler that hexcerpt.WrapHTTPHandler() returns looks at what the sub-http.Handler to see if the Content-Type it wrote has text/excerpt+html.

import "codeberg.org/reiver/go-hexcerpt"

// ...

var handler http.Handler = ...

handler = hexcerpt.WrapHTTPHandler(handler) // <---------

err := http.ListenAndServe(":8080", handler)
if nil != err {
	return err
}

Import

To import package hexcerpt use import code like the following:

import "codeberg.org/reiver/go-hexcerpt"

Installation

To install package hexcerpt do the following:

GOPROXY=direct go get codeberg.org/reiver/go-hexcerpt

Author

Package hexcerpt was written by Charles Iliya Krempeaux