Skip to content

Commit

Permalink
Merge branch 'main' into lunny/issue_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 10, 2024
2 parents 832b78e + 1b069dc commit 2d49aec
Show file tree
Hide file tree
Showing 46 changed files with 1,575 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ rules:
unicorn/consistent-destructuring: [2]
unicorn/consistent-empty-array-spread: [2]
unicorn/consistent-existence-index-check: [0]
unicorn/consistent-function-scoping: [2]
unicorn/consistent-function-scoping: [0]
unicorn/custom-error-definition: [0]
unicorn/empty-brace-spaces: [2]
unicorn/error-message: [0]
Expand Down
64 changes: 64 additions & 0 deletions modules/templates/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func NewFuncMap() template.FuncMap {
"HTMLFormat": htmlutil.HTMLFormat,
"HTMLEscape": htmlEscape,
"QueryEscape": queryEscape,
"QueryBuild": queryBuild,
"JSEscape": jsEscapeSafe,
"SanitizeHTML": SanitizeHTML,
"URLJoin": util.URLJoin,
Expand Down Expand Up @@ -293,6 +294,69 @@ func timeEstimateString(timeSec any) string {
return util.TimeEstimateString(v)
}

func queryBuild(a ...any) template.URL {
var s string
if len(a)%2 == 1 {
if v, ok := a[0].(string); ok {
if v == "" || (v[0] != '?' && v[0] != '&') {
panic("queryBuild: invalid argument")
}
s = v
} else if v, ok := a[0].(template.URL); ok {
s = string(v)
} else {
panic("queryBuild: invalid argument")
}
}
for i := len(a) % 2; i < len(a); i += 2 {
k, ok := a[i].(string)
if !ok {
panic("queryBuild: invalid argument")
}
var v string
if va, ok := a[i+1].(string); ok {
v = va
} else if a[i+1] != nil {
v = fmt.Sprint(a[i+1])
}
// pos1 to pos2 is the "k=v&" part, "&" is optional
pos1 := strings.Index(s, "&"+k+"=")
if pos1 != -1 {
pos1++
} else {
pos1 = strings.Index(s, "?"+k+"=")
if pos1 != -1 {
pos1++
} else if strings.HasPrefix(s, k+"=") {
pos1 = 0
}
}
pos2 := len(s)
if pos1 == -1 {
pos1 = len(s)
} else {
pos2 = pos1 + 1
for pos2 < len(s) && s[pos2-1] != '&' {
pos2++
}
}
if v != "" {
sep := ""
hasPrefixSep := pos1 == 0 || (pos1 <= len(s) && (s[pos1-1] == '?' || s[pos1-1] == '&'))
if !hasPrefixSep {
sep = "&"
}
s = s[:pos1] + sep + k + "=" + url.QueryEscape(v) + "&" + s[pos2:]
} else {
s = s[:pos1] + s[pos2:]
}
}
if s != "" && s != "&" && s[len(s)-1] == '&' {
s = s[:len(s)-1]
}
return template.URL(s)
}

func panicIfDevOrTesting() {
if !setting.IsProd || setting.IsInTesting {
panic("legacy template functions are for backward compatibility only, do not use them in new code")
Expand Down
2 changes: 1 addition & 1 deletion options/gitignore/Alteryx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CASS.ini
*.gzlc

## gitignore reference sites
# https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files
# https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring
# https://git-scm.com/docs/gitignore
# https://help.github.com/articles/ignoring-files/

Expand Down
62 changes: 62 additions & 0 deletions options/gitignore/ECU-TEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# gitignore template for ECU-TEST workspaces - by TraceTronic https://tracetronic.com
# website: https://www.ecu-test.com
# * all directories are related to the default directories, please adapt the .gitignore if you use customized
# directories

# Dynamic workspace settings
# * We don't recommend to ignore the .workspace directory, because of important project specific settings
# local user settings
.workspace/ETdrive.xml
.workspace/favorites.xml
.workspace/filters.xml
.workspace/generators.xml
.workspace/history.xml
.workspace/parallelExecution.xml
.workspace/signalviewer.xml
.workspace/signalViewerHistory.json
.workspace/signalviewer2layout.xml
.workspace/testeditor.xml
.workspace/tooladapter.xml
.workspace/view.xml
# optional, if your process depends on this file remove exclusion
.workspace/interactiveexecution.xml
.workspace/pythonlibrary.xml
# deprecated, support for older versions
.workspace/traceexplorer.xml

# Custom file formats and test dependencies
# * you can manage your artifacts also with TEST-GUIDE (https://www.test-guide.info) and reference them via Playbooks
*.arxml
*.a2l
*.dbc
*.hex
*.s19
[tT]estdata
[tT]estdaten

# Test results and test execution related content
# * Git is not intended to store and provide test results for all iterations
# * We recommend to use TEST-GUIDE (https://www.test-guide.info) for the test report management
TestReports

# Report generators and templates
# * if you want to provide (f.e.) your own report generators exclude the directory here and ignore only the
# unnecessary subdirectories
Templates

# Exclude large binary artifacts
# * you can manage your artifacts also with TEST-GUIDE (https://www.test-guide.info) and reference them via Playbooks
Offline-FIUs
Offline-Models
Offline-SGBDs
*.exe
*.msi
*.zip
*.7z

# Exclude default and custom temporary directories
Backup_*

# Python bytecode and cache files
__pycache__/
*.py[cod]
3 changes: 3 additions & 0 deletions options/gitignore/Kotlin
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Kotlin Gradle plugin data, see https://kotlinlang.org/docs/whatsnew20.html#new-directory-for-kotlin-data-in-gradle-projects
.kotlin/
7 changes: 7 additions & 0 deletions options/gitignore/Laravel
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache

/public/build
/storage/pail
.env.backup
.env.production
.phpactor.json
auth.json
6 changes: 6 additions & 0 deletions options/gitignore/Move
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by Move
# will have compiled files
build/

# Remove possibly saving credentials to the git repository
.aptos/
42 changes: 42 additions & 0 deletions options/gitignore/OpenTofu
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tofu
override.tf.json
override.tofu.json
*_override.tf
*_override.tofu
*_override.tf.json
*_override.tofu.json

# Ignore transient lock info files created by tofu apply
.terraform.tfstate.lock.info

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# !example_override.tofu

# Include tfplan files to ignore the plan output of command: tofu plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc
6 changes: 6 additions & 0 deletions options/gitignore/Python
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
Expand Down
1 change: 1 addition & 0 deletions options/gitignore/Unity
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ sysinfo.txt
*.apk
*.aab
*.unitypackage
*.unitypackage.meta
*.app

# Crashlytics generated file
Expand Down
2 changes: 2 additions & 0 deletions options/gitignore/VisualStudio
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ StyleCopReport.xml
*.pgc
*.pgd
*.rsp
# but not Directory.Build.rsp, as it configures directory-level build defaults
!Directory.Build.rsp
*.sbr
*.tlb
*.tli
Expand Down
27 changes: 27 additions & 0 deletions options/license/CC-PDM-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
No Copyright

This work has been identified as being free of known restrictions under
copyright law, including all related and neighboring rights.


You can copy, modify, distribute and perform the work, even for commercial
purposes, all without asking permission. See Other Information below.

Other Information

The work may not be free of known copyright restrictions in all jurisdictions .

Persons may have other rights in or related to the work, such as patent or
trademark rights, and others may have rights in how the work is used, such as
publicity or privacy rights.

In some jurisdictions moral rights of the author may persist beyond the term of
copyright. These rights may include the right to be identified as the author
and the right to object to derogatory treatments.

Unless expressly stated otherwise, the person who identified the work makes no
warranties about the work, and disclaims liability for all uses of the work, to
the fullest extent permitted by applicable law.

When using or citing the work, you should not imply endorsement by the author
or the person who identified the work.
Loading

0 comments on commit 2d49aec

Please sign in to comment.