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

Public Member Functions

List[Noderun (self)
 
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() [1/2]

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 by the scheduler.
Definition: gnunet-arm.c:917
static int get
Get DID Documement for DID Flag.
Definition: gnunet-did.c:63

References Set.content, GNUNET_ABD_Request.env, Channel.env, TransportPlugin.env, Plugin.env, CadetOutOfOrderMessage.env, CadetConnection.env, GCP_MessageQueueManager.env, CadetTunnelQueueEntry.env, PeerRecord.env, GNUNET_DATACACHE_Handle.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, GNUNET_PEERSTORE_StoreContext.env, GNUNET_PEERSTORE_IterateContext.env, RequestContext.env, GNUNET_RECLAIM_Operation.env, GNUNET_RECLAIM_TicketIterator.env, GNUNET_RECLAIM_AttributeIterator.env, GNUNET_RECLAIM_CredentialIterator.env, Neighbour.env, get, GNUNET_SERVICE_Handle.options, 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, PeerstoreRecordMessage.options, GNUNET_PEERSTORE_StoreContext.options, StartMessage.options, GNUNET_CONVERSATION_Caller.state, GNUNET_CONVERSATION_Phone.state, GNUNET_CONVERSATION_Call.state, Operation.state, Set.state, CadetChannel.state, CadetConnection.state, MonitorNotifyMessage.state, GNUNET_FS_UnindexContext.state, DownloadRequest.state, Socks5Request.state, GNUNET_MESSENGER_SrvRoom.state, GNUNET_MESSENGER_SrvTunnel.state, MhdConnectionHandle.state, OIDC_Variables.state, MonitoredPeer.state, and PeerResolutionContext.state.

◆ run() [2/2]

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

References Set.content, GNUNET_ABD_Request.env, Channel.env, TransportPlugin.env, Plugin.env, CadetOutOfOrderMessage.env, CadetConnection.env, GCP_MessageQueueManager.env, CadetTunnelQueueEntry.env, PeerRecord.env, GNUNET_DATACACHE_Handle.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, GNUNET_PEERSTORE_StoreContext.env, GNUNET_PEERSTORE_IterateContext.env, RequestContext.env, GNUNET_RECLAIM_Operation.env, GNUNET_RECLAIM_TicketIterator.env, GNUNET_RECLAIM_AttributeIterator.env, GNUNET_RECLAIM_CredentialIterator.env, Neighbour.env, get, GNUNET_SERVICE_Handle.options, 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, PeerstoreRecordMessage.options, GNUNET_PEERSTORE_StoreContext.options, StartMessage.options, GNUNET_CONVERSATION_Caller.state, GNUNET_CONVERSATION_Phone.state, GNUNET_CONVERSATION_Call.state, Operation.state, Set.state, CadetChannel.state, CadetConnection.state, MonitorNotifyMessage.state, GNUNET_FS_UnindexContext.state, DownloadRequest.state, Socks5Request.state, GNUNET_MESSENGER_SrvRoom.state, GNUNET_MESSENGER_SrvTunnel.state, MhdConnectionHandle.state, OIDC_Variables.state, MonitoredPeer.state, and PeerResolutionContext.state.

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 files: