Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions site/layouts/partials/githubPolarisUrl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/}}

{{/*
Returns a GitHub URL pointing to the given path in the apache/polaris repository,
resolved to the correct branch or tag for the current page's release version.

Usage: {{ partial "githubPolarisUrl.html" (dict "page" . "path" "path/to/file") }}
*/}}

{{- $gitRef := partial "polarisGitRef.html" .page -}}
{{- $url := printf "https://github.com/apache/polaris/blob/%s/%s" $gitRef.ref .path -}}
{{- return $url -}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@
specific language governing permissions and limitations
under the License.
*/}}
{{- $ver := partial "releaseVersion.html" . -}}
{{- $spec := ( .Get 0 ) -}}
{{- $url := "" -}}
{{- $incubating := "" -}}
{{- if lt $ver "1.4.0" -}}
{{- $incubating = "-incubating" -}}

{{/*
Returns "-incubating" if the given release version predates graduation (< 1.4.0),
or "" otherwise. Pass "[unreleased]" to get "".

Usage: {{ partial "incubatingSuffix.html" $ver }}
*/}}

{{- $suffix := "" -}}
{{- if ne . "[unreleased]" -}}
{{- $parts := split . "." -}}
{{- $vMajor := index $parts 0 | int -}}
{{- $vMinor := index $parts 1 | int -}}
{{- if or (lt $vMajor 1) (and (eq $vMajor 1) (lt $vMinor 4)) -}}
{{- $suffix = "-incubating" -}}
{{- end -}}
{{- if eq $ver "[unreleased]" -}}
{{- $url = printf "https://github.com/apache/polaris/raw/refs/heads/main/spec/%s" $spec }}
{{- else -}}
{{- $url = printf "https://github.com/apache/polaris/raw/refs/tags/apache-polaris-%s%s/spec/%s" $ver $incubating $spec }}
{{- end -}}
{{- return $url -}}
{{- return $suffix -}}
35 changes: 35 additions & 0 deletions site/layouts/partials/polarisGitRef.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/}}

{{/*
Returns a dict describing the git ref for the current page's release version:
- ref: "main" for unreleased, or "apache-polaris-{ver}{incubating}" for a release
- isReleased: false for unreleased, true for a release

Usage: {{ $gitRef := partial "polarisGitRef.html" . }}
*/}}

{{- $ver := partial "releaseVersion.html" . -}}
{{- $result := dict "isReleased" false "ref" "main" -}}
{{- if ne $ver "[unreleased]" -}}
{{- $incubating := partial "incubatingSuffix.html" $ver -}}
{{- $ref := printf "apache-polaris-%s%s" $ver $incubating -}}
{{- $result = dict "isReleased" true "ref" $ref -}}
{{- end -}}
{{- return $result -}}
33 changes: 33 additions & 0 deletions site/layouts/partials/rawGithubPolarisUrl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/}}

{{/*
Returns a raw.githubusercontent.com URL pointing to the given path in the
apache/polaris repository, resolved to the correct branch or tag for the
current page's release version.

Usage: {{ partial "rawGithubPolarisUrl.html" (dict "page" . "path" "path/to/file") }}
*/}}

{{- $gitRef := partial "polarisGitRef.html" .page -}}
{{- $url := printf "https://raw.githubusercontent.com/apache/polaris/refs/heads/%s/%s" $gitRef.ref .path -}}
{{- if $gitRef.isReleased -}}
{{- $url = printf "https://raw.githubusercontent.com/apache/polaris/refs/tags/%s/%s" $gitRef.ref .path -}}
{{- end -}}
{{- return $url -}}
9 changes: 1 addition & 8 deletions site/layouts/shortcodes/github-polaris.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,4 @@
under the License.
*/}}

{{- $ver := partial "releaseVersion.html" . -}}
{{- $path := ( .Get 0 ) -}}
{{- $url := "" -}}
{{- if eq $ver "[unreleased]" -}}
{{- printf "https://github.com/apache/polaris/blob/main/%s" $path }}
{{- else -}}
{{- printf "https://github.com/apache/polaris/blob/polaris-%s/%s" $path }}
{{- end -}}
{{- partial "githubPolarisUrl.html" (dict "page" . "path" (.Get 0)) -}}
20 changes: 20 additions & 0 deletions site/layouts/shortcodes/raw-github-polaris.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/}}

{{- partial "rawGithubPolarisUrl.html" (dict "page" . "path" (.Get 0)) -}}
15 changes: 1 addition & 14 deletions site/layouts/shortcodes/redoc-polaris.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@

{{- $spec := .Get 0 -}}
{{- $otheroptions := .Get 1 -}}
{{- $url := "" -}}

{{- $ver := partial "releaseVersion.html" . -}}
{{- $spec := ( .Get 0 ) -}}
{{- $url := "" -}}
{{- $incubating := "" -}}
{{- if lt $ver "1.4.0" -}}
{{- $incubating = "-incubating" -}}
{{- end -}}
{{- if eq $ver "[unreleased]" -}}
{{- $url = printf "https://raw.githubusercontent.com/apache/polaris/refs/heads/main/spec/%s" $spec }}
{{- else -}}
{{- $url = printf "https://raw.githubusercontent.com/apache/polaris/refs/tags/apache-polaris-%s%s/spec/%s" $ver $incubating $spec }}
{{- end -}}
{{- $url := partial "rawGithubPolarisUrl.html" (dict "page" . "path" (printf "spec/%s" $spec)) -}}

<!-- CSS style overrides for Redoc API docs -->
<style>
Expand Down