Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Version 0.0.1: Initial upload

  • Loading branch information...
commit 08cf96946a4d8d7776fb6c97d895933994f4fdd5 0 parents
Daniel Graña authored vim-scripts committed
5  README
... ...
@@ -0,0 +1,5 @@
  1
+This is a mirror of http://www.vim.org/scripts/script.php?script_id=1994
  2
+
  3
+This is the syntax highlighter for Atlassian Confluence WIKI 
  4
+
  5
+http://confluence.atlassian.com/renderer/notationhelp.action?section=all
152  syntax/confluencewiki.vim
... ...
@@ -0,0 +1,152 @@
  1
+"============================================================================
  2
+"
  3
+" Confluence WIKI syntax file
  4
+"
  5
+" Language:    Confluence WIKI
  6
+" Version:     0.0.1
  7
+" Maintainer:  Daniel Graña <daniel{AT}insophia{DOT}com>
  8
+" License:     GPL (http://www.gnu.org/licenses/gpl.txt)
  9
+"    Copyright (C) 2004  Rainer Thierfelder
  10
+"
  11
+"    This program is free software; you can redistribute it and/or modify
  12
+"    it under the terms of the GNU General Public License as published by
  13
+"    the Free Software Foundation; either version 2 of the License, or
  14
+"    (at your option) any later version.
  15
+"
  16
+"    This program is distributed in the hope that it will be useful,
  17
+"    but WITHOUT ANY WARRANTY; without even the implied warranty of
  18
+"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19
+"    GNU General Public License for more details.
  20
+"
  21
+"    You should have received a copy of the GNU General Public License
  22
+"    along with this program; if not, write to the Free Software
  23
+"    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  24
+"
  25
+"============================================================================
  26
+"
  27
+" For version 5.x: Clear all syntax items
  28
+" For version 6.x: Quit when a syntax file was already loaded
  29
+if !exists("main_syntax")
  30
+  if version < 600
  31
+    syntax clear
  32
+  elseif exists("b:current_syntax")
  33
+    finish
  34
+  endif
  35
+  let main_syntax = 'confluencewiki'
  36
+endif
  37
+
  38
+" Don't use standard HiLink, it will not work with included syntax files
  39
+if version < 508
  40
+  command! -nargs=+ ConfluenceHiLink   highlight link <args>
  41
+  command! -nargs=+ ConfluenceSynColor highlight <args>
  42
+else
  43
+  command! -nargs=+ ConfluenceHiLink   highlight default link <args>
  44
+  command! -nargs=+ ConfluenceSynColor highlight default <args>
  45
+endif
  46
+
  47
+"============================================================================
  48
+" Group Definitions:    
  49
+"============================================================================
  50
+
  51
+" Emphasis:  
  52
+function! s:ConfluenceCreateEmphasis(token, name)
  53
+    execute 'syntax region confluence'.a:name.
  54
+           \' oneline start="\(^\|[ ]\)\zs'.a:token.
  55
+           \'" end="'.a:token.'\ze\([,. ?):-]\|$\)"'
  56
+endfunction
  57
+
  58
+syntax region confluenceFixed oneline start="\(^\|[ ]\)\zs{{" end="}}\ze\([,. ?):-]\|$\)"
  59
+
  60
+call s:ConfluenceCreateEmphasis('+', 'Underlined')
  61
+call s:ConfluenceCreateEmphasis('\*', 'Bold')
  62
+call s:ConfluenceCreateEmphasis('_',  'Italic')
  63
+call s:ConfluenceCreateEmphasis('-', 'Strike')
  64
+
  65
+
  66
+" Syntax:  
  67
+syntax match confluenceDelimiter "|"
  68
+syntax match confluenceSeparator    "^----*"
  69
+syntax match confluenceList "^[*#]\+\ze "
  70
+syntax match confluenceSingleList "^-\ze "
  71
+
  72
+"syntax match confluenceVariable "\([^!]\|^\)\zs%\w\+%"
  73
+
  74
+" tag support is a limited to no white spaces in tag parameters
  75
+syntax match confluenceTag      "{\w\+\(:\(\w\+=\?[a-zA-Z0-9 ]\+|\?\)*\)\?}"
  76
+
  77
+"syntax region confluenceComment  start="<!--" end="-->"
  78
+
  79
+syntax region confluenceCode matchgroup=confluenceCode
  80
+    \ start="{code}" end="{code}"
  81
+
  82
+syntax region confluenceQuote matchgroup=confluenceQuote
  83
+    \ start="{quote}" end="{quote}"
  84
+
  85
+syntax region confluenceVerbatim matchgroup=confluenceVerbatim
  86
+    \ start="{noformat}" end="{noformat}"
  87
+
  88
+syntax region confluenceHeading matchgroup=confluenceHeadingMarker oneline
  89
+    \ start="^h[1-9]. " end="$"
  90
+
  91
+let s:wikiWord = '\u[a-z0-9]\+\(\u[a-z0-9]\+\)\+'
  92
+
  93
+execute 'syntax match confluenceAnchor +^#'.s:wikiWord.'\ze\(\>\|_\)+'
  94
+execute 'syntax match confluenceWord +\(\s\|^\)\zs\(\u\l\+\.\)\='.s:wikiWord.'\(#'.s:wikiWord.'\)\=\ze\(\>\|_\)+'
  95
+" Regex guide:                   ^pre        ^web name       ^wikiword  ^anchor               ^ post
  96
+
  97
+" Links: 
  98
+syntax region confluenceLink matchgroup=confluenceLinkMarker
  99
+    \ start="\( \|^\)\zs\[" end="\]\ze\([,. ?):-]\|$\)"
  100
+    \ contains=confluenceForcedLink,confluenceLinkRef keepend
  101
+
  102
+execute 'syntax match confluenceForcedLink +[ A-Za-z0-9]\+\(#'.s:wikiWord.'\)\=+ contained'
  103
+
  104
+syntax match confluenceLinkLabel    ".\{-}\ze\["
  105
+    \ contained contains=confluenceLinkMarker nextgroup=confluenceLinkLabel
  106
+syntax match confluenceLinkRef  ".\{-}\ze\]"   contained contains=confluenceLinkMarker
  107
+syntax match confluenceLinkMarker "|"           contained
  108
+
  109
+"============================================================================
  110
+" Group Linking:    
  111
+"============================================================================
  112
+
  113
+ConfluenceHiLink confluenceHeading       String
  114
+ConfluenceHiLink confluenceHeadingMarker Operator
  115
+ConfluenceHiLink confluenceVariable      PreProc
  116
+ConfluenceHiLink confluenceTag           PreProc
  117
+ConfluenceHiLink confluenceQuote         PreProc
  118
+ConfluenceHiLink confluenceComment       Comment
  119
+ConfluenceHiLink confluenceWord          Tag
  120
+ConfluenceHiLink confluenceAnchor        PreProc
  121
+ConfluenceHiLink confluenceVerbatim      Constant
  122
+ConfluenceHiLink confluenceCode          Constant
  123
+ConfluenceHiLink confluenceList          Operator
  124
+ConfluenceHiLink confluenceSingleList    Operator
  125
+
  126
+ConfluenceHiLink confluenceDelimiter     Operator
  127
+
  128
+" Links
  129
+ConfluenceSynColor confluenceLinkMarker term=bold cterm=bold gui=bold
  130
+ConfluenceHiLink   confluenceForcedLink Tag
  131
+ConfluenceHiLink   confluenceLinkRef    Tag
  132
+ConfluenceHiLink   confluenceLinkLabel  Identifier
  133
+
  134
+" Emphasis
  135
+ConfluenceSynColor confluenceFixed      term=underline cterm=underline gui=underline
  136
+ConfluenceSynColor confluenceItalic     term=italic cterm=italic gui=italic
  137
+ConfluenceSynColor confluenceBold       term=bold cterm=bold gui=bold
  138
+ConfluenceSynColor confluenceSingleList term=bold cterm=bold gui=bold
  139
+
  140
+"============================================================================}" Clean Up:    {{{1
  141
+"============================================================================
  142
+
  143
+delcommand ConfluenceHiLink
  144
+delcommand ConfluenceSynColor
  145
+
  146
+if main_syntax == 'confluencewiki'
  147
+  unlet main_syntax
  148
+endif
  149
+
  150
+let b:current_syntax = "confluencewiki"
  151
+
  152
+" vim:fdm=marker

0 notes on commit 08cf969

Please sign in to comment.
Something went wrong with that request. Please try again.