diff --git a/crystal/examples/parse_url.cr b/crystal/examples/http_client/parse_url.cr similarity index 100% rename from crystal/examples/parse_url.cr rename to crystal/examples/http_client/parse_url.cr diff --git a/crystal/examples/add_mixed.cr b/crystal/examples/intro/add_mixed.cr similarity index 100% rename from crystal/examples/add_mixed.cr rename to crystal/examples/intro/add_mixed.cr diff --git a/crystal/examples/add_numbers.cr b/crystal/examples/intro/add_numbers.cr similarity index 100% rename from crystal/examples/add_numbers.cr rename to crystal/examples/intro/add_numbers.cr diff --git a/crystal/examples/logging.cr b/crystal/examples/logging/logging.cr similarity index 100% rename from crystal/examples/logging.cr rename to crystal/examples/logging/logging.cr diff --git a/crystal/examples/assign.cr b/crystal/examples/other/assign.cr similarity index 100% rename from crystal/examples/assign.cr rename to crystal/examples/other/assign.cr diff --git a/crystal/examples/constants.cr b/crystal/examples/other/constants.cr similarity index 100% rename from crystal/examples/constants.cr rename to crystal/examples/other/constants.cr diff --git a/crystal/examples/default.cr b/crystal/examples/other/default.cr similarity index 100% rename from crystal/examples/default.cr rename to crystal/examples/other/default.cr diff --git a/crystal/examples/gravatar.cr b/crystal/examples/other/gravatar.cr similarity index 100% rename from crystal/examples/gravatar.cr rename to crystal/examples/other/gravatar.cr diff --git a/crystal/examples/multiple_assignments.cr b/crystal/examples/other/multiple_assignments.cr similarity index 100% rename from crystal/examples/multiple_assignments.cr rename to crystal/examples/other/multiple_assignments.cr diff --git a/crystal/examples/here_document.cr b/crystal/examples/strings/here_document.cr similarity index 100% rename from crystal/examples/here_document.cr rename to crystal/examples/strings/here_document.cr diff --git a/crystal/http_client.md b/crystal/http_client.md index b0ec274c6..56ff94687 100644 --- a/crystal/http_client.md +++ b/crystal/http_client.md @@ -8,3 +8,11 @@ ![](examples/http_client/http_client.cr) +## Parse URL (URI) +{id: parse-url} +{i: URI} + +![](examples/http_client/parse_url.cr) + + + diff --git a/crystal/intro.md b/crystal/intro.md index bb7e3e5f0..26083ac27 100644 --- a/crystal/intro.md +++ b/crystal/intro.md @@ -181,14 +181,14 @@ crystal tool format --check * Interpolation works on numbers as well * The `+` operator is numerical addition or string concatenation -![](examples/add_numbers.cr) +![](examples/intro/add_numbers.cr) ## Add mixed strings and Integers {id: add-mixed-strings-and-integers} `Error: no overload matches 'Int32#+' with type String` -![](examples/add_mixed.cr) +![](examples/intro/add_mixed.cr) ## Numeric Operators diff --git a/crystal/logging.md b/crystal/logging.md index 4c12a1664..0c9409080 100644 --- a/crystal/logging.md +++ b/crystal/logging.md @@ -8,6 +8,6 @@ * 7 levels of logging, default is `info` and higher to the `STDOUT` -![](examples/logging.cr) +![](examples/logging/logging.cr) diff --git a/crystal/other.md b/crystal/other.md index 99edf576e..6ac441fb2 100644 --- a/crystal/other.md +++ b/crystal/other.md @@ -72,25 +72,18 @@ shards install ./bin/ameba ``` -## Parse URL (URI) -{id: parse-url} -{i: URI} - -![](examples/parse_url.cr) - - ## Ternary operator and or to set default value {id: default-value} {i:||} {i: ?:} -![](examples/default.cr) +![](examples/other/default.cr) ## Gravatar {id: gravatar} {i: Digest::MD5.hexdigest} -![](examples/gravatar.cr) +![](examples/other/gravatar.cr) ## Try Crystal {id: try} @@ -176,20 +169,14 @@ require "some_name" # Find it somewhere (standard library, src directory * Variable names that start with upper-case letter are constants -![](examples/constants.cr) +![](examples/other/constants.cr) ## Multiple assignments {id: multiple-assignments} -![](examples/multiple_assignments.cr) - -![](examples/assign.cr) - -## Here documents -{id: here-documents} -{i: <<-} +![](examples/other/multiple_assignments.cr) -![](examples/here_document.cr) +![](examples/other/assign.cr) ## Int methods: Times {id: times} diff --git a/crystal/strings.md b/crystal/strings.md index cefcc9bd0..74df942bb 100644 --- a/crystal/strings.md +++ b/crystal/strings.md @@ -143,5 +143,9 @@ ![](examples/strings/printf.cr) ![](examples/strings/printf.out) +## Here documents +{id: here-documents} +{i: <<-} +![](examples/strings/here_document.cr)