doc.kak: Use a github compatible anchor generation

Convert session names to lowercase and replace spaces with minus
to generate anchor names.
This commit is contained in:
Maxime Coste 2017-11-08 20:15:46 +08:00
parent b8fdcff7b0
commit 8aa35c0724
2 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ command *q!* has to be used). Aliases are mentionned below each commands.
*-markup*::: *-markup*:::
expand the markup strings in *text* (See expand the markup strings in *text* (See
<<expansions#Markup strings,`:doc expansions 'Markup strings'`>>) <<expansions#markup-strings,`:doc expansions markup-strings`>>)
*-debug*::: *-debug*:::
print the given text to the *\*debug** buffer print the given text to the *\*debug** buffer
@ -138,7 +138,7 @@ command *q!* has to be used). Aliases are mentionned below each commands.
*define-command* [<flags>] <name> <command>:: *define-command* [<flags>] <name> <command>::
*alias* def + *alias* def +
define a new command (c.f. the 'Declaring new commands' section below) define a new command (See <<declaring-new-commands,Declaring new commands>>)
*map* <scope> <mode> <key> <keys>:: *map* <scope> <mode> <key> <keys>::
bind a list of keys to a combination (See <<mapping#,`:doc mapping`>>) bind a list of keys to a combination (See <<mapping#,`:doc mapping`>>)

View File

@ -39,7 +39,7 @@ define-command -hidden doc-parse-anchors %{
# Find sections as add them as imlicit anchors # Find sections as add them as imlicit anchors
execute-keys \%s ^={2,}\h+([^\n]+)$ <ret> execute-keys \%s ^={2,}\h+([^\n]+)$ <ret>
evaluate-commands -itersel %{ evaluate-commands -itersel %{
set-option -add buffer doc_anchors "%val{selection_desc}|%reg{1}" set-option -add buffer doc_anchors "%val{selection_desc}|%sh{printf '%s' \"$kak_reg_1\" | tr '[A-Z ]' '[a-z-]'}"
} }
# Parse explicit anchors and remove their text # Parse explicit anchors and remove their text