33 lines
793 B
Go
33 lines
793 B
Go
package pipeline
|
|
|
|
import "strings"
|
|
|
|
// ExecutionSource ignores retired input contracts for already-persisted
|
|
// historical definitions (including edit drafts). Submission validation remains strict; original source
|
|
// and content hashes are never rewritten.
|
|
func ExecutionSource(source string) string {
|
|
var lines []string
|
|
active := ""
|
|
for _, line := range strings.Split(source, "\n") {
|
|
trimmed := strings.TrimSpace(line)
|
|
if active != "" {
|
|
block := active
|
|
if trimmed == "```" {
|
|
active = ""
|
|
}
|
|
if block != "input" {
|
|
lines = append(lines, line)
|
|
}
|
|
continue
|
|
}
|
|
if strings.HasPrefix(trimmed, "```") {
|
|
active = strings.TrimPrefix(trimmed, "```")
|
|
if active == "input" {
|
|
continue
|
|
}
|
|
}
|
|
lines = append(lines, line)
|
|
}
|
|
return strings.Join(lines, "\n")
|
|
}
|