Add notice macro

master
rubenwardy 2018-07-20 19:50:19 +01:00
parent d7b7c053de
commit 5614c15b06
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
6 changed files with 70 additions and 13 deletions

View File

@ -44,6 +44,12 @@ title: Chapter Name
layout: default
root: ..
idx: 4.5
long_notice:
level: tip
title: This is a long tip!
message: This is a very long tip, so it would be unreadable if
placed in the main body of the chapter. Therefore,
it is a good idea to put it in the frontmatter instead.
---
## Chapter Name
@ -57,6 +63,8 @@ Explain why/how these concepts are useful in modding
## List the
{% include notice.html notice=page.long_notice %}
Paragraphs
{% highlight lua %}

View File

@ -71,9 +71,7 @@ One such IDE is Eclipse with the Koneki Lua plugin:
## Coding in Lua
<div class="notice">
This section is a Work in Progress. May be unclear.
</div>
{% include notice.html level="warning" message="This section is a Work in Progress. May be unclear." %}
Programs are a series of commands that run one after another.
We call these commands "statements."

View File

@ -116,8 +116,8 @@ minetest.register_craftitem("mymod:mudpie", {
description = "Alien Mud Pie",
inventory_image = "myfood_mudpie.png",
on_use = function(itemstack, user, pointed_thing)
hp_change = 20
replace_with_item = nil
local hp_change = 20
local replace_with_item = nil
minetest.chat_send_player(user:get_player_name(), "You ate an alien mud pie!")

View File

@ -233,9 +233,4 @@ end,
## Adding to an existing page
<div class="notice">
<h2>To Do</h2>
This section will be added soon&trade;.
This placeholder is just to let you know that it is possible!
</div>
{% include notice.html level="warning" title="To Do" message="This section will be added soon&trade;. This placeholder is just to let you know that it is possible!" %}

21
_includes/notice.html Normal file
View File

@ -0,0 +1,21 @@
{% if include.notice %}
{% assign notice=include.notice %}
{% else %}
{% assign notice=include %}
{% endif %}
<div class="notice notice-{{ notice.level }}">
{% if notice.level == "warning" %}
<span></span>
{% else if notice.level == "tip" %}
<span>i</span>
{% else %}
<span>?</span>
{% endif %}
<div>
{% if notice.title %}
<h2>{{ notice.title }}</h2>
{% endif %}
{{ notice.message }}
</div>
</div>

View File

@ -27,19 +27,54 @@ figure {
padding: 0 0 0 6px;
}
.notice-danger {
background: #933 !important;
border: 1px solid #c44 !important;
}
.notice-warning {
background: #FED;
border: 1px solid #fc9;
}
.notice-tip {
background: #ccf;
border: 1px solid #66a;
}
.notice-green {
background: #161;
border: 1px solid #393;
}
.notice {
margin: 10px;
display: block;
padding: 5px;
border: 1px solid orange;
border-radius: 5px;
background: #FFEEDD;
position: relative;
}
.notice > span {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 40px;
font-size: 24px;
text-align: center;
display: block;
}
.notice > div {
margin-left: 35px;
}
.notice h2 {
margin: 0 0 5px 0;
padding: 0 0 2px 0;
font-size: 110%;
}
.header-link, .anchor {