Skip to content

origin_lnum in context dictionary not working #183

@Ginner

Description

@Ginner

Description

The context dictionary for the templates functionality returns 1 for origin_lnum .

Expected behaviour:
In my template, for a given case, {origin_lnum} is expected to return 146, as the wiki link is at line 146. However it returns 1.

Looking at the context dictionary and the function wiki#nav/get_previous() I don't see how it could return anything else than 1:

autoload/wiki/template.vim:

let l:origin = wiki#nav#get_previous()

let l:context = {
        ...
        \ 'origin_lnum': l:origin[1][1],
        ...
        \}

autoload/wiki/nav.vim:

function! wiki#nav#get_previous() abort "{{{1
  let l:previous = get(s:position_stack, -1, [])
  if !empty(l:previous) | return l:previous | endif

  let l:file = expand('#:p')
  let l:pos = [0, 1, 1, 0, 1]                                      <------ Namely this line
  if filereadable(l:file) | return [l:file, l:pos] | endif

  return ['', l:pos]
endfunction

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions