Documentation ¶
Index ¶
- Constants
- Variables
- func Compile(in io.Reader, size int, w io.Writer, inFF Input, outFF Output, apis *ApisCfg)
- func CompileFile(inpPath string, w io.Writer, inFF Input, outFF Output, apis *ApisCfg)
- func ExecuteConfig(data []byte, apis *ApisCfg) []error
- func ExecuteConfigFile(f string, apis *ApisCfg) []error
- type ApiCfg
- type ApisCfg
- type Ctx
- type Input
- type Item
- type Meta
- type Output
- func OutputBlackfriday(prev Output, opts ...blackfriday.Option) Output
- func OutputByName(name string) (Output, error)
- func OutputHtml() Output
- func OutputMarkdown() Output
- func OutputMarkdownHtml() Output
- func OutputSimpleMarkdown() Output
- func OutputSimpleMarkdownHtml() Output
- func OutputTabSep(fields []string) Output
- func OutputTestAlphabetical() Output
Constants ¶
const NA = "N/A"
Just N/A
Variables ¶
var NameUrlDescTabSepPattern = []string{"name", "url", "desc"}
Functions ¶
func Compile ¶
Parses the file conforming to inFF and writes the output of outFF to out. The size argument is used to provide a progressbar. The apis config is forwarded to FetchMeta.
func CompileFile ¶
Opens the file and runs Compile
func ExecuteConfig ¶
func ExecuteConfigFile ¶
Types ¶
type ApiCfg ¶
type ApiCfg struct { // This is an access token passed to the API // NOTE: Make sure your access tokens aren't in the source code. AccessToken string // This variable specifies how many requests should be made to the API before falling back to a default response. // NOTE: This should only be used for development purposes. MaxRequests int }
This is used by FetchMeta to get the access token and the maximum number of requests for any given API.
type ApisCfg ¶
This holds ApiCfgs for each API used by FetchMeta
func GetApisFromEnv ¶
func NewDebugCfg ¶
func NewDebugCfg() *ApisCfg
func NewDebugReqsApisCfg ¶
func NewDebugReqsApisCfg() *ApisCfg
type Ctx ¶
type Ctx struct { // This is the API config passed to FetchMeta ApisCfg *ApisCfg // contains filtered or unexported fields }
This is the context that is passed between Input, Output and FetchMeta.
func NewDebugCtx ¶
func NewDebugCtx() *Ctx
type Input ¶
type Input interface { // This function should parse a line and call either out.Item() or out.Literal() ParseLine(w io.Writer, l string, out Output, ctx *Ctx) }
The file format according to which the input will be parsed.
func InputByName ¶
func InputMarkdown ¶
Parses the code according to this pattern:
- [<name>](<url>) - <desc>
- [<name>](<url>) - <desc>
sep: " - "
func InputTabSep ¶
Parses the code according to this pattern:
<name>\t<url>\t<desc> "literal line 'literal without newline " continuation of previous line """ block literal which spans over multiple lines """
type Meta ¶
type Meta interface { // The number of stars or N/A Stars() string // The number of forks or N/A Forks() string // The number of issues or N/A Issues() string // The date of the last commit or N/A LastCommit() string // File returns the URL under which the given path may be found or "". // There must not be any checks whether the file actually exists. File(path string) string }
Metadata about a repository
type Output ¶
type Output interface { // This should write the literal l to out Literal(w io.Writer, l string, ctx *Ctx) // This should write the formatted item to out Item(w io.Writer, item *Item, ctx *Ctx) // This function is called to initialize the Output Start(w io.Writer, ctx *Ctx) // This function is called to teardown the Output End(w io.Writer, ctx *Ctx) }
The output file format
func OutputBlackfriday ¶
func OutputByName ¶
func OutputHtml ¶
func OutputHtml() Output
func OutputMarkdown ¶
func OutputMarkdown() Output
Prints the code according to this pattern:
| Stars | Forks | Issues | Last Commit | Name | Desc | |---------|---------|----------|---------------|-----------------|--------| | <stars> | <forks> | <issues> | <last commit> | [<name>](<url>) | <desc> |
func OutputMarkdownHtml ¶
func OutputMarkdownHtml() Output
Same as OutputMarkdown but compiled to HTML by github.com/russross/blackfriday/v2
func OutputSimpleMarkdown ¶
func OutputSimpleMarkdown() Output
Prints the code according to this pattern:
| Name | Desc | |-----------------|--------| | [<name>](<url>) | <desc> |
func OutputSimpleMarkdownHtml ¶
func OutputSimpleMarkdownHtml() Output
Same as OutputSimpleMarkdown but compiled to HTML by github.com/russross/blackfriday/v2
func OutputTabSep ¶
Prints the code according to this pattern:
<name>\t<url>\t<desc> "literal line 'literal without newline " continuation of previous line "block literal "which spans over "multiple lines
func OutputTestAlphabetical ¶
func OutputTestAlphabetical() Output
Panics if the items aren't alphabetically sorted. Nothing is written to out