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