From 298d733bcaeb4750a2fc74c825be351a91aeed82 Mon Sep 17 00:00:00 2001 From: Stephann Vasconcelos <3025661+stephannv@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:00:43 -0300 Subject: [PATCH 1/2] Add Githut Actions and more examples to README --- .github/workflows/ci.yml | 17 ++++++ .github/workflows/weekly.yml | 30 +++++++++++ .travis.yml | 1 - README.md | 100 ++++++++++++++++++++++++++++++++++- 4 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/weekly.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b218e6f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,17 @@ +name: CI +on: + push: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Download source + uses: actions/checkout@v3 + + - name: Install Crystal + uses: crystal-lang/install-crystal@v1 + + - name: Run tests + run: crystal spec diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml new file mode 100644 index 0000000..45c4bf5 --- /dev/null +++ b/.github/workflows/weekly.yml @@ -0,0 +1,30 @@ +name: Weekly CI +on: + schedule: + - cron: 0 0 * * 1 # At 00:00 on Monday + +jobs: + tests: + strategy: + fail-fast: false + matrix: + include: + - {os: ubuntu-latest, crystal: latest} + - {os: ubuntu-latest, crystal: nightly} + - {os: macos-latest} + - {os: windows-latest} + + name: Tests + runs-on: ${{matrix.os}} + steps: + - name: Download source + uses: actions/checkout@v3 + + - name: Install Crystal + uses: crystal-lang/install-crystal@v1 + with: + crystal: ${{matrix.crystal}} + shards: false + + - name: Run tests + run: crystal spec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ffc7b6a..0000000 --- a/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: crystal diff --git a/README.md b/README.md index 3e6cfda..6fcba12 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ dependencies: ## Usage - +#### Basic usage ```crystal require "html_builder" @@ -25,9 +25,105 @@ html = HTML.build do end end -puts html # => %(crystal is awesome) +puts html +``` + +**Output** (this output is formatted for better display): +```html + + crystal is awesome + +``` + + +#### Full HTML5 page +```crystal +html = HTML.build do + doctype + html(lang: "pt-BR") do + head do + title { text "Crystal Programming Language" } + + meta(charset: "UTF-8") + end + body do + a(href: "http://crystal-lang.org") { text "Crystal rocks!" } + form(method: "POST") do + input(name: "name") + end + end + end +end + +puts html +``` + +**Output** : +```html + + + +
+