From 7a772a9301a75b1c211fd4193ea9d4904ae03e3a Mon Sep 17 00:00:00 2001 From: Sdogruyol Date: Fri, 3 Mar 2017 23:42:08 +0300 Subject: [PATCH] Improve docs --- src/kemal/common_log_handler.cr | 1 - src/kemal/filter_handler.cr | 3 +-- src/kemal/helpers/macros.cr | 16 ++++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/kemal/common_log_handler.cr b/src/kemal/common_log_handler.cr index 159183b..e38621d 100644 --- a/src/kemal/common_log_handler.cr +++ b/src/kemal/common_log_handler.cr @@ -1,6 +1,5 @@ module Kemal # Kemal::CommonLogHandler uses STDOUT by default and handles the logging of request/response process time. - # It's also provides a `write` method for common logging purposes. class CommonLogHandler < Kemal::BaseLogHandler @handler : IO diff --git a/src/kemal/filter_handler.cr b/src/kemal/filter_handler.cr index 98d2d4a..26357eb 100644 --- a/src/kemal/filter_handler.cr +++ b/src/kemal/filter_handler.cr @@ -1,6 +1,5 @@ module Kemal - # Kemal::FilterHandler handle all code that should be evaluated before and after - # every request + # :nodoc: class FilterHandler include HTTP::Handler INSTANCE = new diff --git a/src/kemal/helpers/macros.cr b/src/kemal/helpers/macros.cr index d263858..a69fb46 100644 --- a/src/kemal/helpers/macros.cr +++ b/src/kemal/helpers/macros.cr @@ -2,15 +2,15 @@ require "kilt" CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new -# content_for is a set of helpers that allows you to capture +# `content_for` is a set of helpers that allows you to capture # blocks inside views to be rendered later during the request. The most # common use is to populate different parts of your layout from your view. # # The currently supported engines are: ecr and slang. # -# == Usage +# ## Usage # -# You call +content_for+, generally from a view, to capture a block of markup +# You call `content_for`, generally from a view, to capture a block of markup # giving it an identifier: # # # index.ecr @@ -18,18 +18,18 @@ CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new # ... # <% end %> # -# Then, you call +yield_content+ with that identifier, generally from a +# Then, you call `yield_content` with that identifier, generally from a # layout, to render the captured block: # # # layout.ecr # <%= yield_content "some_key" %> # -# == And How Is This Useful? +# ## And How Is This Useful? # # For example, some of your views might need a few javascript tags and # stylesheets, but you don't want to force this files in all your pages. -# Then you can put <%= yield_content :scripts_and_styles %> on your -# layout, inside the tag, and each view can call content_for +# Then you can put `<%= yield_content :scripts_and_styles %>` on your +# layout, inside the tag, and each view can call `content_for` # setting the appropriate set of tags that should be added to the layout. macro content_for(key, file = __FILE__) %proc = ->() { @@ -42,7 +42,7 @@ macro content_for(key, file = __FILE__) nil end -# Yields content for the given key if a content_for block exists for that key. +# Yields content for the given key if a `content_for` block exists for that key. macro yield_content(key) if CONTENT_FOR_BLOCKS.has_key?({{key}}) __caller_filename__ = CONTENT_FOR_BLOCKS[{{key}}][0]