Data: JSON from a local file

Demonstrates: Panini looks for json or yaml data in the data folder and makes it available to the templates as variables.
Corresponding Filename: data-102

Data

The datafile is placed in the data folder (in this case hsk-data.json) It has the following structure.

{
    "word-list": [
        {
            "word": {
                "title": "\u505a\u4e3b",
                "field_definition": "make the decision; take charge of; back up; support; be host",
                "field_word_pronunciation": "zuo4 zhu3"
            }
        },
        {
            "word": {
                "title": "\u5ea7\u53f3\u94ed",
                "field_definition": "motto; maxim",
                "field_word_pronunciation": "zuo4 you4 ming2"
            }
        }
    ]
}

Template

The data is accessed through variables made available by Panini auto-magically. To drilldown into the data you use dot notation. filename.array gets you into the data set. this.word.title gets you to the data-item you need.

<h2>Here are some words</h2>
<dl id="hsk-definition-list-example-1">
    {{#each hsk-level-1.word-list}}
    <div class="hsk-item">
        <dt lang="zh-Hans"><span class="hsk-word">{{ this.word.title }}</span> <span class="hsk-pronounciation">\()</span></dt>
        <dd>{{ this.word.def}}</dd>
    </div>
    {{/each}}
</dl>

Here are some words

爱 (ai4)
to love; affection; to be fond of; to like
八 (ba1)
eight; 8
爸爸 (ba4 ba5)
(informal) father; CL:個|个[ge4],位[wei4]
杯子 (bei1 zi5)
cup; glass; CL:個|个[ge4],支[zhi1],枝[zhi1]
北京 (Bei3 jing1)
Beijing, capital of People's Republic of China; Peking; PRC government
本 (ben3)
roots or stems of plants; origin; source; this; the current; root; foundation; basis; classifier for books, periodicals, files etc; originally
不客气 (bu2 ke4 qi5)
you're welcome; impolite; rude; blunt; don't mention it
不 (bu4)
(negative prefix); not; no
菜 (cai4)
dish (type of food); vegetables; vegetable; cuisine; CL:盤|盘[pan2],道[dao4]
茶 (cha2)
tea; tea plant; CL:杯[bei1],壺|壶[hu2]
吃 (chi1)
to eat; to have one's meal; to eradicate; to destroy; to absorb; to suffer; to exhaust
出租车 (chu1 zu1 che1)
taxi
打电话 (da3 dian4 hua4)
to make a telephone call
大 (da4)
big; huge; large; major; great; wide; deep; oldest; eldest
的 (de5)
of; structural particle: used before a noun, linking it to preceding possessive or descriptive attributive
点 (dian3)
drop (of liquid); stain; spot; speck; jot; dot stroke (in Chinese characters); decimal point; point; mark (of degree or level); a place (with certain characteristics); iron bell; o’clock; a little; a bit; some; (point) unit of measurement for type; to touch on briefly; to make clear; to light; to ignite; to kindle; period of time at night (24 minutes) (old); a drip; to dibble; classifier for small indeterminate quantities
电脑 (dian4 nao3)
computer; CL:臺|台[tai2]
电视 (dian4 shi4)
television; TV; CL:臺|台[tai2],個|个[ge4]
电影 (dian4 ying3)
movie; film; CL:部[bu4],片[pian4],幕[mu4],場|场[chang3]
东西 (dong1 xi5)
thing; stuff; person; CL:個|个[ge4],件[jian4]
都 (dou1)
all, both; entirely (due to) each; even; already
读 (du2)
to read; to study; reading of word (i.e. pronunciation), similar to 拼音[pin1 yin1]
对不起 (dui4 bu5 qi3)
unworthy; to let down; I'm sorry; excuse me; pardon me; if you please; sorry? (please repeat)
多 (duo1)
many; much; a lot of; numerous; multi-
多少 (duo1 shao3)
number; amount; somewhat
儿子 (er2 zi5)
son
二 (er4)
two; 2; stupid (Beijing dialect)
饭馆 (fan4 guan3)
restaurant; CL:家[jia1]
飞机 (fei1 ji1)
airplane; CL: 架[jia4]
分钟 (fen1 zhong1)
minute
高兴 (gao1 xing4)
happy; glad; willing (to do sth); in a cheerful mood
个 (ge4)
individual; this; that; size; classifier for people or objects in general
工作 (gong1 zuo4)
public park; CL:場|场[chang3]
狗 (gou3)
dog; CL:隻|只[zhi1],條|条[tiao2]
汉语 (Han4 yu3)
Chinese language; CL:門|门[men2]
好 (hao3)
good; well; proper; good to; easy to; very; so; (suffix indicating completion or readiness)
喝 (he1)
to drink; to shout (a command); My goodness!
和 (he2)
and; together with; with; sum; union; peace; harmony; surname He; Japanese related; Taiwan pr. han4
很 (hen3)
(adverb of degree); quite; very; awfully
后面 (hou4 mian5)
rear; back; behind; later; afterwards
回 (hui2)
to circle; to go back; to turn around; to answer; to return; to revolve; Hui ethnic group (Chinese Muslims); time; classifier for acts of a play; section or chapter (of a classic book)
会 (hui4)
can; be possible; be able to; will; be likely to; be sure to; to assemble; to meet; to gather; to see; union; group; association; CL:個|个[ge4]; a moment (Taiwan pr. for this sense is hui3)
火车站 (huo3 che1 zhan4)
train station
几 (ji3)
how much; how many; several; a few
家 (jia1)
home; family; classifier for families or businesses; refers to the philosophical schools of pre-Han China; noun suffix for specialists in some activity such as musician or revolutionary, corresponds to English -ist, -er, -ary or -ian; surname Jia; CL:個|个[ge4]
叫 (jiao4)
to shout; to call; to order; to ask; to be called; by (indicates agent in the passive mood)
今天 (jin1 tian1)
today; at the present; now
九 (jiu3)
nine; 9
开 (kai1)
to open; to start; to turn on; to boil; to write out (a medical prescription); to operate (vehicle); abbr. for 開爾文|开尔文 degrees Kelvin
看 (kan4)
to see; to look at; to read; to watch; to consider; to regard as; to view as; to treat as; to judge; (after repeated verb) to give it a try; depending on (how you're judging); to visit; to call on; to treat (an illness); to look after; Watch out! (for a danger)
看见 (kan4 jian4)
to see; to catch sight of
块 (kuai4)
lump (of earth); chunk; piece; classifier for pieces of cloth, cake, soap etc; colloquial word for yuan (or other unit of currency such as Hong Kong or US dollar etc), usually as 塊錢|块钱
来 (lai2)
to come; to arrive; to come round; ever since; next
老师 (lao3 shi1)
teacher; CL:個|个[ge4],位[wei4]
了 (le5)
(modal particle intensifying preceding clause); (completed action marker)
冷 (leng3)
cold
里 (li3)
lining; interior; inside; internal; also written 裡|里 [li3]
零 (ling2)
zero; nought; zero sign; fractional; fragmentary; odd (of numbers); (placed between two numbers to indicate a smaller quantity followed by a larger one); fraction; (in mathematics) remainder (after division); extra; to wither and fall; to wither
六 (liu4)
six; 6
妈妈 (ma1 ma5)
mama; mommy; mother; CL:個|个[ge4],位[wei4]
吗 (ma5)
(question tag)
买 (mai3)
to buy; to purchase
猫 (mao1)
cat; CL:隻|只[zhi1]
没 (mei2)
(negative prefix for verbs); have not; not
没关系 (mei2 guan1 xi5)
it doesn't matter
米饭 (mi3 fan4)
(cooked) rice
明天 (ming2 tian1)
tomorrow
名字 (ming2 zi5)
name (of a person or thing); CL:個|个[ge4]
哪 (na3)
how; which
哪儿 (na3 r5)
where?; wherever; anywhere
那 (na4)
that; those; then (in that case); commonly pr. nei4 before a classifier, esp. in Beijing
那儿 (na4 r5)
there
呢 (ne5)
(question particle for subjects already mentioned)
能 (neng2)
to be able to; to be capable of; ability; capability; able; capable; can possibly; (usually used in the negative) to have the possibility of
你 (ni3)
you (informal, as opposed to polite 您[nin2])
年 (nian2)
year; CL:個|个[ge4]
女儿 (nv3 er2)
daughter
朋友 (peng2 you5)
friend; CL:個|个[ge4],位[wei4]
漂亮 (piao4 liang5)
pretty; beautiful
苹果 (ping2 guo3)
apple; CL:個|个[ge4],顆|颗[ke1]
七 (qi1)
seven; 7
钱 (qian2)
coin; money; CL:筆|笔[bi3]
前面 (qian2 mian4)
ahead; in front; preceding; above
请 (qing3)
to ask; to invite; please (do sth); to treat (to a meal etc); to request
去 (qu4)
to go; to go to (a place); to cause to go or send (sb); to remove; to get rid of; (when used either before or after a verb) to go in order to do sth; to be apart from in space or time; (after a verb of motion indicates movement away from the speaker); (used after certain verbs to indicate detachment or separation); (of a time or an event etc) just passed or elapsed
热 (re4)
heat; to heat up; fervent; hot (of weather); warm up
人 (ren2)
man; person; people; CL:個|个[ge4],位[wei4]
认识 (ren4 shi5)
to know; to recognize; to be familiar with; acquainted with sth; knowledge; understanding; awareness; cognition
日 (ri4)
sun; day; date, day of the month; abbr. for 日本|日本 Japan
三 (san1)
three; 3
商店 (shang1 dian4)
store; shop; CL:家[jia1],個|个[ge4]
上 (shang4)
on; on top; upon; first (of multiple parts); previous; last; upper; higher; above; to climb; to go into; to go up; to attend (class or university)
上午 (shang4 wu3)
morning; CL:個|个[ge4]
少 (shao3)
few; little; lack
谁 (shei2)
who; also pronounced shui2
什么 (shen2 me5)
what?; who?; something; anything
十 (shi2)
ten; 10
时候 (shi2 hou5)
time; length of time; moment; period
是 (shi4)
is; are; am; yes; to be
书 (shu1)
book; letter; CL:本[ben3],冊|册[ce4],部[bu4]; see also 書經|书经 Book of History
水 (shui3)
water; river; liquid; beverage; additional charges or income; (of clothes) classifier for number of washes
水果 (shui3 guo3)
fruit; CL:個|个[ge4]
睡觉 (shui4 jiao4)
to go to bed; to go to sleep
说话 (shuo1 hua4)
to speak; to say; to talk; to gossip; to tell stories; talk; word
四 (si4)
four; 4
岁 (sui4)
classifier for years (of age); year; year (of crop harvests)
他 (ta1)
he or him; (used for either sex when the sex is unknown or unimportant); (used before sb's name for emphasis); (used as a meaningless mock object); other; another
她 (ta1)
she
太 (tai4)
highest; greatest; too (much); very; extremely
天气 (tian1 qi4)
weather
听 (ting1)
to listen; to hear; to obey; a can (loanword from English "tin"); classifier for canned beverages
同学 (tong2 xue2)
(fellow) classmate; CL:位[wei4],個|个[ge4]
喂 (wei4)
hello (interj., esp. on telephone); hey; to feed (sb or some animal)
我 (wo3)
I; me; my
我们 (wo3 men5)
we; us; ourselves; our
五 (wu3)
five; 5
喜欢 (xi3 huan5)
to like; to be fond of
下 (xia4)
down; downwards; below; lower; later; next (week etc); second (of two parts); to decline; to go down
下午 (xia4 wu3)
afternoon; p.m.; CL:個|个[ge4]
下雨 (xia4 yu3)
to rain; rainy
先生 (xian1 sheng5)
teacher; Mister (Mr.); husband; doctor (topolect); CL:個|个[ge4],位[wei4]
现在 (xian4 zai4)
now; at present; at the moment; modern; current; nowadays
想 (xiang3)
to think; to believe; to suppose; to wish; to want; to miss
小 (xiao3)
small; tiny; few; young
小姐 (xiao3 jie5)
young lady; miss; CL:個|个[ge4],位[wei4]
些 (xie1)
some; few; several; (a measure word)
写 (xie3)
to write
谢谢 (xie4 xie5)
to thank; thanks
星期 (xing1 qi1)
week; CL:個|个[ge4]
学生 (xue2 sheng5)
student; school child
学习 (xue2 xi2)
to learn; to study
学校 (xue2 xiao4)
school; CL:所[suo3]
一 (yi1)
one; 1; single; a (article); as soon as; entire; whole; all; throughout; "one" radical in Chinese characters (Kangxi radical 1)
衣服 (yi1 fu5)
clothes; CL:件[jian4],套[tao4]
医生 (yi1 sheng1)
doctor; CL:個|个[ge4],位[wei4],名[ming2]
医院 (yi1 yuan4)
hospital; CL:所[suo3],家[jia1],座[zuo4]
椅子 (yi3 zi5)
chair; CL:把[ba3],套[tao4]
有 (you3)
to have; there is; there are; to exist; to be
月 (yue4)
moon; month; CL:個|个[ge4],輪|轮[lun2]
在 (zai4)
(located) at; (to be) in; to exist; in the middle of doing sth; (indicating an action in progress)
再见 (zai4 jian4)
goodbye; see you again later
怎么 (zen3 me5)
how?; what?; why?
怎么样 (zen3 me5 yang4)
how?; how about?; how was it?; how are things?
这 (zhe4)
this; these; (commonly pr. zhei4 before a classifier, esp. in Beijing)
这儿 (zhe4 r5)
here
中国 (Zhong1 guo2)
China; Middle Kingdom
中午 (zhong1 wu3)
noon; midday; CL:個|个[ge4]
住 (zhu4)
to live; to dwell; to stay; to reside; to stop
桌子 (zhuo1 zi5)
table; desk; CL:張|张[zhang1],套[tao4]
字 (zi4)
letter; symbol; character; word; CL:個|个[ge4]; courtesy or style name traditionally given to males aged 20 in dynastic China
昨天 (zuo2 tian1)
yesterday
做 (zuo4)
to do; to make; to produce; to write; to compose; to act as; to engage in; to hold (a party); to be; to become; to function (in some capacity); to serve as; to be used for; to form (a bond or relationship); to pretend; to feign; to act a part; to put on appearance
坐 (zuo4)
to sit; to take a seat; to take (a bus, airplane etc); to bear fruit; surname Zuo