Correct highlighted lanugages

This commit is contained in:
Boris Verkhovskiy 2024-05-27 12:15:14 -06:00
parent e1bc8441e8
commit 12ecedd4f5
14 changed files with 63 additions and 58 deletions

View File

@ -4,7 +4,7 @@ contributors:
- ["Btup"]
filename: learnbc.bc
---
```c
```bc
/*This is a multi-
line comment.*/
# This is also a (one-line) comment! (in GNU bc).
@ -29,12 +29,12 @@ hour = read() /*Input a number*/
if(hour < 12) { /*Operators are exactly like C.*/
print "Good morning\n" /*"print" outputs strings or variables
separated by commas.*/
separated by commas.*/
} else if(hour == 12) {
print "Hello\n"
/*Escaping sequences start with a \ in a string.
In order to make the escaping sequences clearer, here
is a simplified list of them that will work in bc:
is a simplified list of them that will work in bc:
\b: backspace
\c: carriage return
\n: newline

View File

@ -5,7 +5,8 @@ contributors:
filename: learnbc-de.bc
lang: de-de
---
```c
```bc
/* Das ist ein mehr-
zeiliger Kommentar */
# Das ist ein (einzeiliger) Kommentar (in GNU bc).
@ -14,11 +15,11 @@ zeiliger Kommentar */
num = 45 /* Alle Variablen speichern nur Doubles und es ist
nicht möglich String-Konstanten direkt zu speichern */
num = 45; /* Es kann nach jedem Statement ein optionales Semikolon
hinzugefügt werden */
hinzugefügt werden */
/* Blöcke werden mit den Operatoren {} (ähnlich wie in C) bezeichnet */
while(num < 50) {
num += 1 /* äquivalent zu num=num+1.
a = a Op b ist äquivalent zu a Op= b*/
num += 1 /* äquivalent zu num=num+1.
a = a Op b ist äquivalent zu a Op= b*/
}
/* Ausserdem gibt es ++ (Inkrement) und -- (Dekrement) Operatoren */
/* Es gibt 3 spezielle Variablen:
@ -30,21 +31,21 @@ hour = read() /*Eingabe einer Zahl*/
if(hour < 12) { /*Operatoren sind genau wie in C*/
print "Guten Morgen\n" /*"print" Gibt Strings oder Variablen
mit einem Komma separiert aus.*/
mit einem Komma separiert aus.*/
} else if(hour == 12) {
print "Hallo\n"
/* Escape-Sequenzen starten mit einem \ in einem String.
Um Escape-Sequenzen klarer zu machen, ist hier eine vereinfachte
Liste, welche in bc funktioneren:
/* Escape-Sequenzen starten mit einem \ in einem String.
Um Escape-Sequenzen klarer zu machen, ist hier eine vereinfachte
Liste, welche in bc funktioneren:
\b: Backspace
\c: carriage return
\n: Zeilenumbruch
\t: Tab
\\: Backslash*/
} else {
/* Standardmässig sind Variablen global. */
/* Standardmässig sind Variablen global. */
thisIsGlobal = 5
/*Variablen können lokal gemacht werden. Benutze das Schlüsselwort "auto"
/*Variablen können lokal gemacht werden. Benutze das Schlüsselwort "auto"
in einer Funktion.*/
}
@ -100,4 +101,3 @@ das Programm beendet. Diese Codezeile ist optional.*/
Viel Spass mit diesem einfachen Rechner! (Oder dieser Programmiersprache, um exakt zu sein.)
Das ganze Programm wurde in GNU bc geschrieben. Um es auszuführen, benutze ```bc learnbc.bc```.

View File

@ -7,7 +7,7 @@ contributors:
filename: learn-emacs-lisp.el
---
```scheme
```elisp
;; This gives an introduction to Emacs Lisp in 15 minutes (v0.2d)
;;
;; First make sure you read this text by Peter Norvig:

View File

@ -16,7 +16,7 @@ The syntax of F# is different from C-style languages:
If you want to try out the code below, you can go to [https://try.fsharp.org](https://try.fsharp.org) and paste it into an interactive REPL.
```csharp
```fsharp
// single line comments use a double slash
(* multi line comments use (* . . . *) pair

View File

@ -118,7 +118,7 @@ di tempo, ti apparirà la stessa interfaccia per il contratto nella parte
inferiore dello schermo.
```javascript
```solidity
// Iniziamo con un semplice contratto su una Banca
// Permette di depositare, prelevare e fare l'estratto conto
@ -800,7 +800,7 @@ contract SomeOracle {
Prova l'esempio completo qui sotto [usando remix e la `Javascript VM`](https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&evmVersion=null&gist=3d12cd503dcedfcdd715ef61f786be0b&runs=200)
```javascript
```solidity
// *** ESEMPIO: Un esempio di crowdfunding (molto simile a Kickstarter) ***
// ** START EXAMPLE **
@ -944,7 +944,7 @@ contract CrowdFunder {
Qualche altra funzionalità.
```javascript
```solidity
// 10. ATRE FUNZIONALITA' NATIVE
// Unità di valuta

View File

@ -7,7 +7,7 @@ translators:
lang: pt-br
filename: learnbc-pt.bc
---
```c
```bc
/*Este é um comentário
multi-linhas*/
# Este é um comentário de uma única linha! (em bc GNU).
@ -33,7 +33,7 @@ hora = read() /*Lê a entrada de um número*/
if(hora < 12) { /*Os operadores são idênticos ao C.*/
print "Bom dia\n" /*"print" imprime strings ou variáveis
separados por vírgula (,).*/
separados por vírgula (,).*/
} else if(hora == 12) {
print "Olá\n"
/*Para escapar strings, inicie a string com \.
@ -97,7 +97,7 @@ for(i = 0; i <= 3; i++) {
/*Para acessar um array, faça assim:*/
print a[0], " ", a[1], " ", a[2], " ", a[3], "\n"
quit /*Adicione essa linha no final do código
para garantir que o programa encerre. Essa linha é opcional.*/
para garantir que o programa encerre. Essa linha é opcional.*/
```
Aproveite bem essa simples calculadora! (Ou essa linguagem de programação, para ser exato.)

View File

@ -38,7 +38,7 @@ Como Solidity e Ethereum ainda estão sob desenvolvimento, funcionalidades beta
e experimentais são tipicamente marcadas e sujeitas à mudanças. Pull requests
são bem-vindos.
```javascript
```solidity
// Primeiramente, um contrato de um Banco simples
// Permite depósitos, retiradas e checagens de saldo

View File

@ -26,7 +26,7 @@ on its standard output.
You can suppress the default output by specifying the `-n` command-line
argument.
```perl
```sed
#!/usr/bin/sed -f
# Files that begin with the above line and are given execute permission
# can be run as regular scripts.

View File

@ -93,7 +93,7 @@ This will use whatever network is currently selected in your metamask as the net
For now, please continue to use the `Javascript VM` unless instructed otherwise. When you deploy to a testnet, metamask will pop up to ask you to "confirm" the transaction. Hit yes, and after a delay, you'll get the same contract interface at the bottom of your screen.
```javascript
```solidity
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
@ -720,7 +720,7 @@ contract SomeOracle {
Work with the full example below using the [`Javascript VM` in remix here.](https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&evmVersion=null&gist=3d12cd503dcedfcdd715ef61f786be0b&runs=200)
```javascript
```solidity
// *** EXAMPLE: A crowdfunding example (broadly similar to Kickstarter) ***
// ** START EXAMPLE **
@ -860,7 +860,7 @@ contract CrowdFunder {
Some more functions.
```javascript
```solidity
// 10. OTHER NATIVE FUNCTIONS
// Currency units

View File

@ -19,7 +19,7 @@ F#'ın söz dizimi C-stili dillerden farklıdır:
Aşağıdaki kodu denemek istiyorsanız, [tryfsharp.org](http://www.tryfsharp.org/Create)'a gidin be interaktif REPL'e kodu yapıştırın.
```csharp
```fsharp
// tek satır yorumlar ikili bölme işareti ile başlar
(* çok satırlı yorumlar ( * . . . * ) ikilisini kullanır

View File

@ -8,7 +8,7 @@ translators:
- ["Oleh Hromiak", "https://github.com/ogroleg"]
---
```
```wast
;; learnwasm-ua.wast
(module

View File

@ -5,7 +5,7 @@ contributors:
- ["Dean Shaff", "http://dean-shaff.github.io"]
---
```
```wast
;; learn-wasm.wast
(module

View File

@ -26,9 +26,9 @@ Section headings are bracketed by `=`. They go from `= One equal sign =` to `===
Note that the `= One equal sign =` heading actually corresponds to the title of the page, and so cannot actually be used within a page. Consequently, the least number of equal signs is `== Two equal signs ==`.
Subscripts and superscripts can be written as `x<sub>1</sub>` and `x<sup>1</sup>`. Alternatively they can be written by the `<math>` tag (see below). `<small>Small</small>` and `<big>big</big>` texts are rarely used.
Subscripts and superscripts can be written as `x<sub>1</sub>` and `x<sup>1</sup>`. Alternatively they can be written by the `<math>` tag (see below). `<small>Small</small>` and `<big>big</big>` texts are rarely used.
```
```wikitext
Colons allow indentation
:Each colon creates an indentation three characters wide.
::and they can be nested.
@ -42,21 +42,22 @@ The syntax for tables is [very complicated](https://en.wikipedia.org/wiki/Help:T
```wikitext
{| class="wikitable"
|+
! column title A
! column title B
|+
! column title A
! column title B
|-
| cell A1
| cell B1
| cell A1
| cell B1
|-
| cell A2
| cell B2
| cell A2
| cell B2
|-
| ...
| ...
| ...
| ...
|}
```
which renders to
which renders to
| **column title A** | **column title B** |
|---|---|
| cell A1 | cell B1 |
@ -67,13 +68,16 @@ Be warned that the newlines in a wikitext table are meaningful. Deleting a singl
You can insert images, audios, videos, or other forms of media by `[[File:Image.png|thumb|right|Image caption]]`. All media files must be hosted on [Wikimedia Commons](https://commons.wikimedia.org/wiki/Main_Page).
You can insert quotations either by HTML-like tag
```wikitext
<blockquote>
<p>Quotation text.</p>
<p>Name, source, reference</p>
</blockquote>
```
or [template](#templates)
```wikitext
{{Quote|text=Quotation text.|title=Title|author=Author|source=Location in the publication}}
```
@ -82,7 +86,8 @@ A "[non-breaking space](https://en.wikipedia.org/wiki/Non-breaking_space)" is a
Extra whitespaces can be specified by `pad` tag. For example, `{{pad|4.0em}}` is a white space with length 4.0 [em-dashes](https://en.wikipedia.org/wiki/Dash#Em_dash).
Longer code blocks can be done by
Longer code blocks can be done by
```wikitext
<syntaxhighlight lang="cpp">
#include <iostream>
@ -91,7 +96,9 @@ int m2 (int ax, char *p_ax) {
return 0;
}</syntaxhighlight>
```
which renders to
which renders to
```cpp
#include <iostream>
int m2 (int ax, char *p_ax) {
@ -102,13 +109,13 @@ int m2 (int ax, char *p_ax) {
## Linking
Basic `[[linking]]` is done by double brackets.
Basic `[[linking]]` is done by double brackets.
The `|` symbol allows displaying a `[[Actual page title|different text]]`.
The `|` symbol allows displaying a `[[Actual page title|different text]]`.
The `#` symbol allows linking to sections within a text, like `[[Frog#Locomotion]]` or `[[Frog#Locomotion|locomotion in frogs]]`.
If a word is interrupted by a link, it is "blended" into the link. For example, `[[copy edit]]ors` renders to [copy editors](https://en.wikipedia.org/wiki/copy_edit).
If a word is interrupted by a link, it is "blended" into the link. For example, `[[copy edit]]ors` renders to [copy editors](https://en.wikipedia.org/wiki/copy_edit).
To suppress this behavior, use `<nowiki>`. For example, `[[micro-]]<nowiki />second` renders to [micro-](https://en.wikipedia.org/wiki/micro-)second.
@ -130,6 +137,7 @@ The most (in)famous one is the \[citation needed\]`{{cn}}` template. Note that `
An `infobox` template is, as it says, a template for a box containing information. Usually, each page contains at most two infoboxes, one on top and one on bottom. For particularly detailed pages, there can be more than two.
The infobox on the top is usually used to compactly display tabular information. They are common for biographies, geographical locations, and such. For example, the top infobox for [Euler](https://en.wikipedia.org/wiki/Leonhard_Euler) is:
```wikitext
{{Infobox scientist
| name = Leonhard Euler
@ -144,12 +152,11 @@ The infobox on the top is usually used to compactly display tabular information.
The infobox at the bottom is usually used to display a curated table of related links. For example, the bottom infobox for [EulerLagrange equation](https://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation) is just `{{Leonhard Euler}}`, which displays a box containing links to many of the things named after Euler.
`~~~~` is used to sign on talk pages, and expands to something like `Username (talk) 10:50, 12 June 2023 (UTC)`.
### Mathematics
`<math>` tag renders $\LaTeX$ inline like `$`, while `<math display=block>` renders it on a separate line like `$$`.
`<math>` tag renders $\LaTeX$ inline like `$`, while `<math display=block>` renders it on a separate line like `$$`.
`<math>E = mc^2</math>` renders to $E = mc^2$.
@ -157,9 +164,9 @@ The infobox at the bottom is usually used to display a curated table of related
One can also include math using [HTML renders](https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Mathematics#Using_HTML) or even by [plain Unicode](https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode). These are less flexible but more compatible with older browsers. Further, parts of Wikipedia syntax themselves are incompatible with `<math>`, such as in section titles or some templates, forcing the use of HTML or Unicode in such cases.
Theorems and proofs can be boxed and named:
Theorems and proofs can be boxed and named:
```
```wikitext
{{Math theorem
|name=Pythagorean theorem
|note=Pythagoras, 500s BC
@ -171,12 +178,11 @@ Theorems and proofs can be boxed and named:
|title=Proof by similar triangles
|proof=Drop a perpendicular from point C to side AB. Now argue by proportionality. <math>\blacksquare</math>
}}
```
## References
References are the backbone of Wikipedia `{{citation needed}}`. There are in general two ways to do citations.
References are the backbone of Wikipedia `{{citation needed}}`. There are in general two ways to do citations.
| type | inline citation | expanded citation |
| ---- | ---- | ---- |
@ -187,11 +193,10 @@ References are the backbone of Wikipedia `{{citation needed}}`. There are in gen
As expanded citations are just inline citations without the `<ref>` tag, we will describe just inline citations.
The most basic form is a plaintext citation, like `<ref>Author, Title, date, [url](https://example.com/), etc</ref>`.
The most basic form is a plaintext citation, like `<ref>Author, Title, date, [url](https://example.com/), etc</ref>`.
One should generally use a templated citation, like `<ref>{{cite web|url=https://example.com/|title=Example|date=2001|access-date=2023}}</ref>`. There are three forms of citation templates: [`cite web`](https://en.wikipedia.org/wiki/Template:Cite_web), [`cite journal`](https://en.wikipedia.org/wiki/Template:Cite_journal), [`cite book`](https://en.wikipedia.org/wiki/Template:Cite_book).
A citation can be named as `<ref name="X">...</ref>`. It can then be invoked as `<ref name="X" />`. The instance `<ref name="X">...</ref>` can go before or after `<ref name="X" />`. Any ordering would render to the same page.
## Typical Wikipedia page
@ -234,7 +239,7 @@ Something about the relation between X and Y.
== References ==
<!-- generates list of references from inline reference tags, with columns with a minimum width of 30 em-dashes. -->
{{Reflist|30em}}
{{Reflist|30em}}
<!-- extra, non-inlined references below -->
{{Refbegin|30em}}
@ -255,6 +260,6 @@ Something about the relation between X and Y.
## Further reading
* [Wikipedia's manual of style](https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style)
* [Wikitext cheatsheet](https://en.wikipedia.org/wiki/Help:Cheatsheet)
* [Wikitext cheatsheet](https://en.wikipedia.org/wiki/Help:Cheatsheet)
* [Wikitext, full reference](https://en.wikipedia.org/wiki/Help:Wikitext).
* [Tables, full reference](https://en.wikipedia.org/wiki/Help:Table#Simple_straightforward_tables)

View File

@ -30,7 +30,7 @@ Solidity 代码中存在高风险和高成本的错误,因此你必须非常
由于 Solidity 和以太坊正在积极开发,通常会标记为实验或 beta 特性,并很可能会更改。因此欢迎
提交更改请求。
```javascript
```solidity
// 首先,一个简单的银行合约
// 允许存款、取款、以及检查余额