GNUnet  0.20.0
typescriptdomain.TypeScriptDefinition Class Reference
Inheritance diagram for typescriptdomain.TypeScriptDefinition:
[legend]
Collaboration diagram for typescriptdomain.TypeScriptDefinition:
[legend]

Public Member Functions

List[Noderun (self)
 

Static Public Attributes

bool has_content = True
 
int required_arguments = 1
 
int optional_arguments = 0
 
bool final_argument_whitespace = False
 
dictionary option_spec
 

Detailed Description

Directive for a code block with special highlighting or line numbering
settings.

Definition at line 41 of file typescriptdomain.py.

Member Function Documentation

◆ run()

List[Node] typescriptdomain.TypeScriptDefinition.run (   self)

Definition at line 61 of file typescriptdomain.py.

61  def run(self) -> List[Node]:
62  document = self.state.document
63  code = "\n".join(self.content)
64  location = self.state_machine.get_source_and_line(self.lineno)
65 
66  linespec = self.options.get("emphasize-lines")
67  if linespec:
68  try:
69  nlines = len(self.content)
70  hl_lines = parselinenos(linespec, nlines)
71  if any(i >= nlines for i in hl_lines):
72  logger.warning(
73  __("line number spec is out of range(1-%d): %r")
74  % (nlines, self.options["emphasize-lines"]),
75  location=location,
76  )
77 
78  hl_lines = [x + 1 for x in hl_lines if x < nlines]
79  except ValueError as err:
80  return [document.reporter.warning(err, line=self.lineno)]
81  else:
82  hl_lines = None
83 
84  if "dedent" in self.options:
85  location = self.state_machine.get_source_and_line(self.lineno)
86  lines = code.split("\n")
87  lines = dedent_lines(lines, self.options["dedent"], location=location)
88  code = "\n".join(lines)
89 
90  literal = nodes.literal_block(code, code) # type: Element
91  if "linenos" in self.options or "lineno-start" in self.options:
92  literal["linenos"] = True
93  literal["classes"] += self.options.get("class", [])
94  literal["force"] = "force" in self.options
95  literal["language"] = "tsref"
96  extra_args = literal["highlight_args"] = {}
97  if hl_lines is not None:
98  extra_args["hl_lines"] = hl_lines
99  if "lineno-start" in self.options:
100  extra_args["linenostart"] = self.options["lineno-start"]
101  self.set_source_info(literal)
102 
103  caption = self.options.get("caption")
104  if caption:
105  try:
106  literal = container_wrapper(self, literal, caption)
107  except ValueError as exc:
108  return [document.reporter.warning(exc, line=self.lineno)]
109 
110  tsid = "tsref-type-" + self.arguments[0]
111  literal["ids"].append(tsid)
112 
113  tsname = self.arguments[0]
114  ts = self.env.get_domain("ts")
115  ts.add_object("type", tsname, self.env.docname, tsid)
116 
117  return [literal]
118 
119 
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run.
Definition: gnunet-abd.c:757
static int get
Get DID Documement for DID Flag.
Definition: gnunet-did.c:66
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...

References Set.content, GNUNET_ABD_Request.env, SolverHandle.env, GAS_PROPORTIONAL_Handle.env, CadetOutOfOrderMessage.env, CadetConnection.env, GCP_MessageQueueManager.env, CadetTunnelQueueEntry.env, Channel.env, PeerRecord.env, GNUNET_DATACACHE_Handle.env, Plugin.env, GNUNET_DATASTORE_QueueEntry.env, DatastorePlugin.env, GNUNET_DHT_PutHandle.env, GDS_Underlay.env, GSF_PeerTransmitHandle.env, GSF_DelayedHandle.env, PeerPlan.env, MigrationReadyPeer.env, GNUNET_GNS_LookupRequest.env, GNUNET_NAMESTORE_QueueEntry.env, GNUNET_NAMESTORE_ZoneIterator.env, TransportPlugin.env, RequestContext.env, GNUNET_RECLAIM_Operation.env, GNUNET_RECLAIM_TicketIterator.env, GNUNET_RECLAIM_AttributeIterator.env, GNUNET_RECLAIM_CredentialIterator.env, HTTP_Client_Plugin.env, HTTP_Server_Plugin.env, Neighbour.env, get, len, GNUNET_CADET_ConnectionCreateMessage.options, InitMessage.options, GSC_Client.options, GNUNET_DHT_ClientGetMessage.options, GNUNET_DHT_ClientResultMessage.options, GNUNET_DHT_ClientPutMessage.options, GNUNET_DHT_MonitorPutMessage.options, GNUNET_DHT_MonitorGetMessage.options, GNUNET_DHT_MonitorGetRespMessage.options, GNUNET_DHT_GetHandle.options, GetActionContext.options, PeerPutMessage.options, PeerResultMessage.options, PeerGetMessage.options, RecentRequest.options, SearchMessage.options, GNUNET_FS_PublishContext.options, GNUNET_FS_SearchContext.options, GNUNET_FS_DownloadContext.options, GNUNET_FS_PublishKskContext.options, GSF_PendingRequestData.options, LookupMessage.options, GNUNET_GNS_LookupWithTldRequest.options, GNS_ResolverHandle.options, StoreRecordMessage.options, GNUNET_PEERSTORE_StoreContext.options, HTTP_Client_Plugin.options, PrettyPrinterContext.options, HttpAddress.options, ServerRequest.options, HTTP_Server_Plugin.options, IPv4TcpAddress.options, IPv6TcpAddress.options, TemplateAddress.options, IPv4UdpAddress.options, IPv6UdpAddress.options, UnixAddress.options, WlanAddress.options, Plugin.options, LEGACY_SERVICE_Context.options, StartMessage.options, GNUNET_SERVICE_Handle.options, CadetChannel.state, CadetConnection.state, GNUNET_CONVERSATION_Caller.state, GNUNET_CONVERSATION_Phone.state, GNUNET_CONVERSATION_Call.state, MonitorNotifyMessage.state, GNUNET_FS_UnindexContext.state, DownloadRequest.state, Socks5Request.state, GNUNET_TRANSPORT_SessionInfo.state, GNUNET_MESSENGER_SrvRoom.state, GNUNET_MESSENGER_SrvTunnel.state, OIDC_Variables.state, MhdConnectionHandle.state, Operation.state, Set.state, RegisteredHostContext.state, LCFContext.state, OperationContext.state, GNUNET_TESTBED_Operation.state, GNUNET_TESTBED_Peer.state, ServiceConnectData.state, GNUNET_TESTBED_RunHandle.state, NeighbourMapEntry.state, ValidationEntry.state, MonitoredPeer.state, PeerResolutionContext.state, RequestHandle.state, ValidationIterateResponseMessage.state, and PeerIterateResponseMessage.state.

Referenced by gnunet_testing.Check.run_blocking(), and gnunet_testing.Check.run_once().

Here is the caller graph for this function:

Field Documentation

◆ has_content

bool typescriptdomain.TypeScriptDefinition.has_content = True
static

Definition at line 47 of file typescriptdomain.py.

◆ required_arguments

int typescriptdomain.TypeScriptDefinition.required_arguments = 1
static

Definition at line 48 of file typescriptdomain.py.

◆ optional_arguments

int typescriptdomain.TypeScriptDefinition.optional_arguments = 0
static

Definition at line 49 of file typescriptdomain.py.

◆ final_argument_whitespace

bool typescriptdomain.TypeScriptDefinition.final_argument_whitespace = False
static

Definition at line 50 of file typescriptdomain.py.

◆ option_spec

dictionary typescriptdomain.TypeScriptDefinition.option_spec
static
Initial value:
= {
"force": directives.flag,
"linenos": directives.flag,
"dedent": int,
"lineno-start": int,
"emphasize-lines": directives.unchanged_required,
"caption": directives.unchanged_required,
"class": directives.class_option,
}

Definition at line 51 of file typescriptdomain.py.


The documentation for this class was generated from the following file: