Changeset View
Changeset View
Standalone View
Standalone View
doc/katepart/development.docbook
Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Line(s) | |||||
281 | <varlistentry> | 281 | <varlistentry> | ||
282 | <term>Next comes the <userinput>highlighting</userinput> element, which | 282 | <term>Next comes the <userinput>highlighting</userinput> element, which | ||
283 | contains the optional element <userinput>list</userinput> and the required | 283 | contains the optional element <userinput>list</userinput> and the required | ||
284 | elements <userinput>contexts</userinput> and <userinput>itemDatas</userinput>.</term> | 284 | elements <userinput>contexts</userinput> and <userinput>itemDatas</userinput>.</term> | ||
285 | <listitem> | 285 | <listitem> | ||
286 | <para><userinput>list</userinput> elements contain a list of keywords. In | 286 | <para><userinput>list</userinput> elements contain a list of keywords. In | ||
287 | this case the keywords are <emphasis>class</emphasis> and <emphasis>const</emphasis>. | 287 | this case the keywords are <emphasis>class</emphasis> and <emphasis>const</emphasis>. | ||
288 | You can add as many lists as you need.</para> | 288 | You can add as many lists as you need.</para> | ||
289 | <para>Since &kde-frameworks; 5.53, a list can include keywords from another | ||||
290 | list or language/file, using the <userinput>include</userinput> element. | ||||
291 | <userinput>##</userinput> is used to separate the list name and the language | ||||
292 | definition name, in the same way as in the <userinput>IncludeRules</userinput> rule. | ||||
293 | This is useful to avoid duplicating keyword lists, if you need to include the keywords | ||||
294 | of another language/file. For example, the <emphasis>othername</emphasis> list | ||||
295 | contains the <emphasis>str</emphasis> keyword and all the keywords of the | ||||
296 | <emphasis>types</emphasis> list, which belongs to the <emphasis>ISO C++</emphasis> | ||||
297 | language.</para> | ||||
289 | <para>The <userinput>contexts</userinput> element contains all contexts. | 298 | <para>The <userinput>contexts</userinput> element contains all contexts. | ||
290 | The first context is by default the start of the highlighting. There are | 299 | The first context is by default the start of the highlighting. There are | ||
291 | two rules in the context <emphasis>Normal Text</emphasis>, which match | 300 | two rules in the context <emphasis>Normal Text</emphasis>, which match | ||
292 | the list of keywords with the name <emphasis>somename</emphasis> and a | 301 | the list of keywords with the name <emphasis>somename</emphasis> and a | ||
293 | rule that detects a quote and switches the context to <emphasis>string</emphasis>. | 302 | rule that detects a quote and switches the context to <emphasis>string</emphasis>. | ||
294 | To learn more about rules read the next chapter.</para> | 303 | To learn more about rules read the next chapter.</para> | ||
295 | <para>The third part is the <userinput>itemDatas</userinput> element. It | 304 | <para>The third part is the <userinput>itemDatas</userinput> element. It | ||
296 | contains all color and font styles needed by the contexts and rules. | 305 | contains all color and font styles needed by the contexts and rules. | ||
297 | In this example, the <userinput>itemData</userinput> <emphasis>Normal Text</emphasis>, | 306 | In this example, the <userinput>itemData</userinput> <emphasis>Normal Text</emphasis>, | ||
298 | <emphasis>String</emphasis> and <emphasis>Keyword</emphasis> are used. | 307 | <emphasis>String</emphasis> and <emphasis>Keyword</emphasis> are used. | ||
299 | </para> | 308 | </para> | ||
300 | <programlisting> | 309 | <programlisting> | ||
301 | <highlighting> | 310 | <highlighting> | ||
302 | <list name="somename"> | 311 | <list name="somename"> | ||
303 | <item> class </item> | 312 | <item>class</item> | ||
304 | <item> const </item> | 313 | <item>const</item> | ||
305 | </list> | 314 | </list> | ||
315 | <list name="othername"> | ||||
316 | <item>str</item> | ||||
317 | <include>types##ISO C++</include> | ||||
318 | </list> | ||||
306 | <contexts> | 319 | <contexts> | ||
307 | <context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" > | 320 | <context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" > | ||
308 | <keyword attribute="Keyword" context="#stay" String="somename" /> | 321 | <keyword attribute="Keyword" context="#stay" String="somename" /> | ||
322 | <keyword attribute="Keyword" context="#stay" String="othername" /> | ||||
309 | <DetectChar attribute="String" context="string" char="&quot;" /> | 323 | <DetectChar attribute="String" context="string" char="&quot;" /> | ||
310 | </context> | 324 | </context> | ||
311 | <context attribute="String" lineEndContext="#stay" name="string" > | 325 | <context attribute="String" lineEndContext="#stay" name="string" > | ||
312 | <DetectChar attribute="String" context="#pop" char="&quot;" /> | 326 | <DetectChar attribute="String" context="#pop" char="&quot;" /> | ||
313 | </context> | 327 | </context> | ||
314 | </contexts> | 328 | </contexts> | ||
315 | <itemDatas> | 329 | <itemDatas> | ||
316 | <itemData name="Normal Text" defStyleNum="dsNormal" /> | 330 | <itemData name="Normal Text" defStyleNum="dsNormal" /> | ||
▲ Show 20 Lines • Show All 2548 Lines • Show Last 20 Lines |