def doc_shortcode(*args, **kwargs):
 text = kwargs['data']
 (success, twin_slugs, title, permalink, slug) = _doc_link(text, text, LOGGER)
 if success:
  if twin_slugs:
   LOGGER.warn('More than one post with the same slug. Using "{0}" for doc shortcode'.format(permalink))
  return '<a href="{0}">{1}</a>'.format(permalink, title)
 else:
  LOGGER.error('"{0}" slug doesn\'t exist.'.format(slug))
  return '<span class="error text-error" style="color: red;">Invalid link: {0}</span>'.format(text)

def doc_shortcode ( * args , ** kwargs ) : text = kwargs [ 'data' ] ( success , twin_slugs , title , permalink , slug ) = _doc_link ( text , text , LOGGER ) if success : if twin_slugs : LOGGER . warn ( 'More than one post with the same slug. Using "{0}" for doc shortcode' . format ( permalink ) ) return '<a href="{0}">{1}</a>' . format ( permalink , title ) else : LOGGER . error ( '"{0}" slug doesn\'t exist.' . format ( slug ) ) return '<span class="error text-error" style="color: red;">Invalid link: {0}</span>' . format ( text )
implement the doc shortcode .