質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.35%
Haml

Haml(HTML abstraction markup language)は、HTML/XHTMLを効率的に記述するためのマークアップ言語および記法です。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Middleman

MiddlemanはモダンなWeb開発のショートカットやツールを採用した静的サイトジェネレータです。

Q&A

解決済

1回答

937閲覧

Middleman、Haml文にてfor文を動作させる方法

decatail

総合スコア43

Haml

Haml(HTML abstraction markup language)は、HTML/XHTMLを効率的に記述するためのマークアップ言語および記法です。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Middleman

MiddlemanはモダンなWeb開発のショートカットやツールを採用した静的サイトジェネレータです。

0グッド

0クリップ

投稿2021/11/01 06:45

haml

1--- 2--- 3- for i in 1..8

こちらを「middleman build」するとエラー。なぜHTMLファイルが出力できないのかわかる方居られましたら御教授願います。

== Request: /index.html identical build/images/.keep error build/index.html ruby/MMsite/source/index.html.haml:2: syntax error, unexpected end-of-input, expecting `end' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/haml-5.2.2/lib/haml/engine.rb:132:in `rescue in render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/haml-5.2.2/lib/haml/engine.rb:129:in `render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/renderers/haml.rb:38:in `evaluate' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/renderers/haml.rb:9:in `render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/file_renderer.rb:79:in `render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/template_renderer.rb:184:in `_render_with_all_renderers' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/template_renderer.rb:147:in `block in render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/util.rb:21:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/template_renderer.rb:146:in `render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/sitemap/resource.rb:154:in `render' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/rack.rb:113:in `process_request' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/rack.rb:67:in `block in call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/rack.rb:66:in `catch' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/rack.rb:66:in `call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-autoprefixer-2.10.1/lib/middleman-autoprefixer/extension.rb:55:in `call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/lint.rb:50:in `_call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/lint.rb:38:in `call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:244:in `call' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/mock.rb:84:in `request' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/mock.rb:57:in `get' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/builder.rb:232:in `block in output_resource' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/util.rb:21:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/builder.rb:225:in `output_resource' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:515:in `call_with_index' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:485:in `process_incoming_jobs' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:465:in `block in worker' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:456:in `fork' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:456:in `worker' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:447:in `block in create_workers' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:446:in `each' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:446:in `each_with_index' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:446:in `create_workers' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:386:in `work_in_processes' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/parallel-1.21.0/lib/parallel.rb:289:in `map' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/builder.rb:137:in `output_resources' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/builder.rb:131:in `output_files' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/builder.rb:71:in `block in run!' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/util.rb:21:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/builder.rb:70:in `run!' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-cli-4.4.0/lib/middleman-cli/build.rb:84:in `block in build' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-core-4.4.0/lib/middleman-core/util.rb:21:in `instrument' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-cli-4.4.0/lib/middleman-cli/build.rb:83:in `build' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command' # 文字数制限のため中略 .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start' .rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/middleman-cli-4.4.0/bin/middleman:70:in `<top (required)>' .rbenv/versions/3.0.2/bin/middleman:23:in `load' .rbenv/versions/3.0.2/bin/middleman:23:in `<main>' There were errors during this build
Middleman 4.4.0 ruby 3.0.2

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

https://qiita.com/rabi0102/items/ef1f076049da37de784b

インデントを統一するというルールがあるようだ。確信は持てないがこれが原因で引っかかったと思われる。タブと半角スペースも区別するようでこれだと見分けがつかない……。以後気をつけるが、erbに移ったほうが良いのかも知れない。

投稿2021/11/01 07:22

decatail

総合スコア43

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

decatail

2021/11/01 07:24

いや、三行でエラーが出たのだからこれが原因なのはあり得ないな。とにかく動いたから良かったが……。HAMLが非常にややこしい。バグの可能性さえありそうだ。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.35%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問