- Go 100%
| copyuntilreplace.go | ||
| copyuntilreplace_test.go | ||
| fileextension.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| mediatype.go | ||
| README.md | ||
| transform.go | ||
| transform_test.go | ||
| wraphttphandler.go | ||
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
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