Parse switches in code block params
There's has a special case for parameters that start with `-` and come directly after the language. See [1] [1] https://orgmode.org/manual/Literal-Examples.html#FOOT117
This commit is contained in:
parent
6cfae31132
commit
8e4a992dbd
1 changed files with 9 additions and 1 deletions
10
org/block.go
10
org/block.go
|
@ -157,7 +157,15 @@ func splitParameters(s string) []string {
|
|||
parameters, parts := []string{}, strings.Split(s, " :")
|
||||
lang, rest := strings.TrimSpace(parts[0]), parts[1:]
|
||||
if lang != "" {
|
||||
parameters = append(parameters, lang)
|
||||
xs := strings.Fields(lang)
|
||||
parameters = append(parameters, xs[0])
|
||||
for i := 1; i < len(xs); i++ {
|
||||
k, v := xs[i], ""
|
||||
if i+1 < len(xs) && xs[i+1][0] != '-' {
|
||||
v, i = xs[i+1], i+1
|
||||
}
|
||||
parameters = append(parameters, k, v)
|
||||
}
|
||||
}
|
||||
for _, p := range rest {
|
||||
kv := strings.SplitN(p+" ", " ", 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue