Skip to content

Commit

Permalink
Merge pull request #1833 from arturo-lang/website-makeover
Browse files Browse the repository at this point in the history
Website fixes & tweaks
  • Loading branch information
drkameleon authored Dec 26, 2024
2 parents b05dd73 + a80ca2e commit 6762955
Show file tree
Hide file tree
Showing 31 changed files with 414 additions and 308 deletions.
2 changes: 1 addition & 1 deletion docs/website/pages/documentation/in a nutshell.art
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ So... **With X = Arturo and Y = ~15 minutes**, here you are:
---
```red
```arturo
; this is a comment
; this is another comment
Expand Down
361 changes: 226 additions & 135 deletions docs/website/pages/documentation/language.art

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/website/pages/documentation/library/arithmetic/_index.art
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Arithmetic module provides basic mathematical operations that work seamlessl

#### Basic Operations

```red
```arturo
; addition
print 2 + 3 ; 5
print add 2 3 ; 5
Expand All @@ -37,7 +37,7 @@ print fdiv 10 3 ; 3.333333333333333

#### Working with Different Types

```red
```arturo
; integer + floating
print 2 + 3.81 ; 5.81

Expand All @@ -54,7 +54,7 @@ print a + b ; 5/4

#### In-place Modifications

```red
```arturo
x: 5

; increment
Expand All @@ -77,7 +77,7 @@ print x ; 16

#### Division and Remainder

```red
```arturo
; integer division with remainder
[quotient remainder]: divmod 17 5
print ["17 ÷ 5 =" quotient "remainder" remainder]
Expand All @@ -89,7 +89,7 @@ print fdiv 17 5 ; 3.4

#### Working with Quantities

```red
```arturo
distance: 100`m ; 100 meters
time: 5`s ; 5 seconds

Expand All @@ -99,7 +99,7 @@ print speed ; 20 m/s

#### Type Conversions & Promotions

```red
```arturo
; integer → floating
a: 5 + 3.41 ; 8.41 (floating)
b: 2 * 3.5 ; 7.0 (floating)
Expand Down
10 changes: 5 additions & 5 deletions docs/website/pages/documentation/library/bitwise/_index.art
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The Bitwise module provides functions for bit-level operations on integer values

#### Boolean Operations

```red
```arturo
x: 5 ; binary: 101
y: 3 ; binary: 011

Expand All @@ -28,7 +28,7 @@ not x ; => -6 (complement of 101)

#### Advanced Operations

```red
```arturo
a: 12 ; binary: 1100
b: 9 ; binary: 1001

Expand All @@ -39,7 +39,7 @@ xnor a b ; => -6

#### Bit Shifting

```red
```arturo
num: 8 ; binary: 1000

; left shift (multiply by 2^n)
Expand All @@ -55,7 +55,7 @@ print shr num 1 ; 4 (100)

#### Checking Individual Bits

```red
```arturo
value: 42 ; binary: 101010
mask: shl 1 3 ; binary: 001000

Expand All @@ -65,7 +65,7 @@ if and value mask ->

#### Setting and Clearing Bits

```red
```arturo
number: 10 ; binary: 1010
pos: 2

Expand Down
23 changes: 12 additions & 11 deletions docs/website/pages/documentation/library/collections/_index.art
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Collections module provides a unified interface for working with different t

#### Creating Collections

```red
```arturo
; blocks (arrays)
numbers: [1 2 3 4 5]
mixed: ["hello" 42 true]
Expand All @@ -39,7 +39,7 @@ print @evens ; 2 3 4 5 6 7 8 9 10

#### Basic Operations

```red
```arturo
lst: [1 2 3]

; adding/removing elements
Expand All @@ -62,7 +62,7 @@ print lst\2 ; 4

#### Collection Indexing

```red
```arturo
; basic array indexing
colors: ["red" "green" "blue"]
print colors\0 ; red (first element)
Expand All @@ -84,12 +84,13 @@ print user\name ; John
; dynamic dictionary field access
field: 'surname ; using a literal
print user\[field] ; Doe
```

> [!NOTE] Indexing with `\` works uniformly across all collection types. Use a block after `\` when you need to evaluate an expression to get the index or field name.

#### Collection Information

```red
```arturo
data: [1 2 2 3 3 3]

size data ; => 6
Expand All @@ -102,7 +103,7 @@ index data 3 ; => 2

#### Collection Transformation

```red
```arturo
; flatten nested structure
nested: [[1 2] [3 4] [5 6]]
flat: flatten nested
Expand All @@ -118,7 +119,7 @@ print reverse [1 2 3] ; 3 2 1

#### Working with Dictionaries

```red
```arturo
user: #[
name: "John"
age: 30
Expand All @@ -140,7 +141,7 @@ print complete

#### Working with Strings

```red
```arturo
text: "Hello 世界" ; unicode string

; strings are like character arrays
Expand Down Expand Up @@ -169,7 +170,7 @@ loop text 'c ->

#### Combinations & Permutations

```red
```arturo
items: [1 2 3]

; specific size combinations
Expand All @@ -185,7 +186,7 @@ permutate items

#### Efficient Range Operations

```red
```arturo
; create a range of numbers
nums: 1..1000

Expand All @@ -201,7 +202,7 @@ nums\42 ; => 42

##### Working with Nested Data

```red
```arturo
users: #[
active: @[
#[name: "John" score: 42 tags: ["admin" "dev"]]
Expand Down Expand Up @@ -229,7 +230,7 @@ allTags: unique flatten map users\active 'usr -> usr\tags

##### Managing a Priority Queue

```red
```arturo
tasks: []

; add tasks with priorities
Expand Down
10 changes: 5 additions & 5 deletions docs/website/pages/documentation/library/colors/_index.art
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Colors module provides comprehensive color handling capabilities. It include

#### Creating Colors

```red
```arturo
; using hex notation
color1: #f00 ; short RGB
color2: #ff0000 ; full RGB
Expand All @@ -35,7 +35,7 @@ extract.alpha #ff0000ff ; => 255

#### Color Operations

```red
```arturo
; lighten/darken
dark: darken #red 0.3 ; 30% darker (= #B20000)
light: lighten #emerald 0.2 ; 20% lighter (= #60F090)
Expand All @@ -54,7 +54,7 @@ opposite: invert #white ; #black

#### Color Space Conversions

```red
```arturo
col: #magenta ; #FF00FF

; get HSL representation
Expand All @@ -70,7 +70,7 @@ newColor: to :color .hsv [300, 1.0 1.0] ; #FF00FF (yep, #magenta!)

#### Color Palettes

```red
```arturo
baseColor: #4169e1 ; royal blue

; generate different palettes
Expand Down Expand Up @@ -123,7 +123,7 @@ Here are some of the most commonly used colors organized by hue:

#### Working with Alpha

```red
```arturo
; full opacity
solid: #ff0000ff ; red, 100% opaque

Expand Down
10 changes: 5 additions & 5 deletions docs/website/pages/documentation/library/comparison/_index.art
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The Comparison module provides functions for comparing values of any type. Beyon

#### Simple Comparisons

```red
```arturo
; equality
print 2 = 2 ; true
print "abc" = "abc" ; true
Expand All @@ -28,7 +28,7 @@ print 2.0 <> 2 ; false

#### Ordering

```red
```arturo
; less/greater than
print 2 < 3 ; true
print 3 > 2 ; true
Expand All @@ -42,7 +42,7 @@ print 3 >= 2 ; true

#### Range Checking

```red
```arturo
; check if value is in range (inclusive)
5 <=> 1 10 ; => true
'm' <=> 'a' 'z' ; => true
Expand All @@ -59,7 +59,7 @@ between? 5 1 10 ; => true

The `compare` function returns -1, 0, or 1 and is useful for custom sorting:

```red
```arturo
a: "hello"
b: "world"

Expand All @@ -70,7 +70,7 @@ print ["A comes" (result < 0)? -> "before" -> "after" "B"]

#### Identity vs Equality

```red
```arturo
x: 1`N
y: 1`kg.m/s2 ; actually, that's the definition of 1 Newton!

Expand Down
12 changes: 6 additions & 6 deletions docs/website/pages/documentation/library/core/_index.art
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Core module provides the fundamental building blocks of Arturo: functions fo

#### Variable Assignment

```red
```arturo
; basic assignment
x: 5 ; assign value to symbol
let 'x 5 ; alternative syntax
Expand All @@ -28,7 +28,7 @@ let 'x 5 ; alternative syntax

Arturo provides several ways to handle conditional execution:

```red
```arturo
; simple if statement
if x=2 [
print "x is two"
Expand Down Expand Up @@ -81,7 +81,7 @@ when.has: x [

#### Function Definition

```red
```arturo
; basic function
sum: function [a b][
a + b
Expand All @@ -100,7 +100,7 @@ double: $[x]-> x * 2

Modules are a way of isolating pieces of code so that we can expose only the functions we need, while still safeguarding parts of the internal implementation.

```red
```arturo
; create new module
math: module [
pwr: function [x][
Expand All @@ -124,7 +124,7 @@ print calculate 10 ; 100

#### Safe Operations

```red
```arturo
; coalesce operator
value: null
result: value ?? "default" ; use default if null
Expand All @@ -141,7 +141,7 @@ counter: 0

#### Loop Control

```red
```arturo
; break from loop
done?: false
while [true][
Expand Down
Loading

0 comments on commit 6762955

Please sign in to comment.