Changes

Jump to navigation Jump to search
787 bytes added ,  10:38, 1 July 2020
The ConTeXt source browser at [http://source.contextgarden.net http://source.contextgarden.net] has recently been replaced by a Lua implementation that uses Hans Hagen's SciTE lexers for syntax highlighting and a search index that is built up using a Lua script.
 
''Note:'' for some of the really large files (for example <code>char-def.lua</code>), syntax highlighting is disabled.
= Browsing the installed files =
This installation is not always completely in sync with the latest ConTeXt distribution, because setting up the installation on the server is quite elaborate (as various auxiliary databases need to be updated as well).
 
When viewing a file, on top of the highlighted source the file name is displayed. This is also a download link. It also shows the file size and a modification time (but that is the creation time of the ConTeXt distribution, so not particularly useful).
= Searching the sources =
''Note:'' At the moment, you cannot do AND/OR searches or search for multiple words at the same time.
There are four option checkboxes immediately below the search input, and two separate options, to control the search. Each of these are optional, with irrelevant values. The script only looks at the existence of the option, it never checks the actual values except for the value of the <code>search field uses Lua patterns by default</code> parameter itself.  == Optional search index: Comments ==
Quick startName: Lua patterns have roughly '''comments'''Default: '''OFF''' This includes the same list index of special characters everything that is marked as simple regular expressions, but they use 'comment' by the <code>%</code> character for escaping thoseSciTE lexers. See the [https == Optional search index://www.lua.org/manual/5.3/manual.html#6.4.1 Patterns section] of the Lua manual for details.Docs ==
There are four option checkboxes below the search input. Each of these are optional, with irrelevant values. The script only looks at the existence of the option, it never checks the actual values except for the value of the <code>search</code> parameter itself.Name: '''docs'''Default: '''OFF'''
== ignore comments ==This includes the index of all files in the <code>doc/</code> subtree.
Name== Optional search index: '''igncomments'''Default: '''ON'''MkII ==
Name: '''mkii'''
Default: '''OFF'''
This skips everything that is marked as 'comment' by includes the SciTE lexersindex of MkII files.
== ignore doc tree Optional search index: Data ==
Name: '''igndocsdata'''Default: '''ONOFF'''
This skips all includes the index of Data files in the (<code>data/</code> subtree, <code>interface/</code> subtree, <code>docscripts/</code> subtree, sample files, test files, et cetera).
== whole Whole words only ==
Name: '''wholewords'''
Modifies the search pattern by anchoring it to the begin and end of the search index keys, as if it was enclosed in <code>^</code>...<code>$</code>
== plain text Lua string pattern matches ==
Name: '''ppat'''
Default: '''OFF'''
Treats the input as a lua string pattern instead of plain text instead . Quick start: Lua patterns have roughly the same list of a special characters as simple regular expressions, but they use the <code>%</code> character for escaping those. See the [https://www.lua pattern.org/manual/5.3/manual.html#6.4.1 Patterns section] of the Lua manual for details.
= Highlighting of search terms =
If you select a file that matches your search term, it will highlight the found matches with a yellow background. It also makes the page number of matching lines into a hyperlink to the next match in that file.
The highlighting is done separate from the search index, which means that it will sometimes find extra matches. For example, if you search for <code>def</code>, you would not see all the thousands of hits for <code>\def</code> in the file list on the left. But if you click on a particular file, the syntax highlighter will highlight all of the <code>def</code> substrings it finds in the entire file. Sometime in the future, I will try to limit the highlighter to only highlight lines that are actually in the match liston any matching line.
= Linking from the wiki =
<nowiki>{{src|context.mkiv?search{{=}}lang-}}</nowiki>
<nowiki>{{src|context.mkiv?search{{=}}lang-&ppat{{=}}1}}</nowiki>
<nowiki>{{src|context.mkiv#l107}}</nowiki>
{{src|context.mkiv?search{{=}}lang-}}
{{src|context.mkiv?search{{=}}lang-&ppat{{=}}1}}
{{src|context.mkiv#l107}}
''Note that you have to write the equals sign as <nowiki>{{=}}</nowiki>inside wiki templates.''
= A note about the search index =
* Only words longer than three letters are indexed.
* Lua language keywords and matches that occur more than 1000 times (approx.) are not indexed.
* All of the files in the <code>patterns/</code> subtree and the top-level <code>fonts/</code> tree are skipped.
If you find a problem that is not caused by one of the aforementioned limitations, please report it to [[User:taco]] by sending an email to [mailto:gardeners@contextgarden.net gardeners@contextgarden.net].
 
[[Category:Development]]

Navigation menu