File: issue_1311_wiki_code_convert_newline.vader

package info (click to toggle)
vim-vimwiki 2024.01.24-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,692 kB
  • sloc: sh: 313; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Non regression tests for issue #1311
# -- Can't enable syntax highlighting for codes in HTML files when converting wiki to HTML

#
# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file
# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader

Given vimwiki (Input file with python code):
  {{{type=py
  if (a == 2):
      print("2")
  else:
      print("other")
  }}}

Execute (Convert to HTML):
  Log "HTML path: " . vimwiki#vars#get_wikilocal('path_html')

  let g:bck_command = g:vimwiki_global_vars['listing_hl_command']
  let g:vimwiki_global_vars['listing_hl_command'] = 'cat'

  call ConvertWiki2Body()
  
  g/^\s*$/d

Expect (Output with good newlines):
  <pre type=py>
  if (a == 2):
      print("2")
  else:
      print("other")
  </pre>


Execute (restore):
  let g:vimwiki_global_vars['listing_hl_command'] = g:bck_command