docscheck

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package docscheck reads the pages of the docs site for the tests that keep them true: the diagnostic pages (REQ-DOC-03), the code samples (REQ-DOC-04) and the page inventory (REQ-DOC-02).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentDir

func ContentDir(repo string) string

ContentDir returns the content directory of the docs site.

func ResultKey added in v0.4.0

func ResultKey(slug, path string) string

ResultKey returns the file name, with no extension, of the capture of one GET of one page: "tutorial/a-page" and "/shop/2" give "tutorial-a-page--shop-2".

func ResultsDir added in v0.4.0

func ResultsDir(repo string) string

ResultsDir returns the directory of the captured result pages of the docs site.

Types

type Block

type Block struct {
	Lang string
	// Title is the title option of the block: the file a sample belongs
	// to, or the command of an output block.
	Title string
	Code  string
	// Line is the line of the opening fence in the body.
	Line int
}

Block is one fenced code block.

type Page

type Page struct {
	// Slug is the site path with no slashes at its ends, for example
	// "errors/GX2001".
	Slug string
	// File is the path of the Markdown file.
	File string
	// Meta holds the frontmatter keys with a plain value.
	Meta map[string]string
	// Body is the Markdown after the frontmatter.
	Body string
}

Page is one Markdown page of the docs site.

func Pages

func Pages(dir string) ([]Page, error)

Pages reads every Markdown page under dir.

func ReadPage

func ReadPage(path, slug string) (Page, error)

ReadPage reads one Markdown file as a page with the slug.

func (Page) Blocks

func (p Page) Blocks() []Block

Blocks returns the fenced code blocks of a page, in order.

func (Page) Section

func (p Page) Section(name string) string

Section returns the text under a "## name" heading, up to the next heading of the same level.

type Result added in v0.4.0

type Result struct {
	// Header is the first line of the capture file. It holds the title
	// and the classes of the html and body elements.
	Header string
	Body   string
	// Styles are the addresses of the stylesheets of the page.
	Styles []string
}

Result is the capture of one response of a sample app: the content of the body with no script, and the address of each stylesheet.

func Capture added in v0.4.0

func Capture(get, html string) Result

Capture reads a response of a sample app as a result page.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL