Skip to content

Commit

Permalink
Add id attributes to GitInfo, File, and Resources methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring authored Dec 22, 2023
1 parent b12d9cb commit 2a1adea
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 45 deletions.
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md

MD001: false
MD002: false
MD003: false
MD004: false
Expand Down
50 changes: 30 additions & 20 deletions content/en/methods/page/File.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,89 +30,99 @@ Code defensively by verifying file existence as shown in each of the examples be
The path separators (slash or backslash) in `Path`, `Dir`, and `Filename` depend on the operating system.
{{% /note %}}

BaseFileName
: (`string`) The file name, excluding the extension.
###### BaseFileName

(`string`) The file name, excluding the extension.

```go-html-template
{{ with .File }}
{{ .BaseFileName }}
{{ end }}
```

ContentBaseName
: (`string`) If the page is a branch or leaf bundle, the name of the containing directory, else the `TranslationBaseName`.
###### ContentBaseName

(`string`) If the page is a branch or leaf bundle, the name of the containing directory, else the `TranslationBaseName`.

```go-html-template
{{ with .File }}
{{ .ContentBaseName }}
{{ end }}
```

Dir
: (`string`) The file path, excluding the file name, relative to the `content` directory.
###### Dir

(`string`) The file path, excluding the file name, relative to the `content` directory.

```go-html-template
{{ with .File }}
{{ .Dir }}
{{ end }}
```

Ext
: (`string`) The file extension.
###### Ext

(`string`) The file extension.

```go-html-template
{{ with .File }}
{{ .Ext }}
{{ end }}
```

Filename
: (`string`) The absolute file path.
###### Filename

(`string`) The absolute file path.

```go-html-template
{{ with .File }}
{{ .Filename }}
{{ end }}
```

Lang
: (`string`) The language associated with the given file.
###### Lang

(`string`) The language associated with the given file.

```go-html-template
{{ with .File }}
{{ .Lang }}
{{ end }}
```

LogicalName
: (`string`) The file name.
###### LogicalName

(`string`) The file name.

```go-html-template
{{ with .File }}
{{ .LogicalName }}
{{ end }}
```

Path
: (`string`) The file path, relative to the `content` directory.
###### Path

(`string`) The file path, relative to the `content` directory.

```go-html-template
{{ with .File }}
{{ .Path }}
{{ end }}
```

TranslationBaseName
: (`string`) The file name, excluding the extension and language identifier.
###### TranslationBaseName

(`string`) The file name, excluding the extension and language identifier.

```go-html-template
{{ with .File }}
{{ .TranslationBaseName }}
{{ end }}
```

UniqueID
: (`string`) The MD5 hash of `.File.Path`.
###### UniqueID

(`string`) The MD5 hash of `.File.Path`.

```go-html-template
{{ with .File }}
Expand Down
41 changes: 24 additions & 17 deletions content/en/methods/page/GitInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,62 +43,69 @@ This is configurable. See [details].

## Methods

AbbreviatedHash
: (`string`) The abbreviated commit hash.
###### AbbreviatedHash

(`string`) The abbreviated commit hash.

```go-html-template
{{ with .GitInfo }}
{{ .AbbreviatedHash }} → aab9ec0b3
{{ end }}
```

AuthorDate
: (`time.Time`) The author date.
###### AuthorDate

(`time.Time`) The author date.

```go-html-template
{{ with .GitInfo }}
{{ .AuthorDate.Format "2006-01-02" }} → 2023-10-09
{{ end }}
```

CommitDate
: (`time.Time`) The commit date.
###### AuthorEmail

(`string`) The author's email address, respecting [gitmailmap].

```go-html-template
{{ with .GitInfo }}
{{ .CommitDate.Format "2006-01-02" }} → 2023-10-09
{{ .AuthorEmail }} → [email protected]
{{ end }}
```

AuthorEmail
: (`string`) The author's email address, respecting [gitmailmap].
###### AuthorName

(`string`) The author's name, respecting [gitmailmap].

```go-html-template
{{ with .GitInfo }}
{{ .AuthorEmail }} → [email protected]
{{ .AuthorName }} → John Smith
{{ end }}
```

AuthorName
: (`string`) The author's name, respecting [gitmailmap].
###### CommitDate

(`time.Time`) The commit date.

```go-html-template
{{ with .GitInfo }}
{{ .AuthorName }} → John Smith
{{ .CommitDate.Format "2006-01-02" }} → 2023-10-09
{{ end }}
```

Hash
: (`string`) The commit hash.
###### Hash

(`string`) The commit hash.

```go-html-template
{{ with .GitInfo }}
{{ .Hash }} → aab9ec0b31ebac916a1468c4c9c305f2bebf78d4
{{ end }}
```

Subject
: (`string`) The commit message subject.
###### Subject

(`string`) The commit message subject.

```go-html-template
{{ with .GitInfo }}
Expand Down
20 changes: 12 additions & 8 deletions content/en/methods/page/Resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ To work with global or remote resources, see the [`resources`] functions.

## Methods

ByType
: (`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.
###### ByType

(`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.

```go-html-template
{{ range .Resources.ByType "image" }}
Expand All @@ -32,8 +33,9 @@ ByType

When working with global resources instead of page resources, use the [`resources.ByType`] function.

Get
: (`resource.Resource`) Returns a page resource from the given path, or nil if none found.
###### Get

(`resource.Resource`) Returns a page resource from the given path, or nil if none found.

```go-html-template
{{ with .Resources.Get "images/a.jpg" }}
Expand All @@ -43,8 +45,9 @@ Get

When working with global resources instead of page resources, use the [`resources.Get`] function.

GetMatch
: (`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.
###### GetMatch

(`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.

```go-html-template
{{ with .Resources.GetMatch "images/*.jpg" }}
Expand All @@ -54,8 +57,9 @@ GetMatch

When working with global resources instead of page resources, use the [`resources.GetMatch`] function.

Match
: (`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.
###### Match

(`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.

```go-html-template
{{ range .Resources.Match "images/*.jpg" }}
Expand Down

0 comments on commit 2a1adea

Please sign in to comment.