GNUnet  0.20.0
typescriptdomain Namespace Reference

Data Structures

class  TypeScriptDefinition
 
class  TypeScriptDomain
 
class  BetterTypeScriptLexer
 
class  LinkFilter
 
class  LinkingHtmlFormatter
 
class  MyPygmentsBridge
 
class  MyHtmlBuilder
 

Functions

def get_annotation (tok, key)
 
def copy_token (tok)
 
def tok_setprop (tok, key, value)
 
def tok_getprop (tok, key)
 
def setup (app)
 

Variables

 logger = logging.getLogger(__name__)
 
dictionary token_props = {}
 
dictionary _escape_html_table
 
 link_reg = re.compile(r"(?<!`)`([^`<]+)\s*(?:<([^>]+)>)?\s*`_?")
 
 literal_reg = re.compile(r"``([^`]+)``")
 

Detailed Description

TypeScript domain.

:copyright: Copyright 2019 by Taler Systems SA
:license: LGPLv3+
:author: Florian Dold

Function Documentation

◆ get_annotation()

def typescriptdomain.get_annotation (   tok,
  key 
)

Definition at line 542 of file typescriptdomain.py.

542 def get_annotation(tok, key):
543  if not hasattr(tok, "kv"):
544  return None
545  return tok.kv.get(key)
546 
547 
def get_annotation(tok, key)

Referenced by typescriptdomain.LinkingHtmlFormatter._format_lines().

Here is the caller graph for this function:

◆ copy_token()

def typescriptdomain.copy_token (   tok)

Definition at line 548 of file typescriptdomain.py.

548 def copy_token(tok):
549  new_tok = _TokenType(tok)
550  # This part is very fragile against API changes ...
551  new_tok.subtypes = set(tok.subtypes)
552  new_tok.parent = tok.parent
553  return new_tok
554 
555 

Referenced by typescriptdomain.LinkFilter._filter_one_literal(), and typescriptdomain.LinkFilter.filter().

Here is the caller graph for this function:

◆ tok_setprop()

def typescriptdomain.tok_setprop (   tok,
  key,
  value 
)

Definition at line 556 of file typescriptdomain.py.

556 def tok_setprop(tok, key, value):
557  tokid = id(tok)
558  e = token_props.get(tokid)
559  if e is None:
560  e = token_props[tokid] = (tok, {})
561  _, kv = e
562  kv[key] = value
563 
564 
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
def tok_setprop(tok, key, value)

References id.

Referenced by typescriptdomain.LinkFilter._filter_one_literal(), and typescriptdomain.LinkFilter.filter().

Here is the caller graph for this function:

◆ tok_getprop()

def typescriptdomain.tok_getprop (   tok,
  key 
)

Definition at line 565 of file typescriptdomain.py.

565 def tok_getprop(tok, key):
566  tokid = id(tok)
567  e = token_props.get(tokid)
568  if e is None:
569  return None
570  _, kv = e
571  return kv.get(key)
572 
573 
def tok_getprop(tok, key)

References id.

Referenced by typescriptdomain.LinkingHtmlFormatter._get_value().

Here is the caller graph for this function:

◆ setup()

def typescriptdomain.setup (   app)

Definition at line 578 of file typescriptdomain.py.

578 def setup(app):
579 
580  class TsrefLexer(BetterTypeScriptLexer):
581  def __init__(self, **options):
582  super().__init__(**options)
583  self.add_filter(LinkFilter(app))
584 
585  app.add_lexer("tsref", TsrefLexer)
586  app.add_domain(TypeScriptDomain)
587  app.add_builder(MyHtmlBuilder)

Variable Documentation

◆ logger

typescriptdomain.logger = logging.getLogger(__name__)

Definition at line 38 of file typescriptdomain.py.

◆ token_props

dictionary typescriptdomain.token_props = {}

Definition at line 304 of file typescriptdomain.py.

◆ _escape_html_table

dictionary typescriptdomain._escape_html_table
private
Initial value:
1 = {
2  ord("&"): u"&amp;",
3  ord("<"): u"&lt;",
4  ord(">"): u"&gt;",
5  ord('"'): u"&quot;",
6  ord("'"): u"&#39;",
7 }

Definition at line 361 of file typescriptdomain.py.

◆ link_reg

typescriptdomain.link_reg = re.compile(r"(?<!`)`([^`<]+)\s*(?:<([^>]+)>)?\s*`_?")

Definition at line 574 of file typescriptdomain.py.

◆ literal_reg

typescriptdomain.literal_reg = re.compile(r"``([^`]+)``")

Definition at line 575 of file typescriptdomain.py.