Template:Thời biểu dân số/doc
This is a documentation subpage for
Template documentation[edit]
Template sandbox and testcases for TEMPLATE_NAME[edit]Overview[edit]This page provides a clean workflow to safely edit and validate TEMPLATE_NAME:
Use this page to:
Quick links[edit]
How to test[edit]1. Edit the sandbox at Template:TEMPLATE_NAME/sandbox. 2. Open this test page and click “Show preview” to render the sandbox with inputs below. 3. Verify each testcase: Does the “Actual output” match the “Expected output”? 4. If all pass, consider copying sandbox to live using an edit summary like: “Sync from /sandbox: passes all /testcases as of YYYY-MM-DD.” Previewing tips[edit]
Test harness[edit]The following sections render the sandbox template against curated inputs. Each testcase shows:
Testcase A: Minimal invocation[edit]Parameters: {{TEMPLATE_NAME}} Expected output: [Minimal successful output with defaults: e.g., a neutral message or basic box] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase B: Common parameters[edit]Parameters: {{TEMPLATE_NAME | param1 = Alpha | param2 = Beta | flag = yes }} Expected output: [Example: shows "Alpha" and "Beta" in designated slots; flag toggles enhanced styling] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase C: Edge values and escaping[edit]Parameters: {{TEMPLATE_NAME | param1 = [[Linked target|Visible text]] | param2 = {{subst:CURRENTTIMESTAMP}} | raw = <code><span class="x">escaped</span></code> }} Expected output: [Links render correctly; timestamp subst is literal in expected; raw shows escaped markup] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase D: Internationalization (i18n)[edit]Parameters: {{TEMPLATE_NAME | lang = ja | text = こんにちは世界 }} Expected output: [Text displays correctly for non-ASCII; applies lang attribute or rtl/ltr where applicable] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase E: Error handling[edit]Parameters: {{TEMPLATE_NAME | param1 = | required = <!-- intentionally omitted --> }} Expected output: [Shows a gentle error or maintenance category; does not break page layout] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Maintenance[edit]
Categories[edit]Copy-paste skeletons[edit]Below are ready-to-use skeletons for the sandbox and testcases subpages. Skeleton: Template:TEMPLATE_NAME/sandbox[edit]<!-- Sandbox for TEMPLATE_NAME --> <!-- Copy the entire template source here; edit safely. --> {{#if:{{{required|}}} | <!-- normal output --> <div class="tmpl"> <b>{{{param1|}}}</b> · <i>{{{param2|}}}</i> {{#if:{{{flag|}}}|<span class="flag">✓</span>|}} {{#if:{{{raw|}}}|<span class="raw">{{{raw}}}</span>|}} </div> | <!-- error / missing required --> <span class="error">TEMPLATE_NAME: missing required parameter</span> [[Category:Pages with TEMPLATE_NAME errors]] }} Skeleton: Template:TEMPLATE_NAME/testcases[edit]<!-- Testcases for TEMPLATE_NAME; render against /sandbox --> ; Minimal : {{TEMPLATE_NAME/sandbox}} ; Common params : {{TEMPLATE_NAME/sandbox | param1 = Alpha | param2 = Beta | flag = yes }} ; Edge and escaping : {{TEMPLATE_NAME/sandbox | param1 = [[Linked target|Visible text]] | param2 = 20250101T000000Z | raw = <code><span class="x">escaped</span></code> }} ; I18n : {{TEMPLATE_NAME/sandbox | lang = ja | text = こんにちは世界 }} ; Error handling : {{TEMPLATE_NAME/sandbox | required = }} Review checklist[edit]
Template:Terminate sentence ensures a sentence ends with a specified terminator (default: a period). It avoids adding duplicate terminators and can optionally trim trailing spaces. It attempts to ignore trailing closing quotes or brackets when deciding whether a terminator is already present. Usage[edit]Basic: {{Terminate sentence|This is a sentence}}
→ This is a sentence.
Named parameters: {{Terminate sentence
|text=He said "Hello"
|term=.
}}
→ He said "Hello".
Custom terminator: {{Terminate sentence|text=Warning|term=!}}
→ Warning!
Avoid duplicate terminator: {{Terminate sentence|text=Already done.|term=.}}
→ Already done.
Trim trailing spaces: {{Terminate sentence|text=Ends with space |trim=yes}}
→ Ends with space.
Skip processing: {{Terminate sentence|text=No changes here|skip=yes}}
→ No changes here
Append a note: {{Terminate sentence|text=Complete|note=(source: 2025)}}
→ Complete. (source: 2025)
Parameters[edit]
Behavior details[edit]
Examples[edit]
{{Terminate sentence|text=He whispered "hush"|term=.}}
→ He whispered "hush".
{{Terminate sentence|text=Complete (verified)|term=.}}
→ Complete (verified).
{{Terminate sentence|text=Alert|term=!}}
→ Alert!
{{Terminate sentence|text=Wait...|term=.|allowdup=yes}}
→ Wait.... Best practices[edit]
Lua-powered variant (optional)[edit]For more robust detection (including multilingual quotes and punctuation), create -- Module:TerminateUtil
local M = {}
local closing = {
[")"] = true, ["]"] = true, ["}"] = true,
['"'] = true, ["'"] = true, ["”"] = true, ["’"] = true, ["»"] = true, ["›"] = true
}
local function trimRight(s)
return (s:gsub("%s+$",""))
end
function M.lastVisibleChar(args)
local s = args.s or ""
s = trimRight(s)
local i = #s
while i > 0 do
local c = s:sub(i,i)
if closing[c] then
i = i - 1
else
return c
end
end
return ""
end
return M
Then update the template to call: {{#invoke:TerminateUtil|lastVisibleChar|s=text}}
This improves detection for closing quotes and brackets. See also[edit]It may contain usage information, categories and other content that is not part of the original template page. |
Bản mẫu này tự động xây dựng một thời biểu trình bày lịch sử dân số. Nó hỗ trợ bất cứ năm nào và phù hợp nhiều nhất với thống kê dân số của một địa phương Hoa Kỳ. Bản mẫu dựa trên mô đun Module:Thời biểu dân số để đỡ phải tính toán bằng các hàm cú pháp rắc rối.
Tính năng
[edit]- Hỗ trợ bất cứ năm nào.
- Tự động sắp xếp dữ liệu.
- Chỉ cần định rõ các dân số, không cần trang trí gì hết.
- Định dạng các số theo quy tắc tiếng Việt.
- Hiển thị kẽ vào những năm thiếu dữ liệu, với chu kỳ mặc định là 10 năm.
- Tự động tính bề ngang của hình theo số lần điều tra dân số.
- Tự động tính ra dân số tối đa để tính tỷ lệ đường ngang, ngay cả khi dân số gần đây nhất ít hơn tối đa.
- Nhận ra những thời biểu rộng quá 600 điểm ảnh và kẹp nó vào trong hộp cuộn ngang.
- Điều chỉnh tỷ lệ nếu các đường ngang gần nhau quá.
- Có thể định rõ thêm nguồn.
- Không làm bài tiến gần các hạn chế về cỡ bản mẫu.
Cách sử dụng
[edit]| Tham số | Giá trị mặc định | Giải quyết |
|---|---|---|
|
|
(rỗng) | Dân số vào các năm theo định dạng:
1989:4567 2010:12345 2000:9876 (Có thể sử dụng |
source |
(rỗng) | Nguồn dữ liệu. Hãy cố gắng giữ ngắn gọn để vừa một dòng. |
note |
(rỗng) | Chú thích. Hãy cố gắng giữ ngắn gọn để vừa một dòng. |
Thí dụ
[edit]{{Thời biểu dân số
| 1900 = 659
| 1910 = 422
| 1920 = 453
| 1930 = 441
| 1940 = 389
| 1950 = 986
| 1960 = 1011
| 1970 = 1484
| 1980 = 1360
| 1990 = 1330
| 2000 = 1242
| source = Cục Thống kê Dân số Hoa Kỳ
}}

{{Thời biểu dân số
| 1880 = 792
| 1890 = 1153
| 1900 = 1260
| 1910 = 1421
| 1920 = 1557
| 1930 = 1954
| 1940 = 1904
| 1950 = 2149
| 1960 = 7144
| 1970 = 9106
| 1980 = 9990
| 1990 = 10122
| 2000 = 11677
| source = Cục Thống kê Dân số Hoa Kỳ, Bộ Mở mang Ohio (ODOD), History of Hamilton County Ohio
| note = 1880–90 gồm làng Loveland và Tây Loveland (nơi ấn định cho điều tra dân số)
}}

{{Thời biểu dân số
| 1800 = 850
| 1810 = 2540
| 1820 = 9642
| 1830 = 24831
| 1840 = 46338
| 1850 = 115435
| 1860 = 161044
| 1870 = 216239
| 1880 = 255139
| 1890 = 296908
| 1900 = 325902
| 1910 = 363591
| 1920 = 401247
| 1930 = 451160
| 1940 = 455610
| 1950 = 503998
| 1960 = 502550
| 1970 = 452524
| 1980 = 385457
| 1990 = 364040
| 2000 = 331285
| 2010 = 332458
| source = Cục Thống kê Dân số Hoa Kỳ
}}
{{Thời biểu dân số
| 1810 = 9965
| 1820 = 15820
| 1830 = 20466
| 1840 = 23106
| 1850 = 30455
| 1860 = 33034
| 1870 = 34268
| 1880 = 36713
| 1890 = 33553
| 1900 = 31610
| 1910 = 29551
| 1920 = 28291
| 1930 = 29786
| 1940 = 34109
| 1950 = 42182
| 1960 = 80530
| 1970 = 95725
| 1980 = 128483
| 1990 = 150187
| 2000 = 177977
| 2010 = 197363
| source = Cục Thống kê Dân số Hoa Kỳ
}}
{{Thời biểu dân số
| 1820=1653
| 1830=2928
| 1840=3388
| 1890=3689
| 1900=3766
| 1910=3309
| 1920=3678
| 1930=4320
| 1940=4685
| 1950=3336
| 1960=4081
| 1970=2357
| 1980=4058
| 1990=4079
| 2000=2008
| source = Cục Thống kê Dân số Hoa Kỳ
}}
{{Thời biểu dân số
| 1698 = 4937
| 1712 = 5840
| 1723 = 7248
| 1737 = 10664
| 1746 = 11717
| 1756 = 13046
| 1771 = 21863
| 1790 = 49401
| 1800 = 79216
| 1810 = 119734
| 1820 = 152056
| 1830 = 242278
| 1840 = 391114
| 1850 = 696115
| 1860 = 1174779
| 1870 = 1478103
| 1880 = 1911698
| 1890 = 2507414
| 1900 = 3437202
| 1910 = 4766883
| 1920 = 5620048
| 1930 = 6930446
| 1940 = 7454995
| 1950 = 7891957
| 1960 = 7781984
| 1970 = 7894862
| 1980 = 7071639
| 1990 = 7322564
| 2000 = 8008288
| 2010 = 8175133
| 2012 = 8336697
| source = Greene & Harrington 1932, Cục Thống kê Dân số Hoa Kỳ
}}
Việc cần làm
[edit]- Thêm tính năng để cước chú những năm riêng.
Viết tài liệu giải thích về {{tối đa}} và mang nó vào không gian tên bản mẫu.- Lỗi: Hiện cần dữ liệu về ít nhất một năm.
Hiển thị kẽ rộng hơn một thập niên (en:Oxford Township, Butler County, Ohio).Lỗi khi có kẽ rộng quá.
- Giải quyết những vấn đề gặp với các thành phố lớn, chẳng hạn Cincinnati, Ohio.
- Nếu dân số lớn và không thay đổi nhiều từ kỳ trước điều tra dân số, đẩy chuỗi dân số lên hay xuống để không đè lên chuỗi bên trái.
Hỗ trợ các thành phố có từ lâu, như là Thành phố New York. Trước khi Cục Thống kê Dân số được thành lập, các điều tra dân số xảy ra không đều. Ngoài ra, {{tối đa}} hiện chỉ hỗ trợ 25 số vì {{series le}} cũng có hạn chế tại 25 số.



