4,494
edits
(Also on Wikipedia) |
(<source> → <syntaxhighlight>) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
If a subject is notable for reasons unrelated to APL, in addition to being [[APL Wiki:Content guidelines#Notability|APL notable]], then you can indicate this fact using the [[Template:Also on Wikipedia|Also on Wikipedia]] template. By default, both the text and the Wikipedia link target are taken from the page's title. The optional first argument changes the name used in the text (for example, to use only a person's last name) and the second gives the Wikipedia article to link to. | If a subject is notable for reasons unrelated to APL, in addition to being [[APL Wiki:Content guidelines#Notability|APL notable]], then you can indicate this fact using the [[Template:Also on Wikipedia|Also on Wikipedia]] template. By default, both the text and the Wikipedia link target are taken from the page's title. The optional first argument changes the name used in the text (for example, to use only a person's last name) and the second gives the Wikipedia article to link to. | ||
As the template suggests, only APL-related topics, and important background information, should be covered on the APL Wiki if there is also a substantial Wikipedia article. In contrast, topics which are on Wikipedia only because of APL should eventually have APL Wiki articles with at least as much information as Wikipedia, and should not use the Also on Wikipedia template—instead, these articles should include a link to the Wikipedia article in an "External links" section. | As the template suggests, only APL-related topics, and important background information, should be covered on the APL Wiki if there is also a substantial Wikipedia article. In contrast, topics which are on Wikipedia only because of APL should eventually have APL Wiki articles with at least as much information as Wikipedia, and should not use the Also on Wikipedia template—instead, these articles should include a link to the Wikipedia article in an "External links" section. However, content should not be copied directly from Wikipedia. Rewrite it from an APL perspective instead. | ||
== Yes/No tables == | == Yes/No tables == | ||
Line 70: | Line 70: | ||
Inline code is used for single primitives and short expressions and uses the format | Inline code is used for single primitives and short expressions and uses the format | ||
<blockquote><pre>< | <blockquote><pre><syntaxhighlight lang=apl inline>(2=+⌿0=N∘.|N)/N←⍳100</syntaxhighlight></pre></blockquote> | ||
which results in | which results in | ||
<blockquote>< | <blockquote><syntaxhighlight lang=apl inline>(2=+⌿0=N∘.|N)/N←⍳100</syntaxhighlight></blockquote> | ||
=== Code blocks === | === Code blocks === | ||
For session transcripts, function definitions and longer expressions, use code blocks like | For session transcripts, function definitions and longer expressions, use code blocks like | ||
<blockquote><pre>< | <blockquote><pre><syntaxhighlight lang=apl> | ||
(2=+⌿0=N∘.|N)/N←⍳100 | (2=+⌿0=N∘.|N)/N←⍳100 | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
</ | </syntaxhighlight></pre></blockquote> | ||
which results in: | which results in: | ||
<blockquote>< | <blockquote><syntaxhighlight lang=apl> | ||
(2=+⌿0=N∘.|N)/N←⍳100 | (2=+⌿0=N∘.|N)/N←⍳100 | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
</ | </syntaxhighlight></blockquote> | ||
==== Tagging dialects ==== | |||
Optionally, you can indicate one or more APL dialects which are able to run the code by using a special template immediately after the source tag, like | Optionally, you can indicate one or more APL dialects which are able to run the code by using a special template immediately after the source tag, like | ||
<blockquote><pre>< | <blockquote><pre><syntaxhighlight lang=apl> | ||
{(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
</ | </syntaxhighlight> | ||
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}</pre></blockquote> | {{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}</pre></blockquote> | ||
which results in: | which results in: | ||
<blockquote>< | <blockquote><syntaxhighlight lang=apl> | ||
{(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
</ | </syntaxhighlight> | ||
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}</blockquote> | {{Works in|[[Dyalog APL]], [[dzaima/APL]], [[GNU APL]], [[ngn/apl]]}}</blockquote> | ||
You can also include a permalink to [[TryAPL]], [[Try It Online]], ''repl.it'', | ==== Run online ==== | ||
You can also include a permalink to [[TryAPL]], [[Try It Online]], ''repl.it'', ''abrudz.github.io/ngn-apl'' etc. right before the source tag, for example | |||
<blockquote><pre> | <blockquote><pre>{{try|1=https://tryapl.org/?clear&q=%7B(2%3D%2B%E2%8C%BF0%3D%E2%8D%B5%E2%88%98.%7C%E2%8D%B5)%2F%E2%8D%B5%7D%E2%8D%B3100&run}} | ||
< | <syntaxhighlight lang=apl> | ||
{(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
</ | </syntaxhighlight></pre></blockquote> | ||
which results in: | which results in: | ||
<blockquote> | <blockquote> | ||
{{try|1=https://tryapl.org/?clear&q=%7B(2%3D%2B%E2%8C%BF0%3D%E2%8D%B5%E2%88%98.%7C%E2%8D%B5)%2F%E2%8D%B5%7D%E2%8D%B3100&run}} | |||
< | <syntaxhighlight lang=apl> | ||
{(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | {(2=+⌿0=⍵∘.|⍵)/⍵}⍳100 | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 | ||
</ | </syntaxhighlight></blockquote> | ||
'''Note:''' Make sure to spell the template exactly as <code>{{try|1=</code> including <code>1=</code> as otherwise any equal sign in the URL will prevent the template from working properly! | |||
==== Very long code blocks ==== | ==== Very long code blocks ==== | ||
Use | Use | ||
<blockquote><pre> | <blockquote><pre> | ||
{{Collapse|The below code generates a tall column of numbers.| | {{Collapse|The below code generates a tall column of numbers.| | ||
< | <syntaxhighlight lang=apl> | ||
⍪⍳10 | ⍪⍳10 | ||
1 | 1 | ||
Line 136: | Line 141: | ||
9 | 9 | ||
10 | 10 | ||
</ | </syntaxhighlight> | ||
}} | }} | ||
</pre></blockquote> | </pre></blockquote> | ||
Line 144: | Line 149: | ||
<blockquote> | <blockquote> | ||
{{Collapse|The below code generates a tall column of numbers.| | {{Collapse|The below code generates a tall column of numbers.| | ||
< | <syntaxhighlight lang=apl> | ||
⍪⍳10 | ⍪⍳10 | ||
1 | 1 | ||
Line 156: | Line 161: | ||
9 | 9 | ||
10 | 10 | ||
</ | </syntaxhighlight> | ||
}}</blockquote> | }}</blockquote> | ||
=== Unsupported languages === | |||
If your code is in a language the highlighter doesn't support, then there are two ways to present code without highlighting it. Don't use a <syntaxhighlight lang=text inline><syntaxhighlight></syntaxhighlight> tag with no <code>lang</code> attribute as this puts the page in the "Pages with syntax highlighting errors" category, which is visible at the bottom of the page. | |||
* Use <syntaxhighlight lang=text inline><code></syntaxhighlight> tags for inline code and <syntaxhighlight lang=text inline><pre></syntaxhighlight> tags for blocks, avoiding <code><syntaxhighlight></code> entirely | |||
* Use <code>lang=text</code>. | |||
=== Mathematical notation === | === Mathematical notation === |