Wikipedia
bbcwiki
https://bbc.wikipedia.org/wiki/Pogu_ni_Alaman
MediaWiki 1.47.0-wmf.9
first-letter
Media
Marhasurungan
Panghataion
Sipanghasea
Panghataion ni Sipanghasea
Wikipedia
Panghataion ni Wikipedia
Ugasan
Panghataion ni Ugasan
MediaWiki
Panghataion ni MediaWiki
Templat
Panghataion ni Templat
Pangurupion
Panghataion ni Pangurupion
Horong
Panghataion ni Horong
TimedText
TimedText talk
Module
Module talk
Event
Event talk
Pogu ni Alaman
0
1
17034
17031
2026-07-05T01:04:24Z
Gazartashlomo0907
62
17034
wikitext
text/x-wiki
__noeditsection__ __NOTOC__
<!------------SADARION------------>
<div class="mp-header__sadari-on">[[Ugasan:Simpleicons Business calendar-with-a-clock-time-tools.svg|24px|link=]] Sadarion: '''{{CURRENTDAYNAME}}, {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}}'''</div>
<templatestyles src="Templat:Pogu ni alaman/style.css" />
<div id="atas">
<div class="nomobile mp-header">
<div class="mp-header__main">
<div class="mp-header__welcome">
<!-- prettier-ignore -->
<div class="mp-header__welcome-hero"><!--
-->'''Wikipedia Batak Toba'''<!--
--></div>
<!-- prettier-ignore -->
<div class="mp-header__welcome-subtitle"><!--
-->Sopo Parbinotoan lungkas na marhata [[Hata Batak Toba|Batak Toba]].<!--
--></div>
</div>
<!-- prettier-ignore -->
<div class="mp-header__statistics"><!--
statistik jumlah artikel -->Saonari nunga adong '''[[Marhasurungan:AllPages|{{NUMBEROFARTICLES}}]]''' guritan <br> na tarsurat di bagasan [[hata Batak Toba]].
</div>
<!-- prettier-ignore -->
<div class="mp-header__portal hlist">
</div>
</div>
</div>
<div class="mp-main-content">
<!-- prettier-ignore -->
<div class="mp-main-content__focus">
<!-- ============== GURITAN NA TARPILLIT ================ -->
{{Pogu ni alaman/Box3
|title = Guritan na tarpillit
|id = mf-guritan na tarpillit
|image = HSUtvald.svg
|content = {{Wikipedia:Guritan na tarpillit/{{CURRENTWEEK}} {{CURRENTYEAR}}}}
}}
<!-- ================== GOMBAR NA TARPILLIT =============== -->
{{Pogu ni alaman/Box3
|id = mf-gombar na tarpillit
|title = Gombar na tarpillit
|image = PL Wiki InM ikona.svg
|content = [[Ugasan:Pahalgam Valley.jpg|350px]] <br>Panatapan ni [[Rura Pahalgam]] di [[India]].<br>
<small>Gombar on dienet sian [https://commons.wikimedia.org/wiki/File:Lago_Titicaca_La_Paz.jpg Wikimedia Commons]</small>
}}
<!-- ============== TINGTING ================ -->
{{Pogu ni alaman/Box3
|title = Tingting
|id = mf-tinting
|image = HSUtvald.svg
|content = {{Templat: Tingting Ari Minggu}}
}}
<!-- ============== BAHEN GURITAN NA IMBARU ================ -->
{{Pogu ni alaman/Box3
|title = Bahen guritan na imbaru
|id = mf-bahen guritan na imbaru
|image = HSUtvald.svg
|content =
<inputbox>
type=create
width=30
buttonlabel=Bahen
</inputbox>
}}
</div>
<!-- prettier-ignore -->
<div class="mp-main-content__other">
<!-- ============== AHA DO WIKIPEDIA I ================ -->
{{Pogu ni alaman/Box3
| image = {{{img1|Wikipedia logo puzzle globe spins horizontally and vertically, revealing the contents of all of its puzzle pieces, without background.gif}}}
| class = nomobile
| title = Aha do Wikipedia i?
| content =
Boi ma dohonon, Wikipedia i songon sada “halinu ni pustaha” manang “pustaha halinu” na pinadomudomu ni hatopan ni panggurit sian saluhut portibi on, jala ise pe boi do manongos guritan tu “pustaha halinu” saguru ragam hata ni hatopan i.<br>
Molo adong hita na taronjar rohana naeng manongos guritan na imbaru tu “pustaha halinu”, nauli jala na denggan ma i, une jala pintor boi do ulahononhon.<br>
Alai itaparrohahon ma ruhut-ruhut dohot uhum ni “pustaha halinu” na sian pamotoan (''lisensi'') ni hatopan na margoar ''Creative Commons BY-SA''.<br>
Guritan manang tongosan di “pustaha halinu” on, boi dipatingkos manang dipargunahon, alai asa marpanghorhon na denggan, sian pamotoan ni ''Creative Commons BY-SA'' ma.<br>
Porlu hita boto, ia nasa guritan manang tongosan di “pustaha halinu” dihobasi angka dongan panggurit di bagasan haradeon ni roha sambing, jala tongtong do nasida mangula sada partungkoan.<br>
Ingkon barita na toho do isi ni guritan nang tongosan i, boi hatindanghonon marhite pustaha, jala mangihuthon ruhut-ruhut ni sigurit pustaha.<br>
Adong do alaman panungkunan na boi mangurupi dongan na naeng manongos guritan na imbaru tu “pustaha halinu” on.<br>
Unang hita maila masisungkunan manang mangido pangurupion, tarlumobi tu dongan na naeng manggurit dope. Laos boi do tapargunahon alaman on molo naeng manongos guritan na imbaru.
}}
</div>
</div>
<div class="mp-footer">
<div class="mp-footer__main">
{{Pogu ni alaman/Box4
| image = Wikimedia-logo-circle.svg
| title = Ulaon Wikimedia na asing
| content = {{MarsiadapariWMF}}
}}
</div>
__NOTOC__ __NOEDITSECTION__
[[Horong:Pogu ni alaman]]
leylrcq1pohhpp40str30m1tty108hz
Hary Gunarto
0
1749
17032
15255
2026-07-04T17:29:36Z
InternetArchiveBot
90
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5
17032
wikitext
text/x-wiki
[[File:Hary Gunarto1.jpg|thumb|right|250px|Hary Gunarto, 2016]]
'''Hary Gunarto'''<ref>[https://researcher.apu.ac.jp/apuhp/KgApp?resId=S001420&Language=2 Dosen APU] </ref> ima sahalak dosen dohot profesor di Unipersitas Ritsumeikan Asia Pasipik, [[Japang]] na asalna sian [[Indonesia]] jala kuliah di [[Amerika Serikat]].<ref>[https://web.archive.org/web/20220717130645/https://jglobal.jst.go.jp/en/detail?JGLOBAL_ID=200901038934712990 Japan Gov. Database]</ref><ref>[https://www.amazon.es/Collected-Computer-Programming-Problems-Visual/dp/981214174X Visual C#.Net di Amazon.] </ref>
== Pustaha ==
{{Reflist}}
[[Horong:Ilmuwan Indonesia]]
tlw8fele1cv2wrnsns4oxpgb6cxrzq4
ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ
0
2370
17033
14515
2026-07-04T18:08:21Z
InternetArchiveBot
90
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5
17033
wikitext
text/x-wiki
{{multiscript|Indonesia|ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ}}
{{Infobox country
| conventional_long_name = Republik Indonesia
| common_name = Indonesia
| image_flag = Flag of Indonesia.svg
| image_coat = National emblem of Indonesia Garuda Pancasila.svg
| coa_size = 79px
| symbol_type = Partanda negara
| national_motto = "[[Bhinneka Tunggal Ika]]" {{small|([[Bahasa Jawa Kuno|Jawa Kuno]])}} <br> ("Berbeda-beda tetapi satu jua")
| other_symbol = {{IAST|[[Pancasila]]}} ([[Bahasa Sanskerta|Sanskerta]])
| other_symbol_type = Ideologi nasional:
| national_anthem = <br />[[Indonesia Raya]]<br /><div style="display:inline-block;margin-top:0.4em;">[[File:Indonesia Raya instrumental.ogg]]</div>
| image_map = {{Switcher|[[Ugasan:Indonesia (orthographic projection).svg|frameless]]|Tampilkan globe|[[Ugasan:Location Indonesia ASEAN.svg|upright=1.15|frameless]]|Tampilkan peta ASEAN|[[Ugasan:Peta_provinsi_Indonesia.png|frameless]]|Tampilkan peta pembagian administratif}}
| map_caption =
| map_width = 230px
| image_map2 = Indonesia - Location Map (2013) - IDN - UNOCHA-id.svg
| capital = [[Jakarta]]
| coordinates =
{{coord|6|11|S|106|50|E|type:city}}
| largest_city = [[Jakarta]]
| official_languages = [[Hata Indonesia|Indonesia]]
| recognized_regional_languages = Lobi sian [[Parhataan di Indonesia|700 hata]]<ref name="ethnologue">{{cite web|url=https://www.ethnologue.com/country/ID/languages|title=Ethnologue: Languages of the World, Twenty-first edition|last1=Simons|first1=Gary F.|last2=Fennig|first2=Charles D.|publisher=[[SIL International]]|language=en|access-date=20 September 2018}}</ref>
| ethnic_groups = {{tree list}}
* 40,22% [[Halak Jawa|Jawa]]
* 15,50% [[Halak Sunda|Sunda]]
* 3,58% [[Halak Batak|Batak]]
* 3,03% [[Halak Madura|Madura]]
* 2,88% [[Halak Betawi|Betawi]]
* 2,73% [[Halak Minangkabau|Minangkabau]]
* 2,69% [[Halak Bugis|Bugis]]
* 2,27% [[Halak Melayu|Melayu]]
* 27,10% [[Halak di Indonesia|Halak na Asing]]
{{tree list/end}}
| ethnic_groups_ref =<ref name="SUKU">{{Cite web|url=http://demografi.bps.go.id/phpfiletree/bahan/kumpulan_tugas_mobilitas_pak_chotib/Kelompok_1/Referensi/BPS_kewarganegaraan_sukubangsa_agama_bahasa_2010.pdf|title=Kewarganegaraan Suku Bangsa, Agama, Bahasa 2010|website=demografi.bps.go.id|publisher=[[Badan Pusat Statistik]]|year=2010|format=PDF|accessdate=9 Februari 2025|pages=31, 36-41|archive-date=2017-07-12|archive-url=https://web.archive.org/web/20170712140438/http://demografi.bps.go.id/phpfiletree/bahan/kumpulan_tugas_mobilitas_pak_chotib/Kelompok_1/Referensi/BPS_kewarganegaraan_sukubangsa_agama_bahasa_2010.pdf|dead-url=yes}}</ref>
| religion_year = [[2023]]
| religion = {{ublist|item_style=white-space:nowrap;
|87,06% [[Silom di Indonesia|Silom]]
|{{Tree list}}
* 10,47% [[Kristen di Indonesia|Kristen]]
** 7,4% [[Huria Protestan di Indonesia|Protestan]]
** 3,1% [[Huria Katolik di Indonesia|Katolik]]
{{Tree list/end}}
|1,69% [[Hindu di Indonesia|Hindu]]|0,7% [[Buddha di Indonesia|Buddha]]|0,03% [[Kong Hu Chu di Indonesia|Kong Hu Chu]]|0,04% [[Aliran Kepercayaan]] <br/> dohot [[Ugamo di Indonesia|na Asing]]}}
| religion_ref = <ref>{{cite web| url= https://e-database.kemendagri.go.id/dataset/1203/tabel-data?page=23| title= Agama di Indonesia| access-date= 21 Juni 2024| archive-date= 21 Juni 2024| archive-url= https://web.archive.org/web/20240621091542/https://e-database.kemendagri.go.id/dataset/1203/tabel-data?page=23| url-status= live}}</ref>
| demonym =
| government_type = [[Negara kesatuan|Kesatuan]] [[Sistem Presidensial|Presidensial]] [[Republik]] [[Konstitusional]]
| leader_title1 = [[Presiden ni Indonesia|Presiden]]
| leader_name1 = [[Prabowo Subianto]]
| leader_title2 = [[Uakil Presiden ni Indonesia|Wakil Presiden]]
| leader_name2 = [[Gibran Rakabuming Raka]]
| legislature = [[Majelis Permusyawaratan Rakyat Republik Indonesia|Majelis Permusyawaratan Rakyat]] (MPR)
| upper_house = [[Dewan Perwakilan Daerah Republik Indonesia|Dewan Perwakilan Daerah]] (DPD)
| lower_house = [[Dewan Perwakilan Rakyat Republik Indonesia|Dewan Perwakilan Rakyat]] (DPR)
| sovereignty_type = Haulaon
| sovereignty_note = <!--dari [[Imperium kolonial Belanda|Belanda]]--><!-- Berdasarkan konsensus, tolong diskusikan di Halaman Pembicaraan sebelum mengubah Belanda ke Jepang, atau menambahkan keduanya -->
| established_event1 = [[Proklamasi Haluaon Indonesia|Diproklamasihon]] (panjongjongan sian taon)
| established_date1 = 17 Agustus 1945
| established_event2 = [[Konperensi Meja Bundar|Ditanda]] (songon [[Republik Indonesia Serikat|RIS]])
| established_date2 = 27 Desember 1949
| area_km2 = 1904569
| area_footnote = <ref name="area">{{cite web|url=https://unstats.un.org/unsd/demographic/products/dyb/DYB2004/Table03.pdf|title=UN Statistics|publisher=[[Perserikatan Bangsa-Bangsa]]|language=en|date=2005|access-date=31 Oktober 2007|dead-url=no|archive-url=https://web.archive.org/web/20071031023924/http://unstats.un.org/unsd/demographic/products/dyb/DYB2004/Table03.pdf|archive-date=31 Oktober 2007}}</ref>
| area_rank = ke-14
| percent_water = 4,85
| population_estimate = {{increaseNeutral}} 284,973,643<ref name="auto">{{cite web
|title=Sistem Informasi Geografis Kependudukan
|url=https://gis.dukcapil.kemendagri.go.id/peta/
|via=Direktorat Jenderal Kependudukan dan Pencatatan Sipil
|publisher=Kementerian Dalam Negeri Republik Indonesia
|access-date=23 Maret 2025
}}</ref>
| population_census = 270,203,917<ref name="2020census" />
| population_census = 270.203.917<ref>{{cite web|url=https://sensus.bps.go.id/topik/tabular/sp2020/83/175748/0|language=id|title=Jumlah Penduduk Hasil SP menurut Wilayah dan Jenis Kelamin, Indonesia 2020|publisher=Badan Pusat Statistik|access-date=31 Mei 2022}}</ref>
| population_estimate_year = 2024
| population_census_year = 2020
| population_census_rank = ke-4
| population_density_km2 = 143
| population_density_rank = ke-60
| GDP_PPP = {{increase}} $5,009 triliun<ref name="IMF">{{cite web |url=https://www.imf.org/en/Publications/WEO/weo-database/2025/april/weo-report?c=536,&s=NGDP_RPCH,NGDPD,PPPGDP,NGDPDPC,PPPPC,&sy=2024&ey=2030&ssm=0&scsm=1&scc=0&ssd=1&ssc=0&sic=0&sort=country&ds=.&br=1 |title=World Economic Outlook Database, April 2025 |publisher=[[International Monetary Fund]] |website=IMF.org |access-date=23 April 2025}}</ref>
| GDP_PPP_year = 2025 estimasi
| GDP_PPP_rank = ke-8
| GDP_PPP_per_capita = {{increase}} $17,612<ref name="IMF" />
| GDP_PPP_per_capita_rank = ke-102
| GDP_nominal = {{increase}} $1,429 triliun<ref name="IMF" />
| GDP_nominal_year = 2025 estimasi
| GDP_nominal_rank = ke-16
| GDP_nominal_per_capita = {{increase}} $5,027<ref name="IMF" />
| GDP_nominal_per_capita_rank = ke-118
| Gini = 37.9
| Gini_year = 2021
| Gini_change = steady<!--increase/decrease/steady-->
| Gini_ref = <ref name="GINI Indonesia">{{cite web|title=GINI index (World Bank estimate) - Indonesia|url=https://data.worldbank.org/indicator/SI.POV.GINI?locations=ID|publisher=[[Bank Dunia]]|language=en|date=2021|access-date=4 Mei 2022}}</ref>
| Gini_rank =
| HDI = 0.713
| HDI_year = 2022
| HDI_change = increase<!--increase/decrease/steady-->
| HDI_ref = <ref name="2023-2024 components">{{cite book|title=Human Development Report 2023-2024: Breaking the gridlock: Reimagining cooperation in a polarized world|date=13 Maret 2024|publisher=[[Program Pembangunan Perserikatan Bangsa-Bangsa]]|language=en|page=274-277|url=https://hdr.undp.org/system/files/documents/global-report-document/hdr2023-24reporten.pdf|access-date=13 Maret 2024}}</ref>
| HDI_rank = ke-112
| currency = [[Rupiah]] (Rp)
| currency_code = IDR
| time_zone = [[Waktu di Indonesia|beragam]]
| utc_offset = [[UTC+7|+7]] sampai [[UTC+9|+9]]
| date_format = DD/MM/YYYY
| drives_on = kiri<!--Note that this refers to the side of the road used, not the seating of the driver-->
| calling_code = [[Daftar kode telepon di Indonesia|+62]]
| cctld = [[.id]]
| official_website = {{URL|https://indonesia.go.id}}
| footnotes = <!--{{notelist}}-->
}}
{{Script/Batak|'''ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ''' (ᯘᯮᯒᯖ᯲ ᯞᯖᯪᯉ᯲: Indonesia), ᯎᯬᯀᯒ᯲ ᯒᯩᯘ᯲ᯔᯪᯉ '''ᯒᯩᯇᯮᯅ᯲ᯞᯪᯂ᯲ ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ''' (Republik Indonesia), ᯤ ᯔ ᯉᯎᯒ ᯉ ᯔᯒᯪᯝᯉᯉ᯲ ᯑᯪ [[ᯀᯘᯪᯛ ᯀᯰᯎᯬᯉᯪ]] ᯑᯬᯂᯬᯖ᯲ [[ᯀᯬᯘᯩᯛᯉᯪᯛ]], ᯑᯪ ᯀᯉ᯲ᯖᯒ ᯉᯪ [[ᯘᯔᯮᯑᯬᯒ ᯂᯪᯉ᯲ᯑᯪᯛ]] ᯑᯬᯂᯬᯖ᯲ [[ᯘᯔᯮᯑᯬᯒ ᯇᯘᯪᯇᯪᯂ᯲]]. ᯞᯬᯅᯪ ᯘᯪᯛᯉ᯲ ᯘᯔ᯲ᯇᯮᯞᯮ ᯒᯪᯅᯮ ᯇᯮᯞᯬ ᯉ ᯀᯑᯬᯰ ᯑᯪ ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ, ᯖᯒ᯲ᯔᯘᯮᯂ᯲ ᯇᯩ [[ᯇᯮᯞᯬ ᯘᯮᯔᯖᯩᯒ]], [[ᯇᯮᯞᯬ ᯐᯋ]], [[ᯇᯮᯞᯬ ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲]], [[ᯇᯮᯞᯬ ᯘᯮᯞᯋᯩᯘᯪ]] ᯐᯞ [[ᯇᯮᯞᯬ ᯇᯇᯮᯋ]]. ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ ᯤ ᯔ [[ᯉᯎᯒ ᯂᯇᯮᯞᯬᯋᯉ᯲]] ᯉ ᯀᯮᯔ᯲ᯅᯞ᯲ᯎ ᯐᯞ ᯉᯎᯒ ᯇᯘᯔ᯲ᯇᯮᯞᯮᯀᯬᯇᯖ᯲ᯂᯬᯉ᯲ ᯉ ᯀᯮᯔ᯲ᯅᯞ᯲ᯎ ᯔᯬᯞᯬ ᯑᯪᯤᯑ ᯘᯪᯛᯉ᯲ ᯅᯪᯑᯰ ᯉᯪ ᯞᯮᯋᯖ᯲ᯉ (1.904.569 km² ᯔᯉᯰ 735.358 mil persegi). ᯀᯑᯬᯰ ᯑᯬ 267.670.543 ᯇᯬᯇᯮᯞᯘᯪᯉ ᯑᯪ ᯖᯀᯬᯉ᯲ 2018 ᯐᯞ ᯔᯔ᯲ᯅᯂᯩᯉ᯲ ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ ᯎᯅᯩ ᯉᯎᯒ ᯇᯀᯬᯇᯖ᯲ᯂᯬᯉ᯲ ᯉ ᯎᯮᯔᯬᯑᯰ ᯑᯪ ᯇᯬᯒ᯲ᯖᯪᯅᯪ. ᯂᯮᯖ ᯘᯅᯮᯝᯉ᯲ ᯉᯪ ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ ᯔᯒᯪᯝᯉᯉ᯲ ᯑᯪ [[ᯐᯂᯒ᯲ᯖ]], ᯉ ᯎᯅᯩ [[ᯞᯮᯋᯖ᯲ ᯉᯪ ᯀᯮᯒ᯲ᯅᯉ᯲]] ᯇᯑᯮᯋᯂᯬᯉ᯲ ᯉ ᯎᯮᯔᯬᯑᯰ ᯑᯪ ᯇᯬᯒ᯲ᯖᯪᯅᯪ.}}
== {{Script/Batak|ᯒᯮᯀᯘ᯲ ᯀᯑ᯲ᯔᯪᯉᯪᯘ᯲ᯖ᯲ᯒᯘᯪ}} ==
{{Script/Batak|ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ ᯑᯪᯅᯎᯪ ᯎᯅᯩ 38 [[ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ]], ᯐᯞ ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ ᯔ ᯖᯪᯰᯂᯖ᯲ ᯒᯮᯀᯘ᯲ ᯇᯒ᯲ᯐᯬᯞᯬ. ᯑᯪ ᯖᯬᯒᯮ ᯀᯬᯉ᯲ ᯔ ᯖᯪᯰᯂᯖᯉ᯲ ᯉᯪ ᯒᯮᯀᯘ᯲ ᯉ ᯀᯑᯬᯰ ᯑᯪ ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ.}}
{| class="wikitable"
!ᯖᯪᯰᯂᯖ᯲
!ᯖᯪᯇᯩ
(ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ)
!ᯖᯪᯇᯩ
(ᯅᯖᯂ᯲ ᯖᯬᯅ)
!ᯎᯬᯀᯒ᯲ ᯉᯪ ᯇᯔᯒᯪᯉ᯲ᯖ
([[Hata Indonesia|ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ]])
!ᯎᯬᯀᯒ᯲ ᯉᯪ ᯇᯔᯒᯪᯉ᯲ᯖ
([[Hata Inggeris|ᯀᯪᯰᯎᯩᯒᯪᯘ᯲]])
!ᯅᯂᯖ᯲ᯉ
|-
|I
|''Provinsi''
|[[Propinsi di Indonesia|ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ]]
|''Gubernur''
|''Governor''
|38<ref name="Dagri">[https://web.archive.org/web/20200807190733/https://www.kemendagri.go.id/media/filemanager/2018/04/13/f/i/file_1.pdf ''Rekapitulasi Jumlah PPID Provinsi, Kabupaten, dan Kota''] (4 April 2018), ''Ministry of Home Affairs of the Republic of Indonesia'', Diakses tanggal 3 Pebruari 2022</ref>
|-
| rowspan="2" |II
|''Kabupaten''
|ᯂᯅᯮᯇᯖᯩᯉ᯲
|''[[Bupati]]''
|''Regent''
|416<ref name="Dagri" />
|-
|''Kota''
|ᯂᯬᯖ
|''[[Wali Kota]]''
|''Mayor''
|98<ref name="Dagri" />
|-
|III
|''Kecamatan'', ''distrik'', ''kapanewon'', manang ''kemantren''
|ᯑᯪᯘ᯲ᯖ᯲ᯒᯪᯂ᯲
|''Camat'', ''kepala distrik'', ''panewu'' manang ''mantri pamong praja''
|''Head of district''
|7,024<ref>[https://www.bps.go.id/dynamictable/2015/09/07/857/jumlah-kecamatan-menurut-provinsi-2004-2014.html ''Jumlah Kecamatan Menurut Provinsi, 2004–2014''] (7 September 2015), ''Central Agency on Statistics of Indonesia'', Diakses tanggal 3 Pebruari 2022</ref>
|-
|IV
|''Desa'' ᯔᯉᯰ ''kelurahan''
|ᯂᯮᯖ ᯔᯉᯰ ᯂᯩᯞᯮᯒᯂᯉ᯲
|''Kepala desa'' manang ''lurah''
|''Head of village''/''subdistrict''
|83,441<ref>[http://jdih.kemendagri.go.id/jdih/uploads/Permendagri/Permendagri%20No%2072%20Th%202019+lampiran.pdf ''Peraturan Menteri Dalam Negeri Nomor 72 Tahun 2019 tentang Perubahan atas Permendagri nomor 137 Tahun 2017 tentang Kode dan Data Wilayah Administrasi Pemerintahan'' (2019)], ''Ministry of Home Affairs (Indonesia)'', Diakses tanggal 3 Pebruari 2022</ref>
|}
== ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ ==
[[Propinsi di Indonesia|ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ]] ᯉ ᯀᯑᯬᯰ ᯑᯪ ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ ᯤᯔ 38 ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ, ᯑᯪ ᯖᯬᯒᯮ ᯀᯬᯉ᯲ ᯔ ᯀᯰᯂ ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ ᯤ;
{| style="background:none;" cellspacing="2"
|
{| class="sortable wikitable" style="text-align:left; font-size:95%;"
|- style="font-size:100%; text-align:right;"
! scope="col" style="width:3px;" |ᯉᯬ
! scope="col" style="width:80px;" |ᯇᯮᯞᯬ
! scope="col" style="width:120px;" |ᯇ᯲ᯒᯬᯇᯪᯉ᯲ᯘᯪ
! scope="col" style="width:100px;" |ᯤᯅᯮ ᯂᯬᯖ
! scope="col" style="width:60px;" |ᯀᯒᯩᯀ (km<sup>2</sup>)<ref>[https://www.bps.go.id/statictable/2014/09/05/1366/luas-daerah-dan-jumlah-pulau-menurut-provinsi-2002-2016.html Luas Daerah dan Jumlah Pulau Menurut Provinsi 2002-2016], www.bps.go.id, Diakses tanggal 3 Pebruari 2022</ref>
! scope="col" style="width:80px;" |ᯇᯬᯇᯮᯞᯘᯪ
(2022)<ref>[https://web.archive.org/web/20230709113430/https://satudata.kemenag.go.id/dataset/detail/jumlah-penduduk-menurut-agama ''Jumlah Penduduk Menurut Agama 2022''] (2022), www.satudata.kemenag.go.id, Diakses tanggal 9 Juli 2023</ref>
|-
|1
|ᯘᯮᯔᯖᯩᯒ
|[[Aceh|ᯀᯘᯩᯂ᯲]]
|[[Kota Banda Aceh|ᯅᯉ᯲ᯑ ᯀᯘᯩᯂ᯲]]
| style="text-align:right" |57.956,00
| style="text-align:right" |5.432.312
|-
|2
|ᯘᯮᯔᯖᯩᯒ
|[[Sumatera Utara|ᯘᯮᯔᯖᯩᯒ ᯥᯖᯒ]]
|[[Kota Medan|ᯔᯩᯑᯉ᯲]]
| style="text-align:right" |72.981,23
| style="text-align:right" |15.372.437
|-
|3
|ᯘᯮᯔᯖᯩᯒ
|[[Sumatera Pastima|ᯘᯮᯔᯖᯩᯒ ᯇᯘ᯲ᯖᯪᯔ]]
|[[Kota Padang|ᯇᯑᯰ]]
| style="text-align:right" |42.012,89
| style="text-align:right" |5.664.988
|-
|4
|ᯘᯮᯔᯖᯩᯒ
|[[Riau|ᯒᯪᯛᯥ]]
|[[Kota Pekanbaru|ᯇᯩᯂᯉ᯲ᯅᯒᯮ]]
| style="text-align:right" |87.023,66
| style="text-align:right" |6.743.099
|-
|5
|ᯘᯮᯔᯖᯩᯒ
|[[Pulo Riau|ᯇᯮᯞᯬ ᯒᯪᯛᯥ]]
|[[Kota Tanjungpinang|ᯖᯉ᯲ᯐᯮᯰᯇᯪᯉᯰ]]
| style="text-align:right" |8.201,72
| style="text-align:right" |2.133.491
|-
|6
|ᯘᯮᯔᯖᯩᯒ
|[[Jambi|ᯐᯔ᯲ᯅᯪ]]
|[[Kota Jambi|ᯐᯔ᯲ᯅᯪ]]
| style="text-align:right" |50.058,16
| style="text-align:right" |3.696.044
|-
|7
|ᯘᯮᯔᯖᯩᯒ
|[[Sumatera Dangsina|ᯘᯮᯔᯖᯩᯒ ᯑᯰᯘᯪᯉ]]
|[[Kota Palembang|ᯇᯞᯩᯔ᯲ᯅᯰ]]
| style="text-align:right" |91.592,43
| style="text-align:right" |8.755.074
|-
|8
|ᯘᯮᯔᯖᯩᯒ
|[[Pulo Bangka Belitung|ᯇᯮᯞᯬ ᯅᯰᯂ ᯅᯩᯞᯪᯖᯮᯰ]]
|[[Kota Pangkalpinang|ᯇᯰᯂᯞ᯲ᯇᯪᯉᯰ]]
| style="text-align:right" |16.424,06
| style="text-align:right" |1.490.418
|-
|9
|ᯘᯮᯔᯖᯩᯒ
|[[Bengkulu|ᯅᯩᯰᯂᯮᯞᯮ]]
|[[Kota Bengkulu|ᯅᯩᯰᯂᯮᯞᯮ]]
| style="text-align:right" |19.919,33
| style="text-align:right" |2.065.573
|-
|10
|ᯘᯮᯔᯖᯩᯒ
|[[Lampung|ᯞᯔ᯲ᯇᯮᯰ]]
|[[Kota Bandar Lampung|ᯅᯉ᯲ᯑᯒ᯲ ᯞᯔ᯲ᯇᯮᯰ]]
| style="text-align:right" |34,623,80
| style="text-align:right" |8.947.458
|-
|11
|ᯐᯋ
|[[Daerah Khusus Ibukota Jakarta|ᯑ᯲.ᯂ᯲.ᯤ. ᯐᯂᯒ᯲ᯖ]]
|[[Jakarta Pusat|ᯐᯂᯒ᯲ᯖ ᯇᯮᯘᯖ᯲]]
| style="text-align:right" |664,01
| style="text-align:right" |10.562.088
|-
|12
|ᯐᯋ
|[[Jawa Pastima|ᯐᯋ ᯇᯘ᯲ᯖᯪᯔ]]
|[[Kota Bandung|ᯅᯉ᯲ᯑᯮᯰ]]
| style="text-align:right" |35.377,76
| style="text-align:right" |48.274.162
|-
|13
|ᯐᯋ
|[[Banten|ᯅᯉ᯲ᯖᯩᯉ᯲]]
|[[Kota Serang|ᯘᯩᯒᯰ]]
| style="text-align:right" |9.662,92
| style="text-align:right" |11.904.562
|-
|14
|ᯐᯋ
|[[Jawa Tonga|ᯐᯋ ᯖᯬᯝ]]
|[[Kota Semarang|ᯘᯩᯔᯒᯰ]]
| style="text-align:right" |32.800,69
| style="text-align:right" |36.516.035
|-
|15
|ᯐᯋ
|[[Daerah Istimewa Jogjakarta|ᯑ᯲.ᯤ. ᯐᯬᯎ᯲ᯐᯂᯒ᯲ᯖ]]
|[[Kota Jogjakarta|ᯐᯬᯎ᯲ᯐᯂᯒ᯲ᯖ]]
| style="text-align:right" |3.133,15
| style="text-align:right" |3.668.719
|-
|16
|ᯐᯋ
|[[Jawa Purba|ᯐᯋ ᯇᯮᯒ᯲ᯅ]]
|[[Kota Surabaya|ᯘᯮᯒᯅᯛ]]
| style="text-align:right" |47.799,75
| style="text-align:right" |40.665.696
|-
|17
|ᯉᯮᯘ ᯖᯩᯰᯎᯒ
|[[Bali|ᯅᯞᯪ]]
|[[Kota Denpasar|ᯑᯩᯉ᯲ᯇᯘᯒ᯲]]
| style="text-align:right" |5.780,06
| style="text-align:right" |4.317.404
|-
|18
|ᯉᯮᯘ ᯖᯩᯰᯎᯒ
|[[Nusa Tenggara Pastima|ᯉ᯲.ᯖ᯲.ᯅ᯲.]]
|[[Kota Mataram|ᯔᯖᯒᯔ᯲]]
| style="text-align:right" |18.572,32
| style="text-align:right" |5.320.092
|-
|19
|ᯉᯮᯘ ᯖᯩᯰᯎᯒ
|[[Nusa Tenggara Purba|ᯉ᯲.ᯖ᯲.ᯖ᯲.]]
|[[Kota Kupang|ᯂᯮᯇᯰ]]
| style="text-align:right" |48.718,10
| style="text-align:right" |5.325.566
|-
|20
|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲
|[[Kalimantan Pastima|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲ ᯇᯘ᯲ᯖᯪᯔ]]
|[[Kota Pontianak|ᯇᯬᯉ᯲ᯖᯪᯀᯉᯂ᯲]]
| style="text-align:right" |147.307,00
| style="text-align:right" |5.414.390
|-
|21
|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲
|[[Kalimantan Tonga|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲ ᯖᯬᯝ]]
|[[Kota Palangka Raya|ᯇᯞᯰᯂ ᯒᯛ]]
| style="text-align:right" |153.564,50
| style="text-align:right" |2.669.969
|-
|22
|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲
|[[Kalimantan Dangsina|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲ ᯑᯰᯘᯪᯉ]]
|[[Kota Banjarmasin|ᯅᯉ᯲ᯐᯒ᯲ᯔᯘᯪᯉ᯲]]
| style="text-align:right" |38.744,23
| style="text-align:right" |4.073.584
|-
|23
|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲
|[[Kalimantan Purba|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲ ᯇᯮᯒ᯲ᯅ]]
|[[Kota Samarinda|ᯘᯔᯒᯪᯉ᯲ᯑ]]
| style="text-align:right" |129.066,64
| style="text-align:right" |3.766.039
|-
|24
|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲
|[[Kalimantan Utara|ᯂᯞᯪᯔᯉ᯲ᯖᯉ᯲ ᯥᯖᯒ]]
|[[Tanjung Selor, Bulungan|ᯖᯉ᯲ᯐᯮᯰ ᯘᯩᯞᯬᯒ᯲]]
| style="text-align:right" |75.467,70
| style="text-align:right" |701.814
|-
|25
|ᯘᯮᯞᯋᯩᯘᯪ
|[[Sulawesi Utara|ᯘᯮᯞᯋᯩᯘᯪ ᯥᯖᯒ]]
|[[Kota Manado|ᯔᯉᯑᯬ]]
| style="text-align:right" |13.851,64
| style="text-align:right" |2.621.923
|-
|26
|ᯘᯮᯞᯋᯩᯘᯪ
|[[Gorontalo|ᯎᯬᯒᯬᯉ᯲ᯖᯞᯬ]]
|[[Kota Gorontalo|ᯎᯬᯒᯬᯉ᯲ᯖᯞᯬ]]
| style="text-align:right" |11.257,07
| style="text-align:right" |1.171.681
|-
|27
|ᯘᯮᯞᯋᯩᯘᯪ
|[[Sulawesi Tonga|ᯘᯮᯞᯋᯩᯘᯪ ᯖᯬᯝ]]
|[[Kota Palu|ᯇᯞᯮ]]
| style="text-align:right" |61.841,29
| style="text-align:right" |2.985.734
|-
|28
|ᯘᯮᯞᯋᯩᯘᯪ
|[[Sulawesi Pastima|ᯘᯮᯞᯋᯩᯘᯪ ᯇᯘ᯲ᯖᯪᯔ]]
|[[Kabupaten Mamuju|ᯔᯔᯮᯐᯮ]]
| style="text-align:right" |16.787,18
| style="text-align:right" |1.450.610
|-
|29
|ᯘᯮᯞᯋᯩᯘᯪ
|[[Sulawesi Dangsina|ᯘᯮᯞᯋᯩᯘᯪ ᯑᯰᯘᯪᯉ]]
|[[Kota Makassar|ᯔᯂᯘᯒ᯲]]
| style="text-align:right" |46.717,48
| style="text-align:right" |9.073.509
|-
|30
|ᯘᯮᯞᯋᯩᯘᯪ
|[[Sulawesi Anggoni|ᯘᯮᯞᯋᯩᯘᯪ ᯀᯰᯎᯬᯉᯪ]]
|[[Kota Kendari|ᯂᯩᯉ᯲ᯑᯒᯪ]]
| style="text-align:right" |38.067,70
| style="text-align:right" |2.624.875
|-
|31
|ᯔᯞᯮᯂᯮ
|[[Maluku|ᯔᯞᯮᯂᯮ]]
|[[Kota Ambon|ᯀᯔ᯲ᯅᯬᯉ᯲]]
| style="text-align:right" |46.914,03
| style="text-align:right" |1.848.923
|-
|32
|ᯔᯞᯮᯂᯮ
|[[Maluku Utara|ᯔᯞᯮᯂᯮ ᯥᯖᯒ]]
|[[Sopipi, Oba Utara, Tidore Kepulauan|ᯘᯬᯇᯪᯇᯪ]]
| style="text-align:right" |31.982,50
| style="text-align:right" |1.282.937
|-
|33
|ᯇᯇᯮᯀ
|[[Papua Pastima|ᯇᯇᯮᯀ ᯇᯘ᯲ᯖᯪᯔ]]
|[[Kabupaten Manokwari|ᯔᯉᯬᯂ᯲ᯋᯒᯪ]]
| style="text-align:right" |64.134,66
| style="text-align:right" |559.361
|-
|34
|ᯇᯇᯮᯀ
|[[Papua|ᯇᯇᯮᯀ]]
|[[Kota Jayapura|ᯂᯬᯖ ᯐᯛᯇᯮᯒ]]
| style="text-align:right" |82.680,95
| style="text-align:right" |1.073.354
|-
|35
|ᯇᯇᯮᯀ
|[[Papua Dangsina|ᯇᯇᯮᯀ ᯑᯰᯘᯪᯉ]]
|[[Kabupaten Merauke|ᯔᯩᯒᯥᯂᯩ]]
| style="text-align:right" |117.833,92
| style="text-align:right" |522.844
|-
|36
|ᯇᯇᯮᯀ
|[[Papua Nariti|ᯇᯇᯮᯀ ᯉᯒᯪᯖᯪ]]
|[[Kota Sorong|ᯂᯬᯖ ᯘᯬᯒᯬᯰ]]
| style="text-align:right" |39.167
| style="text-align:right" |604.698
|-
|37
|ᯇᯇᯮᯀ
|[[Papua Dolok|ᯇᯇᯮᯀ ᯑᯬᯞᯬᯂ᯲]]
|[[Kabupaten Jayawijaya|ᯐᯛᯋᯪᯐᯛ]]
| style="text-align:right" |88.416,64
| style="text-align:right" |1.459.544
|-
|38
|ᯇᯇᯮᯀ
|[[Papua Tonga|ᯇᯇᯮᯀ ᯖᯬᯝ]]
|[[Kabupaten Nabire|ᯉᯅᯪᯒᯩ]]
| style="text-align:right" |60.491,24
| style="text-align:right" |1.348.463
|-
| colspan="3" |<div style="text-align:center">'''ᯀᯪᯉ᯲ᯑᯬᯉᯩᯘᯪᯀ'''</div>
|[[Daerah Khusus Ibukota Jakarta|ᯑ᯲.ᯂ᯲.ᯤ. ᯐᯂᯒ᯲ᯖ]]
| style="text-align:right" |'''1.913.578,68'''
| style="text-align:right" |'''270.203.917'''
|}
![[Ugasan:Indonesia_provinces_1945-2012.gif|center|500x500px]][[Ugasan:Indonesia,_administrative_divisions_-_en_-_monochrome.svg|center|500x500px]]
|}
== {{Script/Batak|ᯇᯮᯘ᯲ᯖᯂ}} ==
[[Horong:ᯎᯮᯒᯪᯖᯉ᯲ᯉᯖᯒ᯲ᯘᯮᯒᯖ᯲ᯑᯪᯘᯮᯒᯖ᯲ᯅᯖᯂ᯲]]
80cfwiopmbenqtksv1l9ymgn3ll2bjx
34 (bilangan)
0
2933
17036
16888
2026-07-05T05:21:36Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[34 (pulpen)]] tu [[34 (nomor)]]
16888
wikitext
text/x-wiki
{{databox}}'''34''' ('''tolu pulu opat''') ima sada bilangan, antara 33 dohot 35.
i9iurapclzt4zlcyfz78vjs6938k0g2
17041
17036
2026-07-05T05:24:01Z
Gazartashlomo0907
62
17041
wikitext
text/x-wiki
{{databox}}
'''34''' ('''tolu pulu opat''') ima sada bilangan, antara 33 dohot 35.
[[Horong:Bilangan]]
tssk7rf5uxh7hit1msr1w7zilgyf3jn
17042
17041
2026-07-05T05:24:18Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[34 (nomor)]] tu [[34 (bilangan)]]
17041
wikitext
text/x-wiki
{{databox}}
'''34''' ('''tolu pulu opat''') ima sada bilangan, antara 33 dohot 35.
[[Horong:Bilangan]]
tssk7rf5uxh7hit1msr1w7zilgyf3jn
17069
17042
2026-07-05T06:25:54Z
Gazartashlomo0907
62
17069
wikitext
text/x-wiki
{{Infobox number
| number = 34
| divisor = 1, 2, 17, 34
}}
'''34''' ('''tolu pulu opat''') i ma sada bilangan, antara 33 dohot 35.
[[Horong:Bilangan]]
ah0tvlhapg06aenfcouko654trtamz7
17080
17069
2026-07-05T06:48:23Z
Gazartashlomo0907
62
17080
wikitext
text/x-wiki
'''34''' ('''tolu pulu opat''') i ma sada bilangan, antara 33 dohot 35.
[[Horong:Bilangan]]
76pz66lvtt0s9y7pud2hho21zwlpsu8
45 (bilangan)
0
2937
17038
16900
2026-07-05T05:22:47Z
Gazartashlomo0907
62
17038
wikitext
text/x-wiki
[[Ugasan:Vitoria_-_Número_45.jpg|thumb|45]]
'''45''' ('''opat pulu lima'''), sada nomor , antara 44 dohot 46.
[[Horong:Nomor]]
0js4x4pl584tp2m7rowa5jothp7kwea
17039
17038
2026-07-05T05:23:04Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[45 (pulpen)]] tu [[45 (nomor)]]
17038
wikitext
text/x-wiki
[[Ugasan:Vitoria_-_Número_45.jpg|thumb|45]]
'''45''' ('''opat pulu lima'''), sada nomor , antara 44 dohot 46.
[[Horong:Nomor]]
0js4x4pl584tp2m7rowa5jothp7kwea
17044
17039
2026-07-05T05:25:15Z
Gazartashlomo0907
62
17044
wikitext
text/x-wiki
[[Ugasan:Vitoria_-_Número_45.jpg|thumb|45]]
'''45''' ('''opat pulu lima'''), sada bilangan , antara 44 dohot 46.
[[Horong:Bilangan]]
aib4q8k82reitxgsauboot58ihwsvnz
17045
17044
2026-07-05T05:25:30Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[45 (nomor)]] tu [[45 (bilangan)]]
17044
wikitext
text/x-wiki
[[Ugasan:Vitoria_-_Número_45.jpg|thumb|45]]
'''45''' ('''opat pulu lima'''), sada bilangan , antara 44 dohot 46.
[[Horong:Bilangan]]
aib4q8k82reitxgsauboot58ihwsvnz
17071
17045
2026-07-05T06:29:01Z
Gazartashlomo0907
62
17071
wikitext
text/x-wiki
{{Infobox number
| number = 45
| divisor = 1, 3, 5, 9, 15, 45
}}
[[Ugasan:Vitoria_-_Número_45.jpg|thumb|45]]
'''45''' ('''opat pulu lima'''), sada bilangan , antara 44 dohot 46.
[[Horong:Bilangan]]
1t7wr61ppn4g3jystwfzu6g188itw2f
17079
17071
2026-07-05T06:48:10Z
Gazartashlomo0907
62
17079
wikitext
text/x-wiki
[[Ugasan:Vitoria_-_Número_45.jpg|thumb|45]]
'''45''' ('''opat pulu lima'''), sada bilangan , antara 44 dohot 46.
[[Horong:Bilangan]]
aib4q8k82reitxgsauboot58ihwsvnz
Wikipedia:Guritan na tarpillit/28 2026
4
2977
17035
2026-07-05T05:19:53Z
Gazartashlomo0907
62
Created page with "{{Pogu ni alaman/Topigombar|Piper betel's leaf.jpg|250|Gombar ni demban.|{{{selular|}}}}} '''Demban''' ([[Hata Indonesia]]: ''Sirih'') sanga digoari muse '''burangir''' sanga '''napuran''' i ma sada suansuanan sian [[Indonesia]] na mangolu manginsir sanga magusande tu sada batang ni hau. Molo di bagasan abahan, mangallang napuran hombar ma muse dohot [[gambir]], [[pinang]], [[timbaho]] dohot [[hapur]]. Alai molo gahat mangallang hapur, boi manega ([[periodentitis]]) mam..."
17035
wikitext
text/x-wiki
{{Pogu ni alaman/Topigombar|Piper betel's leaf.jpg|250|Gombar ni demban.|{{{selular|}}}}}
'''Demban''' ([[Hata Indonesia]]: ''Sirih'') sanga digoari muse '''burangir''' sanga '''napuran''' i ma sada suansuanan sian [[Indonesia]] na mangolu manginsir sanga magusande tu sada batang ni hau. Molo di bagasan abahan, mangallang napuran hombar ma muse dohot [[gambir]], [[pinang]], [[timbaho]] dohot [[hapur]]. Alai molo gahat mangallang hapur, boi manega ([[periodentitis]]) mambahen sega [[ipon]].<br>
Di halak [[Malayu]], napuran on dibahen gabe [[ubat]] (''fitofarmaka''), dung i dipangke muse tu acara adat rumpun Melayu. Di Indonesia, napuran on gabe suansuanan na sudung sian Propinsi [[Hapuloan Riau]]. Halak di Hapuloan Riau maniop tongtong adat mangallang napuran, sudung tu adat manambut tondong na ro tu huta ni halahi. Demban i ma suansuanan tangkasan di [[Indonesia]] na tubu manjilir manang mangusande tu kambona ni hau na asing.
'''([[Demban|Sasingkopna...]])'''
[[Horong:Guritan na tarpillit]]
s1ua14fldovwiwf7t8e7rkzfcqx53np
34 (pulpen)
0
2978
17037
2026-07-05T05:21:36Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[34 (pulpen)]] tu [[34 (nomor)]]
17037
wikitext
text/x-wiki
#REDIRECT [[34 (nomor)]]
njqviau3kmrw99kex9bsqvn6snx40q4
45 (pulpen)
0
2979
17040
2026-07-05T05:23:04Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[45 (pulpen)]] tu [[45 (nomor)]]
17040
wikitext
text/x-wiki
#REDIRECT [[45 (nomor)]]
ru7twiurdtp1lxx0xtxy3g98o6j6971
34 (nomor)
0
2980
17043
2026-07-05T05:24:18Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[34 (nomor)]] tu [[34 (bilangan)]]
17043
wikitext
text/x-wiki
#REDIRECT [[34 (bilangan)]]
ejw897iaeiqwj13si5jtrv2wiz0yfdv
45 (nomor)
0
2981
17046
2026-07-05T05:25:30Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[45 (nomor)]] tu [[45 (bilangan)]]
17046
wikitext
text/x-wiki
#REDIRECT [[45 (bilangan)]]
r8g03rgqu5uqoz740hmkdaec6ejrmqg
Templat:Infobox number
10
2982
17047
2026-07-05T05:33:11Z
Gazartashlomo0907
62
Created page with "{{short description|Natural number|noreplace}}{{Infobox number/box |number={{#if:{{{number<includeonly>|</includeonly>}}} | {{{number<noinclude>|{{#time:j}}</noinclude>}}} | {{PAGENAMEBASE}} }} | cardinal = {{{cardinal|}}} | ordinal = {{{ordinal|}}} | ordinal text = {{{ordinal text|}}} | numeral = {{{numeral|}}} | factorization = {{{factorization|}}} | gaussian integer factorization = {{{Gaussian integer factorization|{{{gaussian integer factorization|}}}}}} | prim..."
17047
wikitext
text/x-wiki
{{short description|Natural number|noreplace}}{{Infobox number/box
|number={{#if:{{{number<includeonly>|</includeonly>}}}
| {{{number<noinclude>|{{#time:j}}</noinclude>}}}
| {{PAGENAMEBASE}}
}}
| cardinal = {{{cardinal|}}}
| ordinal = {{{ordinal|}}}
| ordinal text = {{{ordinal text|}}}
| numeral = {{{numeral|}}}
| factorization = {{{factorization|}}}
| gaussian integer factorization = {{{Gaussian integer factorization|{{{gaussian integer factorization|}}}}}}
| prime = {{{prime|}}}
| divisor = {{{divisor|}}}
| base 36 = {{{base 36|}}}
| roman = {{{Roman|{{{roman|}}}}}}
| roman unicode = {{{Roman unicode|{{{roman unicode|}}}}}}
| unicode = {{{unicode|}}}
| greek prefix = {{{Greek prefix|{{{greek prefix|}}}}}}
| latin prefix = {{{Latin prefix|{{{latin prefix|}}}}}}
| old english prefix = {{{Old English prefix|{{{old english prefix|}}}}}}
| lang1 = {{{lang1|}}}
| lang1 symbol = {{{lang1 symbol|}}}
| lang2 = {{{lang2|}}}
| lang2 symbol = {{{lang2 symbol|}}}
| lang3 = {{{lang3|}}}
| lang3 symbol = {{{lang3 symbol|}}}
| lang4 = {{{lang4|}}}
| lang4 symbol = {{{lang4 symbol|}}}
| lang5 = {{{lang5|}}}
| lang5 symbol = {{{lang5 symbol|}}}
| lang6 = {{{lang6|}}}
| lang6 symbol = {{{lang6 symbol|}}}
| lang7 = {{{lang7|}}}
| lang7 symbol = {{{lang7 symbol|}}}
| lang8 = {{{lang8|}}}
| lang8 symbol = {{{lang8 symbol|}}}
| lang9 = {{{lang9|}}}
| lang9 symbol = {{{lang9 symbol|}}}
| lang10 = {{{lang10|}}}
| lang10 symbol = {{{lang10 symbol|}}}
| lang11 = {{{lang11|}}}
| lang11 symbol = {{{lang11 symbol|}}}
| lang12 = {{{lang12|}}}
| lang12 symbol = {{{lang12 symbol|}}}
| lang13 = {{{lang13|}}}
| lang13 symbol = {{{lang13 symbol|}}}
| lang14 = {{{lang14|}}}
| lang14 symbol = {{{lang14 symbol|}}}
| lang15 = {{{lang15|}}}
| lang15 symbol = {{{lang15 symbol|}}}
| lang16 = {{{lang16|}}}
| lang16 symbol = {{{lang16 symbol|}}}
| lang17 = {{{lang17|}}}
| lang17 symbol = {{{lang17 symbol|}}}
| lang18 = {{{lang18|}}}
| lang18 symbol = {{{lang18 symbol|}}}
| lang19 = {{{lang19|}}}
| lang19 symbol = {{{lang19 symbol|}}}
| lang20 = {{{lang20|}}}
| lang20 symbol = {{{lang20 symbol|}}}
| lang21 = {{{lang21|}}}
| lang21 symbol = {{{lang21 symbol|}}}
| lang22 = {{{lang22|}}}
| lang22 symbol = {{{lang22 symbol|}}}
| lang23 = {{{lang23|}}}
| lang23 symbol = {{{lang23 symbol|}}}
| lang24 = {{{lang24|}}}
| lang24 symbol = {{{lang24 symbol|}}}
| lang25 = {{{lang25|}}}
| lang25 symbol = {{{lang25 symbol|}}}
| lang26 = {{{lang26|}}}
| lang26 symbol = {{{lang26 symbol|}}}
| lang27 = {{{lang27|}}}
| lang27 symbol = {{{lang27 symbol|}}}
| lang28 = {{{lang28|}}}
| lang28 symbol = {{{lang28 symbol|}}}
| lang29 = {{{lang29|}}}
| lang29 symbol = {{{lang29 symbol|}}}
| lang30 = {{{lang30|}}}
| lang30 symbol = {{{lang30 symbol|}}}
}}{{#if:{{{prime|}}}|[[Category:Pages using infobox number with prime parameter]]}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox number with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox number]] with unknown parameter "_VALUE_"|ignoreblank=y| base 36 | cardinal | divisor | factorization | gaussian integer factorization | Gaussian integer factorization | greek prefix | Greek prefix | lang1 | lang1 symbol | lang2 | lang2 symbol | lang3 | lang3 symbol | lang4 | lang4 symbol | lang5 | lang5 symbol | lang6 | lang6 symbol | lang7 | lang7 symbol | lang8 | lang8 symbol | lang9 | lang9 symbol | lang10 | lang10 symbol | lang11 | lang11 symbol | lang12 | lang12 symbol | lang13 | lang13 symbol | lang14 | lang14 symbol | lang15 | lang15 symbol | lang16 | lang16 symbol | lang17 | lang17 symbol | lang18 | lang18 symbol | lang19 | lang19 symbol | lang20 | lang20 symbol | lang21 | lang21 symbol | lang22 | lang22 symbol | lang23 | lang23 symbol | lang24 | lang24 symbol | lang25 | lang25 symbol | lang26 | lang26 symbol | lang27 | lang27 symbol | lang28 | lang28 symbol | lang29 | lang29 symbol | lang30 | lang30 symbol | latin prefix | Latin prefix | number | numeral | old english prefix | Old English prefix | ordinal | ordinal text | prime | roman | Roman | roman unicode | Roman unicode | unicode }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
1gy0ap4n5xehx1m4bldtb3e65segl2u
17049
17047
2026-07-05T05:39:15Z
Gazartashlomo0907
62
17049
wikitext
text/x-wiki
{{short description|Natural number|noreplace}}{{Infobox number/box
|number={{#if:{{{number<includeonly>|</includeonly>}}}
| {{{number<noinclude>|{{#time:j}}</noinclude>}}}
| {{PAGENAMEBASE}}
}}
| cardinal = {{{Bilangan kardinal|Kardinal}}}
| ordinal = {{{Bilangan ordinal|Ordinal}}}
| ordinal text = {{{Bilangan ordinal na tarsurat|Ordinal na tarsurat}}}
| numeral = {{{Bilangan numeral|Numeral}}}
| factorization = {{{Paktorisasi|Paktorisasi}}}
| gaussian integer factorization = {{{Paktorisasi integral gaussian|{{{gaussian integer factorization|}}}}}}
| prime = {{{prime|}}}
| divisor = {{{divisor|}}}
| base 36 = {{{base 36|}}}
| roman = {{{Roman|{{{roman|}}}}}}
| roman unicode = {{{Roman unicode|{{{roman unicode|}}}}}}
| unicode = {{{unicode|}}}
| greek prefix = {{{Greek prefix|{{{greek prefix|}}}}}}
| latin prefix = {{{Latin prefix|{{{latin prefix|}}}}}}
| old english prefix = {{{Old English prefix|{{{old english prefix|}}}}}}
| lang1 = {{{lang1|}}}
| lang1 symbol = {{{lang1 symbol|}}}
| lang2 = {{{lang2|}}}
| lang2 symbol = {{{lang2 symbol|}}}
| lang3 = {{{lang3|}}}
| lang3 symbol = {{{lang3 symbol|}}}
| lang4 = {{{lang4|}}}
| lang4 symbol = {{{lang4 symbol|}}}
| lang5 = {{{lang5|}}}
| lang5 symbol = {{{lang5 symbol|}}}
| lang6 = {{{lang6|}}}
| lang6 symbol = {{{lang6 symbol|}}}
| lang7 = {{{lang7|}}}
| lang7 symbol = {{{lang7 symbol|}}}
| lang8 = {{{lang8|}}}
| lang8 symbol = {{{lang8 symbol|}}}
| lang9 = {{{lang9|}}}
| lang9 symbol = {{{lang9 symbol|}}}
| lang10 = {{{lang10|}}}
| lang10 symbol = {{{lang10 symbol|}}}
| lang11 = {{{lang11|}}}
| lang11 symbol = {{{lang11 symbol|}}}
| lang12 = {{{lang12|}}}
| lang12 symbol = {{{lang12 symbol|}}}
| lang13 = {{{lang13|}}}
| lang13 symbol = {{{lang13 symbol|}}}
| lang14 = {{{lang14|}}}
| lang14 symbol = {{{lang14 symbol|}}}
| lang15 = {{{lang15|}}}
| lang15 symbol = {{{lang15 symbol|}}}
| lang16 = {{{lang16|}}}
| lang16 symbol = {{{lang16 symbol|}}}
| lang17 = {{{lang17|}}}
| lang17 symbol = {{{lang17 symbol|}}}
| lang18 = {{{lang18|}}}
| lang18 symbol = {{{lang18 symbol|}}}
| lang19 = {{{lang19|}}}
| lang19 symbol = {{{lang19 symbol|}}}
| lang20 = {{{lang20|}}}
| lang20 symbol = {{{lang20 symbol|}}}
| lang21 = {{{lang21|}}}
| lang21 symbol = {{{lang21 symbol|}}}
| lang22 = {{{lang22|}}}
| lang22 symbol = {{{lang22 symbol|}}}
| lang23 = {{{lang23|}}}
| lang23 symbol = {{{lang23 symbol|}}}
| lang24 = {{{lang24|}}}
| lang24 symbol = {{{lang24 symbol|}}}
| lang25 = {{{lang25|}}}
| lang25 symbol = {{{lang25 symbol|}}}
| lang26 = {{{lang26|}}}
| lang26 symbol = {{{lang26 symbol|}}}
| lang27 = {{{lang27|}}}
| lang27 symbol = {{{lang27 symbol|}}}
| lang28 = {{{lang28|}}}
| lang28 symbol = {{{lang28 symbol|}}}
| lang29 = {{{lang29|}}}
| lang29 symbol = {{{lang29 symbol|}}}
| lang30 = {{{lang30|}}}
| lang30 symbol = {{{lang30 symbol|}}}
}}{{#if:{{{prime|}}}|[[Category:Pages using infobox number with prime parameter]]}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox number with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox number]] with unknown parameter "_VALUE_"|ignoreblank=y| base 36 | cardinal | divisor | factorization | gaussian integer factorization | Gaussian integer factorization | greek prefix | Greek prefix | lang1 | lang1 symbol | lang2 | lang2 symbol | lang3 | lang3 symbol | lang4 | lang4 symbol | lang5 | lang5 symbol | lang6 | lang6 symbol | lang7 | lang7 symbol | lang8 | lang8 symbol | lang9 | lang9 symbol | lang10 | lang10 symbol | lang11 | lang11 symbol | lang12 | lang12 symbol | lang13 | lang13 symbol | lang14 | lang14 symbol | lang15 | lang15 symbol | lang16 | lang16 symbol | lang17 | lang17 symbol | lang18 | lang18 symbol | lang19 | lang19 symbol | lang20 | lang20 symbol | lang21 | lang21 symbol | lang22 | lang22 symbol | lang23 | lang23 symbol | lang24 | lang24 symbol | lang25 | lang25 symbol | lang26 | lang26 symbol | lang27 | lang27 symbol | lang28 | lang28 symbol | lang29 | lang29 symbol | lang30 | lang30 symbol | latin prefix | Latin prefix | number | numeral | old english prefix | Old English prefix | ordinal | ordinal text | prime | roman | Roman | roman unicode | Roman unicode | unicode }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
pqxa3u9mz1egmau0cxvyi2p14xl1xeb
17070
17049
2026-07-05T06:28:02Z
Gazartashlomo0907
62
17070
wikitext
text/x-wiki
{{short description|Natural number|noreplace}}{{Infobox number/box
|number={{#if:{{{number<includeonly>|</includeonly>}}}
| {{{number<noinclude>|{{#time:j}}</noinclude>}}}
| {{PAGENAMEBASE}}
}}
| cardinal = {{{Bilangan kardinal|}}}
| ordinal = {{{Bilangan ordinal|}}}
| ordinal text = {{{Bilangan ordinal na tarsurat|}}}
| numeral = {{{Bilangan numeral|}}}
| factorization = {{{Paktorisasi|}}}
| gaussian integer factorization = {{{Paktorisasi integral gaussian|{{{gaussian integer factorization|}}}}}}
| prime = {{{prime|}}}
| divisor = {{{divisor|}}}
| base 36 = {{{base 36|}}}
| roman = {{{Roman|{{{roman|}}}}}}
| roman unicode = {{{Roman unicode|{{{roman unicode|}}}}}}
| unicode = {{{unicode|}}}
| greek prefix = {{{Greek prefix|{{{greek prefix|}}}}}}
| latin prefix = {{{Latin prefix|{{{latin prefix|}}}}}}
| old english prefix = {{{Old English prefix|{{{old english prefix|}}}}}}
| lang1 = {{{lang1|}}}
| lang1 symbol = {{{lang1 symbol|}}}
| lang2 = {{{lang2|}}}
| lang2 symbol = {{{lang2 symbol|}}}
| lang3 = {{{lang3|}}}
| lang3 symbol = {{{lang3 symbol|}}}
| lang4 = {{{lang4|}}}
| lang4 symbol = {{{lang4 symbol|}}}
| lang5 = {{{lang5|}}}
| lang5 symbol = {{{lang5 symbol|}}}
| lang6 = {{{lang6|}}}
| lang6 symbol = {{{lang6 symbol|}}}
| lang7 = {{{lang7|}}}
| lang7 symbol = {{{lang7 symbol|}}}
| lang8 = {{{lang8|}}}
| lang8 symbol = {{{lang8 symbol|}}}
| lang9 = {{{lang9|}}}
| lang9 symbol = {{{lang9 symbol|}}}
| lang10 = {{{lang10|}}}
| lang10 symbol = {{{lang10 symbol|}}}
| lang11 = {{{lang11|}}}
| lang11 symbol = {{{lang11 symbol|}}}
| lang12 = {{{lang12|}}}
| lang12 symbol = {{{lang12 symbol|}}}
| lang13 = {{{lang13|}}}
| lang13 symbol = {{{lang13 symbol|}}}
| lang14 = {{{lang14|}}}
| lang14 symbol = {{{lang14 symbol|}}}
| lang15 = {{{lang15|}}}
| lang15 symbol = {{{lang15 symbol|}}}
| lang16 = {{{lang16|}}}
| lang16 symbol = {{{lang16 symbol|}}}
| lang17 = {{{lang17|}}}
| lang17 symbol = {{{lang17 symbol|}}}
| lang18 = {{{lang18|}}}
| lang18 symbol = {{{lang18 symbol|}}}
| lang19 = {{{lang19|}}}
| lang19 symbol = {{{lang19 symbol|}}}
| lang20 = {{{lang20|}}}
| lang20 symbol = {{{lang20 symbol|}}}
| lang21 = {{{lang21|}}}
| lang21 symbol = {{{lang21 symbol|}}}
| lang22 = {{{lang22|}}}
| lang22 symbol = {{{lang22 symbol|}}}
| lang23 = {{{lang23|}}}
| lang23 symbol = {{{lang23 symbol|}}}
| lang24 = {{{lang24|}}}
| lang24 symbol = {{{lang24 symbol|}}}
| lang25 = {{{lang25|}}}
| lang25 symbol = {{{lang25 symbol|}}}
| lang26 = {{{lang26|}}}
| lang26 symbol = {{{lang26 symbol|}}}
| lang27 = {{{lang27|}}}
| lang27 symbol = {{{lang27 symbol|}}}
| lang28 = {{{lang28|}}}
| lang28 symbol = {{{lang28 symbol|}}}
| lang29 = {{{lang29|}}}
| lang29 symbol = {{{lang29 symbol|}}}
| lang30 = {{{lang30|}}}
| lang30 symbol = {{{lang30 symbol|}}}
}}{{#if:{{{prime|}}}|[[Category:Pages using infobox number with prime parameter]]}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox number with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox number]] with unknown parameter "_VALUE_"|ignoreblank=y| base 36 | cardinal | divisor | factorization | gaussian integer factorization | Gaussian integer factorization | greek prefix | Greek prefix | lang1 | lang1 symbol | lang2 | lang2 symbol | lang3 | lang3 symbol | lang4 | lang4 symbol | lang5 | lang5 symbol | lang6 | lang6 symbol | lang7 | lang7 symbol | lang8 | lang8 symbol | lang9 | lang9 symbol | lang10 | lang10 symbol | lang11 | lang11 symbol | lang12 | lang12 symbol | lang13 | lang13 symbol | lang14 | lang14 symbol | lang15 | lang15 symbol | lang16 | lang16 symbol | lang17 | lang17 symbol | lang18 | lang18 symbol | lang19 | lang19 symbol | lang20 | lang20 symbol | lang21 | lang21 symbol | lang22 | lang22 symbol | lang23 | lang23 symbol | lang24 | lang24 symbol | lang25 | lang25 symbol | lang26 | lang26 symbol | lang27 | lang27 symbol | lang28 | lang28 symbol | lang29 | lang29 symbol | lang30 | lang30 symbol | latin prefix | Latin prefix | number | numeral | old english prefix | Old English prefix | ordinal | ordinal text | prime | roman | Roman | roman unicode | Roman unicode | unicode }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
i0f2h2k49mapjre5mwg5iwcaqbh18lu
17077
17070
2026-07-05T06:46:41Z
Gazartashlomo0907
62
17077
wikitext
text/x-wiki
{{short description|Natural number|noreplace}}{{Infobox number/box
|number={{#if:{{{number<includeonly>|</includeonly>}}}
| {{{number<noinclude>|{{#time:j}}</noinclude>}}}
| {{PAGENAMEBASE}}
}}
| cardinal = {{{Bilangan kardinal|}}}
| ordinal = {{{Bilangan ordinal|}}}
| ordinal text =
| numeral = {{{Bilangan numeral|}}}
| factorization = {{{Paktorisasi|}}}
| gaussian integer factorization = {{{Paktorisasi integral gaussian|{{{gaussian integer factorization|}}}}}}
| prime = {{{prime|}}}
| divisor = {{{divisor|}}}
| base 36 = {{{base 36|}}}
| roman = {{{Roman|{{{roman|}}}}}}
| roman unicode = {{{Roman unicode|{{{roman unicode|}}}}}}
| unicode = {{{unicode|}}}
| greek prefix = {{{Greek prefix|{{{greek prefix|}}}}}}
| latin prefix = {{{Latin prefix|{{{latin prefix|}}}}}}
| old english prefix = {{{Old English prefix|{{{old english prefix|}}}}}}
| lang1 = {{{lang1|}}}
| lang1 symbol = {{{lang1 symbol|}}}
| lang2 = {{{lang2|}}}
| lang2 symbol = {{{lang2 symbol|}}}
| lang3 = {{{lang3|}}}
| lang3 symbol = {{{lang3 symbol|}}}
| lang4 = {{{lang4|}}}
| lang4 symbol = {{{lang4 symbol|}}}
| lang5 = {{{lang5|}}}
| lang5 symbol = {{{lang5 symbol|}}}
| lang6 = {{{lang6|}}}
| lang6 symbol = {{{lang6 symbol|}}}
| lang7 = {{{lang7|}}}
| lang7 symbol = {{{lang7 symbol|}}}
| lang8 = {{{lang8|}}}
| lang8 symbol = {{{lang8 symbol|}}}
| lang9 = {{{lang9|}}}
| lang9 symbol = {{{lang9 symbol|}}}
| lang10 = {{{lang10|}}}
| lang10 symbol = {{{lang10 symbol|}}}
| lang11 = {{{lang11|}}}
| lang11 symbol = {{{lang11 symbol|}}}
| lang12 = {{{lang12|}}}
| lang12 symbol = {{{lang12 symbol|}}}
| lang13 = {{{lang13|}}}
| lang13 symbol = {{{lang13 symbol|}}}
| lang14 = {{{lang14|}}}
| lang14 symbol = {{{lang14 symbol|}}}
| lang15 = {{{lang15|}}}
| lang15 symbol = {{{lang15 symbol|}}}
| lang16 = {{{lang16|}}}
| lang16 symbol = {{{lang16 symbol|}}}
| lang17 = {{{lang17|}}}
| lang17 symbol = {{{lang17 symbol|}}}
| lang18 = {{{lang18|}}}
| lang18 symbol = {{{lang18 symbol|}}}
| lang19 = {{{lang19|}}}
| lang19 symbol = {{{lang19 symbol|}}}
| lang20 = {{{lang20|}}}
| lang20 symbol = {{{lang20 symbol|}}}
| lang21 = {{{lang21|}}}
| lang21 symbol = {{{lang21 symbol|}}}
| lang22 = {{{lang22|}}}
| lang22 symbol = {{{lang22 symbol|}}}
| lang23 = {{{lang23|}}}
| lang23 symbol = {{{lang23 symbol|}}}
| lang24 = {{{lang24|}}}
| lang24 symbol = {{{lang24 symbol|}}}
| lang25 = {{{lang25|}}}
| lang25 symbol = {{{lang25 symbol|}}}
| lang26 = {{{lang26|}}}
| lang26 symbol = {{{lang26 symbol|}}}
| lang27 = {{{lang27|}}}
| lang27 symbol = {{{lang27 symbol|}}}
| lang28 = {{{lang28|}}}
| lang28 symbol = {{{lang28 symbol|}}}
| lang29 = {{{lang29|}}}
| lang29 symbol = {{{lang29 symbol|}}}
| lang30 = {{{lang30|}}}
| lang30 symbol = {{{lang30 symbol|}}}
}}{{#if:{{{prime|}}}|[[Category:Pages using infobox number with prime parameter]]}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox number with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox number]] with unknown parameter "_VALUE_"|ignoreblank=y| base 36 | cardinal | divisor | factorization | gaussian integer factorization | Gaussian integer factorization | greek prefix | Greek prefix | lang1 | lang1 symbol | lang2 | lang2 symbol | lang3 | lang3 symbol | lang4 | lang4 symbol | lang5 | lang5 symbol | lang6 | lang6 symbol | lang7 | lang7 symbol | lang8 | lang8 symbol | lang9 | lang9 symbol | lang10 | lang10 symbol | lang11 | lang11 symbol | lang12 | lang12 symbol | lang13 | lang13 symbol | lang14 | lang14 symbol | lang15 | lang15 symbol | lang16 | lang16 symbol | lang17 | lang17 symbol | lang18 | lang18 symbol | lang19 | lang19 symbol | lang20 | lang20 symbol | lang21 | lang21 symbol | lang22 | lang22 symbol | lang23 | lang23 symbol | lang24 | lang24 symbol | lang25 | lang25 symbol | lang26 | lang26 symbol | lang27 | lang27 symbol | lang28 | lang28 symbol | lang29 | lang29 symbol | lang30 | lang30 symbol | latin prefix | Latin prefix | number | numeral | old english prefix | Old English prefix | ordinal | ordinal text | prime | roman | Roman | roman unicode | Roman unicode | unicode }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
3eszt0vngsryclod349wdlu324d4xlv
17078
17077
2026-07-05T06:47:49Z
Gazartashlomo0907
62
17078
wikitext
text/x-wiki
{{short description|Natural number|noreplace}}{{Infobox number/box
|number={{#if:{{{number<includeonly>|</includeonly>}}}
| {{{number<noinclude>|{{#time:j}}</noinclude>}}}
| {{PAGENAMEBASE}}
}}
| cardinal = {{{Bilangan kardinal|}}}
| ordinal = {{{Bilangan ordinal|}}}
| numeral = {{{Bilangan numeral|}}}
| factorization = {{{Paktorisasi|}}}
| gaussian integer factorization = {{{Paktorisasi integral gaussian|{{{gaussian integer factorization|}}}}}}
| prime = {{{prime|}}}
| divisor = {{{divisor|}}}
| base 36 = {{{base 36|}}}
| roman = {{{Roman|{{{roman|}}}}}}
| roman unicode = {{{Roman unicode|{{{roman unicode|}}}}}}
| unicode = {{{unicode|}}}
| greek prefix = {{{Greek prefix|{{{greek prefix|}}}}}}
| latin prefix = {{{Latin prefix|{{{latin prefix|}}}}}}
| old english prefix = {{{Old English prefix|{{{old english prefix|}}}}}}
| lang1 = {{{lang1|}}}
| lang1 symbol = {{{lang1 symbol|}}}
| lang2 = {{{lang2|}}}
| lang2 symbol = {{{lang2 symbol|}}}
| lang3 = {{{lang3|}}}
| lang3 symbol = {{{lang3 symbol|}}}
| lang4 = {{{lang4|}}}
| lang4 symbol = {{{lang4 symbol|}}}
| lang5 = {{{lang5|}}}
| lang5 symbol = {{{lang5 symbol|}}}
| lang6 = {{{lang6|}}}
| lang6 symbol = {{{lang6 symbol|}}}
| lang7 = {{{lang7|}}}
| lang7 symbol = {{{lang7 symbol|}}}
| lang8 = {{{lang8|}}}
| lang8 symbol = {{{lang8 symbol|}}}
| lang9 = {{{lang9|}}}
| lang9 symbol = {{{lang9 symbol|}}}
| lang10 = {{{lang10|}}}
| lang10 symbol = {{{lang10 symbol|}}}
| lang11 = {{{lang11|}}}
| lang11 symbol = {{{lang11 symbol|}}}
| lang12 = {{{lang12|}}}
| lang12 symbol = {{{lang12 symbol|}}}
| lang13 = {{{lang13|}}}
| lang13 symbol = {{{lang13 symbol|}}}
| lang14 = {{{lang14|}}}
| lang14 symbol = {{{lang14 symbol|}}}
| lang15 = {{{lang15|}}}
| lang15 symbol = {{{lang15 symbol|}}}
| lang16 = {{{lang16|}}}
| lang16 symbol = {{{lang16 symbol|}}}
| lang17 = {{{lang17|}}}
| lang17 symbol = {{{lang17 symbol|}}}
| lang18 = {{{lang18|}}}
| lang18 symbol = {{{lang18 symbol|}}}
| lang19 = {{{lang19|}}}
| lang19 symbol = {{{lang19 symbol|}}}
| lang20 = {{{lang20|}}}
| lang20 symbol = {{{lang20 symbol|}}}
| lang21 = {{{lang21|}}}
| lang21 symbol = {{{lang21 symbol|}}}
| lang22 = {{{lang22|}}}
| lang22 symbol = {{{lang22 symbol|}}}
| lang23 = {{{lang23|}}}
| lang23 symbol = {{{lang23 symbol|}}}
| lang24 = {{{lang24|}}}
| lang24 symbol = {{{lang24 symbol|}}}
| lang25 = {{{lang25|}}}
| lang25 symbol = {{{lang25 symbol|}}}
| lang26 = {{{lang26|}}}
| lang26 symbol = {{{lang26 symbol|}}}
| lang27 = {{{lang27|}}}
| lang27 symbol = {{{lang27 symbol|}}}
| lang28 = {{{lang28|}}}
| lang28 symbol = {{{lang28 symbol|}}}
| lang29 = {{{lang29|}}}
| lang29 symbol = {{{lang29 symbol|}}}
| lang30 = {{{lang30|}}}
| lang30 symbol = {{{lang30 symbol|}}}
}}{{#if:{{{prime|}}}|[[Category:Pages using infobox number with prime parameter]]}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox number with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox number]] with unknown parameter "_VALUE_"|ignoreblank=y| base 36 | cardinal | divisor | factorization | gaussian integer factorization | Gaussian integer factorization | greek prefix | Greek prefix | lang1 | lang1 symbol | lang2 | lang2 symbol | lang3 | lang3 symbol | lang4 | lang4 symbol | lang5 | lang5 symbol | lang6 | lang6 symbol | lang7 | lang7 symbol | lang8 | lang8 symbol | lang9 | lang9 symbol | lang10 | lang10 symbol | lang11 | lang11 symbol | lang12 | lang12 symbol | lang13 | lang13 symbol | lang14 | lang14 symbol | lang15 | lang15 symbol | lang16 | lang16 symbol | lang17 | lang17 symbol | lang18 | lang18 symbol | lang19 | lang19 symbol | lang20 | lang20 symbol | lang21 | lang21 symbol | lang22 | lang22 symbol | lang23 | lang23 symbol | lang24 | lang24 symbol | lang25 | lang25 symbol | lang26 | lang26 symbol | lang27 | lang27 symbol | lang28 | lang28 symbol | lang29 | lang29 symbol | lang30 | lang30 symbol | latin prefix | Latin prefix | number | numeral | old english prefix | Old English prefix | ordinal | ordinal text | prime | roman | Roman | roman unicode | Roman unicode | unicode }}<noinclude>
{{documentation}}<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
6z98l0z8l13n8b1owqzczb9zgkaau6f
Templat:Infobox number/box
10
2983
17048
2026-07-05T05:33:59Z
Gazartashlomo0907
62
Created page with "<includeonly>{{infobox | bodystyle = line-height: 1.2em | abovestyle = font-size: 150% | above = {{#ifexpr:{{{number}}} > 10^6 | {{{number}}} | <table style= "width:100%; margin:0"><tr> <td style= "width:15%; text-align:left; white-space: nowrap; font-size:smaller">{{Infobox number/link|pre=←|number = {{#expr:{{{number}}} - 1 }} }}</td> <td style= "width:70%; padding-left:1em; padding-right:1em; text-align: center;">{{Infobox number/link|plain=yes|number={{{num..."
17048
wikitext
text/x-wiki
<includeonly>{{infobox
| bodystyle = line-height: 1.2em
| abovestyle = font-size: 150%
| above = {{#ifexpr:{{{number}}} > 10^6
| {{{number}}}
| <table style= "width:100%; margin:0"><tr>
<td style= "width:15%; text-align:left; white-space: nowrap; font-size:smaller">{{Infobox number/link|pre=←|number = {{#expr:{{{number}}} - 1 }} }}</td>
<td style= "width:70%; padding-left:1em; padding-right:1em; text-align: center;">{{Infobox number/link|plain=yes|number={{{number}}}}}</td>
<td style= "width:15%; text-align:right; white-space: nowrap; font-size:smaller">{{Infobox number/link|post=→|number = {{#expr:{{{number}}} + 1 }} }}</td>
</tr></table>
}}
| labelstyle = font-weight:normal
| subheaderstyle = font-size:100%;
| subheader = {{Infobox number/range|{{{number}}}}}
| label1 = [[Cardinal numeral|Cardinal]]
| data1 = {{#if: {{{cardinal|}}} | {{{cardinal}}} | {{#invoke:ConvertNumeric|numeral_to_english|{{{number}}}|sp=us}} }}
| label2 = [[Ordinal numeral|Ordinal]]
| data2 = {{#if: {{{ordinal|}}} | {{{ordinal}}} | {{Ordinal|{{{number}}}}}<br />({{#if:{{{ordinal text|}}}|{{{ordinal text}}}|{{#invoke:convertNumeric|numeral_to_english|{{{number}}}|ord=on|sp=us}} }})}}
| label3 = [[Numeral system]]
| data3 = {{{numeral|}}}
| label4 = [[Factorization]]
| data4 = {{#if:{{{factorization|}}}|{{{factorization}}}|{{#ifexpr:{{{number}}} > 1 and {{{number}}} < 1000000000| {{#invoke:Factorization|factor|{{{number}}}|prime=y|product=×}} }} }}
| label5 = [[Gaussian integer]] factorization
| data5 = {{{gaussian integer factorization|}}}
| label6 = [[prime number|Prime]]
| data6 = {{{prime|}}}
| label7 = [[Divisor]]s
| data7 = {{{divisor|}}}
| label8 = [[Greek numerals|Greek numeral]]
| data8 = {{#if:{{{greek|}}}|{{{greek}}}| {{#ifexpr: {{{number}}} >= 1 | {{Greek numeral|{{{number}}}|}} }} }}
| label9 = [[Roman numerals|Roman numeral]]
| data9 = {{#if:{{{roman|}}}|{{{roman}}}| {{#ifexpr: {{{number}}} >= 1 | {{rn|{{Roman|{{{number}}}|}}}}, {{rn|{{lc:{{Roman|{{{number}}}|}}}}}} }} }}
| label10 = Roman numeral ([[unicode]])
| data10 = {{{roman unicode|}}}
| label11 = [[Unicode]] symbol{{pluralize from text|{{{unicode|}}}|likely=(s)|plural=s}}
| data11 = {{{unicode|}}}
| label12 = [[Greek language|Greek]] [[Numeral prefix|prefix]]
| data12 = {{{greek prefix|}}}
| label13 = [[Latin]] [[Numeral prefix|prefix]]
| data13 = {{{latin prefix|}}}
| label14 = [[Old English]] [[Numeral prefix|prefix]]
| data14 = {{{old english prefix|}}}
| label15 = [[Binary number|Binary]]
| data15 = {{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to2|{{{number}}}}}<sub>2</sub>}}
| label16 = [[Ternary numeral system|Ternary]]
| data16 = {{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to3|{{{number}}}}}<sub>3</sub>}}
| label17 = [[Senary]]
| data17 = {{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to6|{{{number}}}}}<sub>6</sub>}}
| label20 = [[Octal]]
| data20 = {{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to8|{{{number}}}}}<sub>8</sub>}}
| label21 = [[Duodecimal]]
| data21 = {{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to12|{{{number}}}}}<sub>12</sub>}}
| label22 = [[Hexadecimal]]
| data22 = {{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to16|{{{number}}}}}<sub>16</sub>}}
| label24 = {{#if:{{{base 36|}}}|[[Base 36]]}}
| data24 = {{#if:{{{base 36|}}}|{{#ifexpr: ({{{number}}} >= 0) and ({{{number}}} <= 9007199254740991) | {{#invoke:BaseConvert|10to36|{{{number}}}}}<sub>36</sub>}}}}
| label32 = {{{lang1}}}
| data32 = {{#if:{{{lang1|}}}|{{{lang1 symbol|}}}}}
| label33 = {{{lang2}}}
| data33 = {{#if:{{{lang2|}}}|{{{lang2 symbol|}}}}}
| label34 = {{{lang3}}}
| data34 = {{#if:{{{lang3|}}}|{{{lang3 symbol|}}}}}
| label35 = {{{lang4}}}
| data35 = {{#if:{{{lang4|}}}|{{{lang4 symbol|}}}}}
| label36 = {{{lang5}}}
| data36 = {{#if:{{{lang5|}}}|{{{lang5 symbol|}}}}}
| label37 = {{{lang6}}}
| data37 = {{#if:{{{lang6|}}}|{{{lang6 symbol|}}}}}
| label38 = {{{lang7}}}
| data38 = {{#if:{{{lang7|}}}|{{{lang7 symbol|}}}}}
| label39 = {{{lang8}}}
| data39 = {{#if:{{{lang8|}}}|{{{lang8 symbol|}}}}}
| label40 = {{{lang9}}}
| data40 = {{#if:{{{lang9|}}}|{{{lang9 symbol|}}}}}
| label41 = {{{lang10}}}
| data41 = {{#if:{{{lang10|}}}|{{{lang10 symbol|}}}}}
| label42 = {{{lang11}}}
| data42 = {{#if:{{{lang11|}}}|{{{lang11 symbol|}}}}}
| label43 = {{{lang12}}}
| data43 = {{#if:{{{lang12|}}}|{{{lang12 symbol|}}}}}
| label44 = {{{lang13}}}
| data44 = {{#if:{{{lang13|}}}|{{{lang13 symbol|}}}}}
| label45 = {{{lang14}}}
| data45 = {{#if:{{{lang14|}}}|{{{lang14 symbol|}}}}}
| label46 = {{{lang15}}}
| data46 = {{#if:{{{lang15|}}}|{{{lang15 symbol|}}}}}
| label47 = {{{lang16}}}
| data47 = {{#if:{{{lang16|}}}|{{{lang16 symbol|}}}}}
| label48 = {{{lang17}}}
| data48 = {{#if:{{{lang17|}}}|{{{lang17 symbol|}}}}}
| label49 = {{{lang18}}}
| data49 = {{#if:{{{lang18|}}}|{{{lang18 symbol|}}}}}
| label50 = {{{lang19}}}
| data50 = {{#if:{{{lang19|}}}|{{{lang19 symbol|}}}}}
| label51 = {{{lang20}}}
| data51 = {{#if:{{{lang20|}}}|{{{lang20 symbol|}}}}}
| label52 = {{{lang21}}}
| data52 = {{#if:{{{lang21|}}}|{{{lang21 symbol|}}}}}
| label53 = {{{lang22}}}
| data53 = {{#if:{{{lang22|}}}|{{{lang22 symbol|}}}}}
| label54 = {{{lang23}}}
| data54 = {{#if:{{{lang23|}}}|{{{lang23 symbol|}}}}}
| label55 = {{{lang24}}}
| data55 = {{#if:{{{lang24|}}}|{{{lang24 symbol|}}}}}
| label56 = {{{lang25}}}
| data56 = {{#if:{{{lang25|}}}|{{{lang25 symbol|}}}}}
| label57 = {{{lang26}}}
| data57 = {{#if:{{{lang26|}}}|{{{lang26 symbol|}}}}}
| label58 = {{{lang27}}}
| data58 = {{#if:{{{lang27|}}}|{{{lang27 symbol|}}}}}
| label59 = {{{lang28}}}
| data59 = {{#if:{{{lang28|}}}|{{{lang28 symbol|}}}}}
| label60 = {{{lang29}}}
| data60 = {{#if:{{{lang29|}}}|{{{lang29 symbol|}}}}}
| label61 = {{{lang30}}}
| data61 = {{#if:{{{lang30|}}}|{{{lang30 symbol|}}}}}
}}</includeonly><noinclude>
{{documentation|content=
This subtemplate is used to generate the infobox for {{tl|infobox number}}. By using a subtemplate, it reduces the repetition in the code by using a single computation of the value for {{para|number}} by {{tl|infobox number}}, which is passed to this subtemplate. This subtemplate should be used only by {{tl|infobox number}}, and not directly.
}}
</noinclude>
bt8hh81dtkurdyx8zn2ub1rlbhevj5v
Modul:BaseConvert
0
2985
17052
2026-07-05T05:50:28Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[Modul:BaseConvert]] tu [[Module:BaseConvert]]
17052
wikitext
text/x-wiki
#REDIRECT [[Module:BaseConvert]]
71nijp7q56brjnvgvv89agg4k6ry8p6
Modul:Tree chart
0
2986
17054
2026-07-05T05:52:16Z
Gazartashlomo0907
62
Gazartashlomo0907 papindahon alaman [[Modul:Tree chart]] tu [[Module:Tree chart]]
17054
wikitext
text/x-wiki
#REDIRECT [[Module:Tree chart]]
tt56tdnkz9mn8yss3r3wjnsnv6iymf5
Module:IPA
828
2987
17055
2026-07-05T05:53:40Z
Gazartashlomo0907
62
Created page with "require('strict') local p = {} local function multiFind(s, patterns, init) local i, j = mw.ustring.find(s, patterns[1], init) for n = 2, #patterns do local i2, j2 = mw.ustring.find(s, patterns[n], init) if i2 and (not i or i2 < i) then i, j = i2, j2 end end return i, j end local function wrapAtSpaces(s) return mw.ustring.gsub(s, '(%s+)', '<span class="wrap">%1</span>') end local function wrapAtSpacesSafely(s) local patterns = { '%[%[[^%]|]-%s[^%]|]-|'..."
17055
Scribunto
text/plain
require('strict')
local p = {}
local function multiFind(s, patterns, init)
local i, j = mw.ustring.find(s, patterns[1], init)
for n = 2, #patterns do
local i2, j2 = mw.ustring.find(s, patterns[n], init)
if i2 and (not i or i2 < i) then
i, j = i2, j2
end
end
return i, j
end
local function wrapAtSpaces(s)
return mw.ustring.gsub(s, '(%s+)', '<span class="wrap">%1</span>')
end
local function wrapAtSpacesSafely(s)
local patterns = {
'%[%[[^%]|]-%s[^%]|]-|', -- Piped links
'</?[A-Za-z][^>]-%s[^>]->' -- HTML tags
}
s = mw.ustring.gsub(s, '%[%[([^%]|]-%s[^%]|]-)%]%]', '[[%1|%1]]') -- Pipe all links
local t = {}
local init
while true do
local i, j = multiFind(s, patterns, init)
if not i then
break
end
local pre = wrapAtSpaces(mw.ustring.sub(s, init, i - 1)) -- What precedes the match
table.insert(t, pre)
table.insert(t, mw.ustring.sub(s, i, j)) -- The match
init = j + 1
end
local post = wrapAtSpaces(mw.ustring.sub(s, init)) -- What follows the last match
table.insert(t, post)
return table.concat(t)
end
local function checkNamespace(isDebug)
return isDebug or require('Module:Category handler').main({ true })
end
local function renderCats(cats, isDebug)
if not cats[1] or not checkNamespace(isDebug) then
return ''
end
local t = {}
for _, v in ipairs(cats) do
table.insert(t, string.format(
'[[%sCategory:%s]]',
isDebug and ':' or '',
v
))
end
return table.concat(t)
end
local function resolveSynonym(s)
return mw.loadData('Module:Lang/ISO 639 synonyms')[s] or s
end
local function getLangName(code, link)
return require('Module:Lang')._name_from_tag({
code,
link = link,
-- Without linking, "{{IPA}}" gets expanded in some contexts
template = '[[Template:IPA|IPA]]'
})
end
local function linkLang(name, target, link)
return link == 'yes' and string.format(
'[[%s|%s]]',
target or name .. ' language',
name
) or name
end
function p._main(args)
local ret, cats = {}, {}
local isDebug = args.debug == 'yes'
local s, langCode, isPrivate, fullLangCode
-- Guide-linking mode
if args[2] and args[2] ~= '' then
local data = mw.loadData('Module:IPA/data')
local isGeneric = args.generic == 'yes'
s = args[2]
-- Split tag into language and region codes
langCode = args[1]:gsub('%-.*', ''):lower()
langCode = resolveSynonym(langCode)
local regionCode = args[1]:match('%-(.+)')
local langData = data.langs[langCode] or {}
if regionCode then
isPrivate = regionCode:sub(1, 2) == 'x-'
if not isPrivate then
regionCode = regionCode:upper()
end
if langData.dialects and langData.dialects[regionCode] then
-- Overwrite language data with the dialect's
local newLangData = {}
for k, v in pairs(langData) do
if k ~= 'dialects' then
newLangData[k] = v
end
end
local dialectData = langData.dialects[regionCode]
if dialectData.aliasOf then
-- Use the canonical region code
regionCode = dialectData.aliasOf
dialectData = langData.dialects[regionCode]
end
-- Lowercase IANA variant
if dialectData.isVariant then
regionCode = regionCode:lower()
end
for k, v in pairs(dialectData) do
newLangData[k] = v
end
langData = newLangData
else
isGeneric = true
end
fullLangCode = langCode .. '-' .. regionCode
else
fullLangCode = langCode
end
local langName = langData.name
and linkLang(langData.name, langData.link, args.link)
or getLangName(fullLangCode, args.link)
if langName:sub(1, 5) == '<span' then
-- Module:Lang has returned an error
return langName .. renderCats({ 'IPA template errors' }, isDebug)
end
if args.cat ~= 'no' then
local catLangName = args.link == 'yes'
and mw.ustring.match(langName, '([^%[|%]]+)%]%]$')
or langName
table.insert(cats, string.format('Halaman dengan teks IPA berbahasa %s', catLangName))
end
-- Label
local label = args.label
if not label then
local labelCode = args[3] and args[3]:lower()
or langData.defaultLabelCode
if labelCode == '' then
label = ''
else
local langText
if langData.text then
langText = linkLang(
langData.text,
mw.ustring.match(langName, '^%[%[([^|%]]+)'),
args.link
)
else
langText = mw.ustring.gsub(
langName,
'^%[%[(([^|]+) languages)%]%]$',
'[[%1|%2]]'
)
langText = mw.ustring.gsub(
langText,
' languages(%]?%]?)$',
'%1'
)
end
if labelCode and data.labels[labelCode] then
label = data.labels[labelCode]:format(langText)
else
label = data.defaultLabel:format(langText)
end
end
end
if label and label ~= '' then
local span = mw.html.create('span')
:addClass('IPA-label')
:wikitext(label)
if args.small ~= 'no' then
span:addClass('IPA-label-small')
table.insert(ret, mw.getCurrentFrame():extensionTag({
name = 'templatestyles',
args = { src = 'Module:IPA/styles.css' }
}))
end
table.insert(ret, tostring(span) .. ' ')
end
-- Brackets
s = (not isGeneric and langData.format or '[%s]'):format(s)
-- Link to key
local key = not isGeneric and langData.key or data.defaultKey
s = string.format('[[%s|%s]]', key, s)
else
-- Basic mode
s = args[1]
if args.cat ~= 'no' then
table.insert(cats, 'Halaman dengan teks IPA polos')
end
end
-- Transcription
do
local lang = isPrivate and langCode or fullLangCode or
args.lang ~= '' and args.lang or 'und'
local span = mw.html.create('span')
:addClass('IPA')
:addClass(args.class)
:attr('lang', lang .. '-Latn-fonipa')
-- wrap=all: Do nothing
-- wrap=none: Never break
-- Otherwise: Break at spaces only
if args.wrap ~= 'all' then
span:addClass('nowrap')
if args.wrap ~= 'none' then
s = wrapAtSpacesSafely(s)
end
end
if (not args[2] or args[2] == '') and args.tooltip ~= '' then
local tooltip = args.tooltip or
'Representation in the International Phonetic Alphabet (IPA)'
span:attr('title', tooltip)
end
s = tostring(span:wikitext(s))
table.insert(ret, s)
end
-- Audio
local audio = args.audio ~= '' and args.audio or args[4] ~= '' and args[4]
if audio then
local button = mw.getCurrentFrame():expandTemplate({
title = 'Audio',
args = { audio, '' }
})
table.insert(ret, ' ' .. button)
table.insert(cats, 'Halaman dengan sampel pelafalan')
end
-- Categories
table.insert(ret, renderCats(cats, isDebug))
return table.concat(ret)
end
function p.main(frame)
local args = frame:getParent().args
if not args[1] then
return ''
end
for i, v in ipairs(args) do
args[i] = mw.text.trim(v)
end
return p._main(args)
end
return p
2tl8p3k7svoyo6v9xaxb81ccn0hwlk5
Module:Tree chart
828
2988
17056
2026-07-05T05:55:08Z
Gazartashlomo0907
62
Created page with "require('strict') local p = {} local cells = mw.loadData('Modul:Tree chart/data') function p._main(cell_args) local ret = mw.html.create() local top = ret:tag('tr') :css{ height = '1px', ['text-align'] = 'center' } local bottom = ret:tag('tr') :css{ height = '1px', ['text-align'] = 'center' } for _, v in ipairs(cell_args) do if type(v) == 'string' then top:wikitext(cells[v].t) bottom:wikitext(cells[v].b) else top:tag('td')..."
17056
Scribunto
text/plain
require('strict')
local p = {}
local cells = mw.loadData('Modul:Tree chart/data')
function p._main(cell_args)
local ret = mw.html.create()
local top = ret:tag('tr')
:css{ height = '1px',
['text-align'] = 'center' }
local bottom = ret:tag('tr')
:css{ height = '1px',
['text-align'] = 'center' }
for _, v in ipairs(cell_args) do
if type(v) == 'string' then
top:wikitext(cells[v].t)
bottom:wikitext(cells[v].b)
else
top:tag('td')
:attr{ colspan = v.colspan or cell_args.colspan or 6,
rowspan = v.rowspan or cell_args.rowspan or 2 }
:css{ padding = '0.2em',
border = (v.border or cell_args.border or '2') .. 'px solid black' }
:cssText(v.boxstyle or cell_args.boxstyle)
:wikitext(v.text)
end
end
return tostring(ret)
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Tree chart', trim = false, removeBlanks = false})
local cell_args = {
colspan = args.colspan,
rowspan = args.rowspan,
border = args.border,
boxstyle = args.boxstyle
}
for _, val in ipairs(args) do
local trimmedVal = val:match('^%s*(.-)%s*$')
if trimmedVal == '' then
trimmedVal = '$'
end
if cells[trimmedVal] then
table.insert(cell_args, trimmedVal)
else
-- Unnamed params behave weirdly
-- white space at the front counts for param_{{{1}}}, but not whitespace at the end, so remove it
local rightTrimmedVal = val:gsub('%s+$','')
table.insert(cell_args, {
text = args[trimmedVal] or ('{{{'..trimmedVal..'}}}'),
colspan = args['colspan_'..rightTrimmedVal],
rowspan = args['rowspan_'..rightTrimmedVal],
border = args['border_'..rightTrimmedVal],
boxstyle = args['boxstyle_'..rightTrimmedVal]
})
end
end
return p._main(cell_args)
end
return p
alvovtim1vj7iktzbmcyh6x26b1581y
Module:BaseConvert
828
2989
17057
2026-07-05T05:56:12Z
Gazartashlomo0907
62
Created page with "local p = {} local digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' local function normalizeFullWidthChars(s) return mw.ustring.gsub(s, '[!-~]', function(s) return mw.ustring.char(mw.ustring.codepoint(s, 1) - 0xFEE0) end) end local function _convert(n, base, from, precision, width, default, prefix, suffix) n = tostring(n) -- strip off any leading '0x' (unless x is a valid digit in the input base) from = tonumber(from) if not from or from < 34 then local..."
17057
Scribunto
text/plain
local p = {}
local digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
local function normalizeFullWidthChars(s)
return mw.ustring.gsub(s, '[!-~]', function(s)
return mw.ustring.char(mw.ustring.codepoint(s, 1) - 0xFEE0)
end)
end
local function _convert(n, base, from, precision, width, default, prefix, suffix)
n = tostring(n)
-- strip off any leading '0x' (unless x is a valid digit in the input base)
from = tonumber(from)
if not from or from < 34 then
local c
n, c = n:gsub('^(-?)0[Xx]', '%1')
if c > 0 and not from then from = 16 end
end
-- check for a negative sign. Do this while the input is still in string form,
-- because tonumber doesn't support negative numbers in non-10 bases.
local sign = ''
local c
n, c = n:gsub('^-', '')
if c > 0 then sign = '-' end
-- replace any full-width Unicode characters in the string with their ASCII equivalents
n = normalizeFullWidthChars(n)
-- handle scientific notation with whitespace around the 'e' e.g. '5 e7'
n = n:gsub('%s*[eE]%s*', 'e')
from = from or 10
local num = tonumber(n, from)
base = tonumber(base)
precision = tonumber(precision)
width = tonumber(width)
if not num or not base then return default or n end
local i, f = math.modf(num)
local t = {}
repeat
local d = (i % base) + 1
i = math.floor(i / base)
table.insert(t, 1, digits:sub(d, d))
until i == 0
while #t < (width or 0) do
table.insert(t, 1, '0')
end
local intPart = table.concat(t, '')
-- compute the fractional part
local tf = {}
while f > 0 and #tf < (precision or 10) do
f = f * base
i, f = math.modf(f)
table.insert(tf, digits:sub(i + 1, i + 1))
end
-- add trailing zeros if needed
if precision and #tf < precision then
for i = 1, precision - #tf do
table.insert(tf, '0')
end
end
local fracPart = table.concat(tf, '')
-- remove trailing zeros if not needed
if not precision then
fracPart = fracPart:gsub('0*$', '')
end
-- add the radix point if needed
if #fracPart > 0 then
fracPart = '.' .. fracPart
end
return (prefix or '') .. sign .. intPart .. fracPart .. (suffix or '')
end
function p.convert(frame)
-- Allow for invocation via #invoke or directly from another module
local args
if frame == mw.getCurrentFrame() then
args = frame.args
else
args = frame
end
local n = args.n
local base = args.base
local from = args.from
local precision = args.precision
local width = args.width
local default = args.default
local prefix = args.prefix
local suffix = args.suffix
return _convert(n, base, from, precision, width, default, prefix, suffix)
end
setmetatable(p, {
__index = function(t, k)
local from, base = k:match('^([0-9]+)to([0-9]+)$')
if not from then return nil end
return function(frame)
local args = frame.args
return _convert(mw.text.trim(args[1]), base, from, args.precision, args.width,
args.default, args.prefix, args.suffix)
end
end
})
return p
pittardebat8getcpz6hwvf6a7wspqr
Templat:Greek numeral
10
2990
17058
2026-07-05T06:01:25Z
Gazartashlomo0907
62
Created page with "<includeonly>{{#invoke:Greek numeral|to_greek|{{{1|1}}}}}</includeonly><noinclude> {{Documentation}} <!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude>"
17058
wikitext
text/x-wiki
<includeonly>{{#invoke:Greek numeral|to_greek|{{{1|1}}}}}</includeonly><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
t4pnkni3ma2km1uccjh96x6xuud55as
Module:Greek numeral
828
2991
17059
2026-07-05T06:02:38Z
Gazartashlomo0907
62
Created page with "-- Convert standard numbers to greek numerals, and vice versa -- Gts-tg@el wiki, Aug. 2017 local p = {} local greek_numerals = { ["α"] = 1, -- ἄλφα / alpha ["β"] = 2, -- βῆτα / beta ["γ"] = 3, -- γάμμα / gamma ["δ"] = 4, -- δέλτα / delta ["ε"] = 5, -- ἔψιλον / epsilon ["Ϛ"] = 6, -- δίγαμμα / digamma ["ζ"] = 7, -- ζῆτα / zeta ["η"] = 8, -- ῆτα / heta ["θ"] = 9, -- θῆτα..."
17059
Scribunto
text/plain
-- Convert standard numbers to greek numerals, and vice versa
-- Gts-tg@el wiki, Aug. 2017
local p = {}
local greek_numerals = {
["α"] = 1, -- ἄλφα / alpha
["β"] = 2, -- βῆτα / beta
["γ"] = 3, -- γάμμα / gamma
["δ"] = 4, -- δέλτα / delta
["ε"] = 5, -- ἔψιλον / epsilon
["Ϛ"] = 6, -- δίγαμμα / digamma
["ζ"] = 7, -- ζῆτα / zeta
["η"] = 8, -- ῆτα / heta
["θ"] = 9, -- θῆτα / theta
["ι"] = 10, -- ιῶτα / iota
["κ"] = 20, -- κάππα / kappa
["λ"] = 30, -- λάμδα / lamda
["μ"] = 40, -- μῦ / mu
["ν"] = 50, -- νῦ / nu
["ξ"] = 60, -- ξί / xi
["ο"] = 70, -- ὄμικρον / omikron
["π"] = 80, -- πί / pi
["ϟ"] = 90, -- κόππα / koppa
["ρ"] = 100, -- ρό / rho
["σ"] = 200, -- σίγμα / sigma
["ς"] = 200, -- σίγμα / sigma (final variation)
["τ"] = 300, -- ταῦ / ταυ
["υ"] = 400, -- ύψιλον / ypsilon
["φ"] = 500, -- φί / phi
["χ"] = 600, -- χί / chi
["ψ"] = 700, -- ψί / psi
["ω"] = 800, -- ὠμέγα / omega
["ϡ"] = 900, -- σαμπί / sampi
}
-- used for math graph template
local numeral_latin_transliteration = {
["α"] = 'alpha',
["β"] = 'beta',
["γ"] = 'gamma',
["δ"] = 'delta',
["ε"] = 'epsilon',
["Ϛ"] = 'digamma',
["ζ"] = 'zeta',
["η"] = 'eta',
["θ"] = 'theta',
["ι"] = 'iota',
["κ"] = 'kappa',
["λ"] = 'lambda',
["μ"] = 'mu',
["ν"] = 'nu',
["ξ"] = 'xi',
["ο"] = 'omicron',
["π"] = 'pi',
["ϟ"] = 'koppa',
["ρ"] = 'rho',
["σ"] = 'sigma',
["ς"] = 'sigma', --(final variation)
["τ"] = 'tau',
["υ"] = 'upsilon',
["φ"] = 'phi',
["χ"] = 'chi',
["ψ"] = 'psi',
["ω"] = 'omega',
["ϡ"] = 'sampi',
}
-- return number corresponding to letter
-- params: letter (string)
-- return: number
local function value(letter)
if letter ~= 'Ϛ' and letter ~= 'ϟ' and letter ~= 'ϡ' then
letter = mw.ustring.lower(letter)
end
return greek_numerals[letter]
end
-- letter value * 1000
-- params: letter (string), total (number)
-- return: number
local function thousandth(letter, total)
if letter ~= false then
total = total - value(letter) -- remove previous addition as simple number
total = total + ( value(letter) * 1000 )
end
return total
end
-- reverse table (index to values, values to index)
-- params: tbl (table)
-- return: table
local function reverse_table(tbl)
local reversedTable = {}
for letter, value in pairs(tbl) do
reversedTable[value] = letter
end
return reversedTable
end
-- special notation for numbers > 9999
local function mu_notation(greek_number, digits)
local result = ''
local postfix = ''
-- digits greater than 9999
for index, digit in pairs(digits) do
-- mw.log(digit)
result = result .. '\\' .. numeral_latin_transliteration[digit]
greek_number = greek_number:gsub(digit, "", 1)
end
if greek_number ~= '' then -- if not all digits are multiples of myriad
postfix = "͵" .. greek_number .. "´"
end
result = '<math>\\stackrel{' .. result .. '}{\\Mu}</math>' .. postfix
return result
end
-- convert standard number to greek
-- params: frame (obj)
-- return: string
function p.to_greek(frame)
local number = frame.args[1]
local tbl = null
local result = ''
local big_values = {}
local m_notation = false
if tonumber(number) > 9999 then
m_notation = true
end
tbl = reverse_table(greek_numerals) -- reverse to [<number>] = '<letter>'
if tbl[number] ~= null then
result = tbl[number] -- direct hit
else
local str_number = tostring(number)
local highest_numeric_position = #str_number
local i = 0
local index = ''
for digit in str_number:gmatch"." do -- break up number digits
highest_numeric_position = highest_numeric_position - 1
if tonumber(digit) > 0 then
index = tonumber(digit .. mw.ustring.rep('0', highest_numeric_position))
if highest_numeric_position >= 3 then
match = false
while match == false do
if index < 1 then index = index * 10 end
if tbl[index] == nil then
index = index / 10000
else
result = result .. tostring(tbl[tonumber(index)])
match = true
end
end
if highest_numeric_position > 3 then table.insert(big_values, tbl[tonumber(index)]) end
else
result = result .. tostring(tbl[tonumber(index)])
end
end
end
--local d = require "Module:Debugging"
--mw.log(result)
--mw.log(d.dump(big_values))
end
if m_notation == true then --special notation
result = mu_notation(result, big_values)
local frame = mw.getCurrentFrame()
result = frame:preprocess(result)
else
if tonumber(number) >= 1000 then result = ',' .. result end
result = mw.ustring.upper(result) .. "´"
end
return result
end
-- convert greek number to standard
-- greek number sample for testing: αωκα´ = 1821
-- params: frame (obj)
-- return: number
function p.to_standard(frame)
local greek_number = frame.args[1]
local total = 0
local thousand_flag = false
local prev_letter = false
greek_number = greek_number:gsub("´", "")
if type(greek_number) ~= 'string' then
return 'Error: value ' .. greek_number .. ' is ' .. type(greek_number) .. ' instead of expected string'
end
-- iterate through letters
for letter in mw.ustring.gmatch(greek_number, ".") do
-- check if thousand marker exists
if letter == "," then
thousand_flag = true
else
if thousand_flag == true then
total = thousandth(letter, total)
thousand_flag = false
end
total = total + value(letter)
prev_letter = letter
end
end
if thousand_flag == true then
total = thousandth(prev_letter, total)
end
return total
end
return p
1wwb0r15zf76hj8pu0ddjn94b3rkg4h
Templat:Rn
10
2992
17060
2026-07-05T06:04:04Z
Gazartashlomo0907
62
Created page with "{{<includeonly>safesubst:</includeonly>ifsubst|1=|2=<templatestyles src="Roman numeral/styles.css" />}}<span class="roman-numeral {{#if:{{{border|}}}|roman-numeral-{{#switch: {{{border}}} | a | all = a | t | top = t | v | vertical = v | h | horizontal = h | vt | tv | vertical-top | top-vertical = tv }}}}" title="Roman numeral">{{{1}}}</span><noinclude> {{Documentation}} </noinclude>"
17060
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>ifsubst|1=|2=<templatestyles src="Roman numeral/styles.css" />}}<span class="roman-numeral {{#if:{{{border|}}}|roman-numeral-{{#switch: {{{border}}}
| a | all = a
| t | top = t
| v | vertical = v
| h | horizontal = h
| vt | tv | vertical-top | top-vertical = tv
}}}}" title="Roman numeral">{{{1}}}</span><noinclude>
{{Documentation}}
</noinclude>
bkrpddxuyl0aca0yr3oex5kd7h37kr3
Templat:Roman numeral/styles.css
10
2993
17061
2026-07-05T06:04:45Z
Gazartashlomo0907
62
Created page with "/* {{pp-template}} */ .roman-numeral { font-family: "Nimbus Roman No9 L", "Times New Roman", Times, serif; font-size: 118%; line-height: 1; } .roman-numeral-a { border: 1px solid; } .roman-numeral-t { border-top: 1px solid; } .roman-numeral-v { border: solid; border-width: 0 1px; padding: 0 2px; } .roman-numeral-h { border: solid; border-width: 1px 0; } .roman-numeral-tv { border: 1px solid; border-bottom: none; padding: 0 2px; }"
17061
sanitized-css
text/css
/* {{pp-template}} */
.roman-numeral {
font-family: "Nimbus Roman No9 L", "Times New Roman", Times, serif;
font-size: 118%;
line-height: 1;
}
.roman-numeral-a {
border: 1px solid;
}
.roman-numeral-t {
border-top: 1px solid;
}
.roman-numeral-v {
border: solid;
border-width: 0 1px;
padding: 0 2px;
}
.roman-numeral-h {
border: solid;
border-width: 1px 0;
}
.roman-numeral-tv {
border: 1px solid;
border-bottom: none;
padding: 0 2px;
}
lo4ttxrj6apq7b07hjxmxb34routmi1
Templat:Roman
10
2994
17062
2026-07-05T06:09:03Z
Gazartashlomo0907
62
Created page with "{{<includeonly>safesubst:</includeonly>ifsubst|1=|2=<templatestyles src="Roman numeral/styles.css" />}}<span class="roman-numeral {{#if:{{{border|}}}|roman-numeral-{{#switch: {{{border}}} | a | all = a | t | top = t | v | vertical = v | h | horizontal = h | vt | tv | vertical-top | top-vertical = tv }}}}" title="Roman numeral">{{{1}}}</span><noinclude> {{Documentation}} </noinclude>"
17062
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>ifsubst|1=|2=<templatestyles src="Roman numeral/styles.css" />}}<span class="roman-numeral {{#if:{{{border|}}}|roman-numeral-{{#switch: {{{border}}}
| a | all = a
| t | top = t
| v | vertical = v
| h | horizontal = h
| vt | tv | vertical-top | top-vertical = tv
}}}}" title="Roman numeral">{{{1}}}</span><noinclude>
{{Documentation}}
</noinclude>
bkrpddxuyl0aca0yr3oex5kd7h37kr3
Templat:Infobox number/range
10
2995
17063
2026-07-05T06:11:40Z
Gazartashlomo0907
62
Created page with "<div style="text-align:center;"> <!-- --> {{#invoke:string|replace|{{#invoke:string|replace|{{#ifexpr:{{{1|-1}}} < 300 | {{for nowiki| |<nowiki>[[{{#expr: (floor({{{number}}} div {{{factor}}})) * {{{factor}}}+({{{1}}}*{{{factor}}} div 10)}} (number)|{{#switch:{{{1}}}|-1={{#ifexpr:(floor({{{number}}} div 10)) = 0|-1|←}}|10=→|#default={{#expr:(floor({{{number}}} div {{{factor}}})) * {{{factor}}}+({{{1}}}*{{{factor}}} div 10)}}}}]]</nowiki>|-1|0|1|2|3|4|5|6|7|8|9|10|num..."
17063
wikitext
text/x-wiki
<div style="text-align:center;"> <!--
--> {{#invoke:string|replace|{{#invoke:string|replace|{{#ifexpr:{{{1|-1}}} < 300 | {{for nowiki| |<nowiki>[[{{#expr: (floor({{{number}}} div {{{factor}}})) * {{{factor}}}+({{{1}}}*{{{factor}}} div 10)}} (number)|{{#switch:{{{1}}}|-1={{#ifexpr:(floor({{{number}}} div 10)) = 0|-1|←}}|10=→|#default={{#expr:(floor({{{number}}} div {{{factor}}})) * {{{factor}}}+({{{1}}}*{{{factor}}} div 10)}}}}]]</nowiki>|-1|0|1|2|3|4|5|6|7|8|9|10|number={{max|{{{1|-1}}}|0}}|factor={{#ifexpr:{{{1|-1}}} < 300|10|100}}}}}}|-|−}}|(%[−?%d) %(number%)|%1|plain=false}}</div><!--
--><div style="text-align:center;"> <!--
-->{{hlist|[[List of numbers]]|[[Integer]]s}}<!--
--></div><!--
--><div style="text-align:center;">{{#ifexpr:{{{1|-2}}} >= -1
| {{#ifexpr:{{{1}}} < 100
| [[Negative number|←]] <!--
-->[[0]] <!--
-->[[10|10]] <!--
-->[[20 (number)|20]] <!--
-->[[30 (number)|30]] <!--
-->[[40 (number)|40]] <!--
-->[[50 (number)|50]] <!--
-->[[60 (number)|60]] <!--
-->[[70 (number)|70]] <!--
-->[[80 (number)|80]] <!--
-->[[90 (number)|90]] <!--
-->[[100 (number)|→]]
| {{#ifexpr:{{{1}}} < 1000
| <!--
-->[[Negative number|←]] <!--
-->[[0|0]] <!--
-->[[100|100]] <!--
-->[[200 (number)|200]] <!--
-->[[300 (number)|300]] <!--
-->[[400 (number)|400]] <!--
-->[[500 (number)|500]] <!--
-->[[600 (number)|600]] <!--
-->[[700 (number)|700]] <!--
-->[[800 (number)|800]] <!--
-->[[900 (number)|900]] <!--
-->[[1000 (number)|→]]
| {{#ifexpr:{{{1}}} < 100000
| <!--
-->[[Negative number|←]] <!--
-->[[0]] <!--
-->{{for nowiki| |<nowiki>[[{{target of|{{#expr:{{{1}}}*{{{factor}}}*1000}} (number)}}|{{#ifeq:{{{1}}}|10|→|{{#expr:{{{1}}}*{{{factor}}}}}k}}]]</nowiki>|1|2|3|4|5|6|7|8|9|10|factor={{#ifexpr:{{{1}}}>=10000|10|1}}}}
|[[0|←]] <!--
-->[[1|10<sup>0</sup>]] <!--
-->[[10|10<sup>1</sup>]] <!--
-->[[100|10<sup>2</sup>]] <!--
-->[[1000 (number)|10<sup>3</sup>]] <!--
-->[[10,000|10<sup>4</sup>]] <!--
-->[[100,000|10<sup>5</sup>]] <!--
-->[[1,000,000|10<sup>6</sup>]] <!--
-->[[10,000,000|10<sup>7</sup>]] <!--
-->[[100,000,000|10<sup>8</sup>]] <!--
-->[[1,000,000,000|10<sup>9</sup>]] <!--
-->[[10,000,000,000|10<sup>10</sup>]] <!--
-->[[100,000,000,000|10<sup>11</sup>]] <!--
-->[[1,000,000,000,000|10<sup>12</sup>]] <!--
-->[[10,000,000,000,000|10<sup>13</sup>]]
}}
}}
}}
}}</div><noinclude>
{{documentation}}
</noinclude>
7nq8xt6yzbn94qt5v3d91zfofpjtyln
17066
17063
2026-07-05T06:18:54Z
Gazartashlomo0907
62
17066
wikitext
text/x-wiki
<div style="text-align:center;"> <!--
--> {{#invoke:string|replace|{{#invoke:string|replace|{{#ifexpr:{{{1|-1}}} < 300 | {{for nowiki| |<nowiki>[[{{#expr: (floor({{{number}}} div {{{factor}}})) * {{{factor}}}+({{{1}}}*{{{factor}}} div 10)}} (number)|{{#switch:{{{1}}}|-1={{#ifexpr:(floor({{{number}}} div 10)) = 0|-1|←}}|10=→|#default={{#expr:(floor({{{number}}} div {{{factor}}})) * {{{factor}}}+({{{1}}}*{{{factor}}} div 10)}}}}]]</nowiki>|-1|0|1|2|3|4|5|6|7|8|9|10|number={{max|{{{1|-1}}}|0}}|factor={{#ifexpr:{{{1|-1}}} < 300|10|100}}}}}}|-|−}}|(%[−?%d) %(number%)|%1|plain=false}}</div><!--
--><div style="text-align:center;"> <!--
-->{{hlist|[[Daptar bilangan]]|[[Bilangan bulat]]s}}<!--
--></div><!--
--><div style="text-align:center;">{{#ifexpr:{{{1|-2}}} >= -1
| {{#ifexpr:{{{1}}} < 100
| [[Negative number|←]] <!--
-->[[0]] <!--
-->[[10|10]] <!--
-->[[20 (number)|20]] <!--
-->[[30 (number)|30]] <!--
-->[[40 (number)|40]] <!--
-->[[50 (number)|50]] <!--
-->[[60 (number)|60]] <!--
-->[[70 (number)|70]] <!--
-->[[80 (number)|80]] <!--
-->[[90 (number)|90]] <!--
-->[[100 (number)|→]]
| {{#ifexpr:{{{1}}} < 1000
| <!--
-->[[Negative number|←]] <!--
-->[[0|0]] <!--
-->[[100|100]] <!--
-->[[200 (number)|200]] <!--
-->[[300 (number)|300]] <!--
-->[[400 (number)|400]] <!--
-->[[500 (number)|500]] <!--
-->[[600 (number)|600]] <!--
-->[[700 (number)|700]] <!--
-->[[800 (number)|800]] <!--
-->[[900 (number)|900]] <!--
-->[[1000 (number)|→]]
| {{#ifexpr:{{{1}}} < 100000
| <!--
-->[[Negative number|←]] <!--
-->[[0]] <!--
-->{{for nowiki| |<nowiki>[[{{target of|{{#expr:{{{1}}}*{{{factor}}}*1000}} (number)}}|{{#ifeq:{{{1}}}|10|→|{{#expr:{{{1}}}*{{{factor}}}}}k}}]]</nowiki>|1|2|3|4|5|6|7|8|9|10|factor={{#ifexpr:{{{1}}}>=10000|10|1}}}}
|[[0|←]] <!--
-->[[1|10<sup>0</sup>]] <!--
-->[[10|10<sup>1</sup>]] <!--
-->[[100|10<sup>2</sup>]] <!--
-->[[1000 (number)|10<sup>3</sup>]] <!--
-->[[10,000|10<sup>4</sup>]] <!--
-->[[100,000|10<sup>5</sup>]] <!--
-->[[1,000,000|10<sup>6</sup>]] <!--
-->[[10,000,000|10<sup>7</sup>]] <!--
-->[[100,000,000|10<sup>8</sup>]] <!--
-->[[1,000,000,000|10<sup>9</sup>]] <!--
-->[[10,000,000,000|10<sup>10</sup>]] <!--
-->[[100,000,000,000|10<sup>11</sup>]] <!--
-->[[1,000,000,000,000|10<sup>12</sup>]] <!--
-->[[10,000,000,000,000|10<sup>13</sup>]]
}}
}}
}}
}}</div><noinclude>
{{documentation}}
</noinclude>
twaxbkf7f581twm4hnks1dc4udykd9l
Templat:For nowiki
10
2996
17064
2026-07-05T06:12:30Z
Gazartashlomo0907
62
Created page with "<includeonly>{{{{{|safesubst:}}}#invoke: For nowiki|main}}</includeonly><noinclude> {{documentation}}</noinclude>"
17064
wikitext
text/x-wiki
<includeonly>{{{{{|safesubst:}}}#invoke: For nowiki|main}}</includeonly><noinclude>
{{documentation}}</noinclude>
52mhddapimx93jghmt2q2pukluxpwb8
Module:For nowiki
828
2997
17065
2026-07-05T06:17:05Z
Gazartashlomo0907
62
Created page with "local p = {} local function doLoop(frame, args, code, sep, offset, argstosub) local result = {} code = mw.text.unstripNoWiki(code) code = code:gsub('<', '<'):gsub('>', '>') for i, value in ipairs(args) do if i > offset then argstosub["i"] = i - offset argstosub["1"] = value local actualCode = code:gsub("{{{([^{}|]*)|?[^{}]*}}}", argstosub) table.insert(result, frame:preprocess(actualCode)) end end if frame.args.conjunction then return mw.te..."
17065
Scribunto
text/plain
local p = {}
local function doLoop(frame, args, code, sep, offset, argstosub)
local result = {}
code = mw.text.unstripNoWiki(code)
code = code:gsub('<', '<'):gsub('>', '>')
for i, value in ipairs(args) do
if i > offset then
argstosub["i"] = i - offset
argstosub["1"] = value
local actualCode = code:gsub("{{{([^{}|]*)|?[^{}]*}}}", argstosub)
table.insert(result, frame:preprocess(actualCode))
end
end
if frame.args.conjunction then
return mw.text.listToText(result, sep, frame.args.conjunction)
else
return table.concat(result, sep)
end
end
function p.main(frame)
local args = frame:getParent().args
local sep = args[1]
local code = args.code or args[2]
local offset = args.code and 1 or 2
local start = args.start or 1
local argstosub = {}
for key, value in pairs(args) do
if not tonumber(key) and key ~= "i" and key ~= "count" then
argstosub[key] = value
end
end
local countArg = args.count and tonumber(args.count);
if countArg then
offset = 0
args = {}
for i = 1, countArg do
args[i] = i + start - 1
end
end
return doLoop(frame, args, code, sep, offset, argstosub)
end
function p.template(frame)
local sep = frame.args[1]
local code = frame.args[2] or frame.args.code
local offset = tonumber(frame.args.offset) or 0
return doLoop(frame:getParent(), frame:getParent().args, code, sep, offset, {})
end
return p
e2lejejozty6lsp51geqvnus12f6dym
Templat:Infobox number/link
10
2998
17067
2026-07-05T06:20:27Z
Gazartashlomo0907
62
Created page with "{{#if:{{{plain|}}} | {{#invoke:String|replace|{{{number|0}}}|-|−}} | {{#ifexist:{{#invoke:String|replace|{{{number|0}}}|-|−}} (number) | [[{{Target of|{{#invoke:String|replace|{{{number|0}}}|-|−}} (number)}}|{{{pre|}}} {{#invoke:String|replace|{{{number|0}}}|-|−}} {{{post|}}}]] | {{{pre|}}} {{#invoke:String|replace|{{{number|0}}}|-|−}} {{{post|}}} }} }}<noinclude> {{documentation|content= == Test 1 == * {{tlc|Infobox number/link|number{{=}..."
17067
wikitext
text/x-wiki
{{#if:{{{plain|}}}
| {{#invoke:String|replace|{{{number|0}}}|-|−}}
| {{#ifexist:{{#invoke:String|replace|{{{number|0}}}|-|−}} (number)
| [[{{Target of|{{#invoke:String|replace|{{{number|0}}}|-|−}} (number)}}|{{{pre|}}} {{#invoke:String|replace|{{{number|0}}}|-|−}} {{{post|}}}]]
| {{{pre|}}} {{#invoke:String|replace|{{{number|0}}}|-|−}} {{{post|}}}
}}
}}<noinclude>
{{documentation|content=
== Test 1 ==
* {{tlc|Infobox number/link|number{{=}}-3}} → {{Infobox number/link|number=-3}}
* {{tlc|Infobox number/link|number{{=}}-2}} → {{Infobox number/link|number=-2}}
* {{tlc|Infobox number/link|number{{=}}-1}} → {{Infobox number/link|number=-1}}
* {{tlc|Infobox number/link|number{{=}}0}} → {{Infobox number/link|number=0}}
* {{tlc|Infobox number/link|number{{=}}1}} → {{Infobox number/link|number=1}}
* {{tlc|Infobox number/link|number{{=}}2}} → {{Infobox number/link|number=2}}
* {{tlc|Infobox number/link|number{{=}}10}} → {{Infobox number/link|number=10}}
* {{tlc|Infobox number/link|number{{=}}11}} → {{Infobox number/link|number=11}}
* {{tlc|Infobox number/link|number{{=}}12}} → {{Infobox number/link|number=12}}
== Test 2 ==
* {{tlc|Infobox number/link|plain{{=}}y|number{{=}}-3}} → {{Infobox number/link|plain=y|number=-3}}
* {{tlc|Infobox number/link|plain{{=}}y|number{{=}}-2}} → {{Infobox number/link|plain=y|number=-2}}
* {{tlc|Infobox number/link|plain{{=}}y|number{{=}}-1}} → {{Infobox number/link|plain=y|number=-1}}
* {{tlc|Infobox number/link|plain{{=}}y|number{{=}}0}} → {{Infobox number/link|plain=y|number=0}}
* {{tlc|Infobox number/link|plain{{=}}y|number{{=}}1}} → {{Infobox number/link|plain=y|number=1}}
* {{tlc|Infobox number/link|plain{{=}}y|number{{=}}2}} → {{Infobox number/link|plain=y|number=2}}
== Test 3 ==
* {{tlc|Infobox number/link|pre{{=}}→|post{{=}}←|number{{=}}1}} → {{Infobox number/link|pre=→|post=←|number=1}}
== Test 4 ==
* {{tlc|Infobox number/link|plain{{=}}y|pre{{=}}→|post{{=}}←|number{{=}}1}} → {{Infobox number/link|plain=y|pre=→|post=←|number=1}}
}}
</noinclude>
i5ogi9826iuosctmtyqemq88plqnzro
Module:Template link general
828
2999
17068
2026-07-05T06:24:43Z
Gazartashlomo0907
62
Created page with "-- This implements Template:Template link general and various other templates in its family local getArgs = require('Module:Arguments').getArgs local p = {} -- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end local nw = mw.text.nowiki local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == '' or mw.site.namespaces[ns] then return s else re..."
17068
Scribunto
text/plain
-- This implements Template:Template link general and various other templates in its family
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- Is a string non-empty?
local function _ne(s)
return s ~= nil and s ~= ""
end
local nw = mw.text.nowiki
local function addTemplate(s)
local i, _ = s:find(':', 1, true)
if i == nil then
return 'Template:' .. s
end
local ns = s:sub(1, i - 1)
if ns == '' or mw.site.namespaces[ns] then
return s
else
return 'Template:' .. s
end
end
local function trimTemplate(s)
local needle = 'template:'
if s:sub(1, needle:len()):lower() == needle then
return s:sub(needle:len() + 1)
else
return s
end
end
-- Builds the link part
local function linkTitle(args)
local titleObj
if args['1'] then
-- This handles :Page and other NS
titleObj = mw.title.new(args['1'], 'Template')
else
titleObj = mw.title.getCurrentTitle()
end
local textPart = args.alttext
if not _ne(textPart) then
if titleObj ~= nil then
textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText
else
-- redlink
textPart = args['1']
end
end
if _ne(args.subst) then
-- HACK: the ns thing above is probably broken
textPart = 'subst:' .. textPart
end
if _ne(args.brace) then
textPart = nw('{{') .. textPart .. nw('}}')
elseif _ne(args.braceinside) then
textPart = nw('{') .. textPart .. nw('}')
end
local titlePart
if _ne(args.nolink) then
titlePart = textPart
else
titlePart = '[[' .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1'])) ..
'|' .. textPart .. ']]'
end
if _ne(args.braceinside) then
titlePart = nw('{') .. titlePart .. nw('}')
end
local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname)
if bold then
titlePart = "'''" .. titlePart .. "'''"
end
if _ne(args.nowrapname) then
titlePart = '<span class="nowrap">' .. titlePart .. '</span>'
end
return titlePart
end
function p.main(frame)
local args = getArgs(frame, {
trim = true,
removeBlanks = false
})
return p._main(args)
end
function p._main(args)
local italic = _ne(args.italic) or _ne(args.italics)
local dontBrace = _ne(args.brace) or _ne(args.braceinside)
local code = _ne(args.code) or _ne(args.tt)
local show_result = _ne(args._show_result)
local expand = _ne(args._expand)
local titlePart = linkTitle(args)
-- Build the arguments
local textPart = ""
local textPartBuffer = "|"
local codeArguments = {}
local codeArgumentsString = ""
local i = 2
local j = 1
while args[i] do
local val = args[i]
if val ~= "" then
if _ne(args.nowiki) then
-- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will
-- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up
val = nw(mw.text.unstripNoWiki(val))
end
local k, v = string.match(val, "(.*)=(.*)")
if not k then
codeArguments[j] = val
j = j + 1
else
codeArguments[k] = v
end
codeArgumentsString = codeArgumentsString .. textPartBuffer .. val
if italic then
val = '<span style="font-style:italic;">' .. val .. '</span>'
end
textPart = textPart .. textPartBuffer .. val
end
i = i + 1
end
-- final wrap
local ret = titlePart .. textPart
if not dontBrace then ret = nw('{{') .. ret .. nw('}}') end
if _ne(args.a) then ret = nw('*') .. ' ' .. ret end
if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end
if code then
ret = '<code>' .. ret .. '</code>'
elseif _ne(args.plaincode) then
ret = '<code style="border:none;background:transparent;color:inherit">' .. ret .. '</code>'
end
if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end
--[[ Wrap as html??
local span = mw.html.create('span')
span:wikitext(ret)
--]]
if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end
if show_result then
if _ne(args.nocat) then codeArguments['nocat'] = true end
local result = mw.getCurrentFrame():expandTemplate{title = addTemplate(args[1]), args = codeArguments}
ret = ret .. " → " .. result
end
if expand then
local query = mw.text.encode('{{' .. addTemplate(args[1]) .. string.gsub(codeArgumentsString, textPartBuffer, "|") .. '}}')
local url = mw.uri.fullUrl('special:ExpandTemplates', 'wpInput=' .. query)
mw.log()
ret = ret .. " [" .. tostring(url) .. "]"
end
return ret
end
return p
eq1il0gmw32087nl1ce4bzyifl7zrrz
Module:ConvertNumeric
828
3000
17072
2026-07-05T06:30:35Z
Gazartashlomo0907
62
Created page with "-- Module for converting between different representations of numbers. See talk page for user documentation. -- For unit tests see: [[Module:ConvertNumeric/testcases]] -- When editing, preview with: [[Module_talk:ConvertNumeric/testcases]] -- First, edit [[Module:ConvertNumeric/sandbox]], then preview with [[Module_talk:ConvertNumeric/sandbox/testcases]] require('strict') local ones_position = { [0] = 'zero', [1] = 'one', [2] = 'two', [3] = 'three', [4] = 'four',..."
17072
Scribunto
text/plain
-- Module for converting between different representations of numbers. See talk page for user documentation.
-- For unit tests see: [[Module:ConvertNumeric/testcases]]
-- When editing, preview with: [[Module_talk:ConvertNumeric/testcases]]
-- First, edit [[Module:ConvertNumeric/sandbox]], then preview with [[Module_talk:ConvertNumeric/sandbox/testcases]]
require('strict')
local ones_position = {
[0] = 'zero',
[1] = 'one',
[2] = 'two',
[3] = 'three',
[4] = 'four',
[5] = 'five',
[6] = 'six',
[7] = 'seven',
[8] = 'eight',
[9] = 'nine',
[10] = 'ten',
[11] = 'eleven',
[12] = 'twelve',
[13] = 'thirteen',
[14] = 'fourteen',
[15] = 'fifteen',
[16] = 'sixteen',
[17] = 'seventeen',
[18] = 'eighteen',
[19] = 'nineteen'
}
local ones_position_ord = {
[0] = 'zeroth',
[1] = 'first',
[2] = 'second',
[3] = 'third',
[4] = 'fourth',
[5] = 'fifth',
[6] = 'sixth',
[7] = 'seventh',
[8] = 'eighth',
[9] = 'ninth',
[10] = 'tenth',
[11] = 'eleventh',
[12] = 'twelfth',
[13] = 'thirteenth',
[14] = 'fourteenth',
[15] = 'fifteenth',
[16] = 'sixteenth',
[17] = 'seventeenth',
[18] = 'eighteenth',
[19] = 'nineteenth'
}
local ones_position_plural = {
[0] = 'zeros',
[1] = 'ones',
[2] = 'twos',
[3] = 'threes',
[4] = 'fours',
[5] = 'fives',
[6] = 'sixes',
[7] = 'sevens',
[8] = 'eights',
[9] = 'nines',
[10] = 'tens',
[11] = 'elevens',
[12] = 'twelves',
[13] = 'thirteens',
[14] = 'fourteens',
[15] = 'fifteens',
[16] = 'sixteens',
[17] = 'seventeens',
[18] = 'eighteens',
[19] = 'nineteens'
}
local tens_position = {
[2] = 'twenty',
[3] = 'thirty',
[4] = 'forty',
[5] = 'fifty',
[6] = 'sixty',
[7] = 'seventy',
[8] = 'eighty',
[9] = 'ninety'
}
local tens_position_ord = {
[2] = 'twentieth',
[3] = 'thirtieth',
[4] = 'fortieth',
[5] = 'fiftieth',
[6] = 'sixtieth',
[7] = 'seventieth',
[8] = 'eightieth',
[9] = 'ninetieth'
}
local tens_position_plural = {
[2] = 'twenties',
[3] = 'thirties',
[4] = 'forties',
[5] = 'fifties',
[6] = 'sixties',
[7] = 'seventies',
[8] = 'eighties',
[9] = 'nineties'
}
local groups = {
[1] = 'thousand',
[2] = 'million',
[3] = 'billion',
[4] = 'trillion',
[5] = 'quadrillion',
[6] = 'quintillion',
[7] = 'sextillion',
[8] = 'septillion',
[9] = 'octillion',
[10] = 'nonillion',
[11] = 'decillion',
[12] = 'undecillion',
[13] = 'duodecillion',
[14] = 'tredecillion',
[15] = 'quattuordecillion',
[16] = 'quindecillion',
[17] = 'sexdecillion',
[18] = 'septendecillion',
[19] = 'octodecillion',
[20] = 'novemdecillion',
[21] = 'vigintillion',
[22] = 'unvigintillion',
[23] = 'duovigintillion',
[24] = 'tresvigintillion',
[25] = 'quattuorvigintillion',
[26] = 'quinquavigintillion',
[27] = 'sesvigintillion',
[28] = 'septemvigintillion',
[29] = 'octovigintillion',
[30] = 'novemvigintillion',
[31] = 'trigintillion',
[32] = 'untrigintillion',
[33] = 'duotrigintillion',
[34] = 'trestrigintillion',
[35] = 'quattuortrigintillion',
[36] = 'quinquatrigintillion',
[37] = 'sestrigintillion',
[38] = 'septentrigintillion',
[39] = 'octotrigintillion',
[40] = 'noventrigintillion',
[41] = 'quadragintillion',
[51] = 'quinquagintillion',
[61] = 'sexagintillion',
[71] = 'septuagintillion',
[81] = 'octogintillion',
[91] = 'nonagintillion',
[101] = 'centillion',
[102] = 'uncentillion',
[103] = 'duocentillion',
[104] = 'trescentillion',
[111] = 'decicentillion',
[112] = 'undecicentillion',
[121] = 'viginticentillion',
[122] = 'unviginticentillion',
[131] = 'trigintacentillion',
[141] = 'quadragintacentillion',
[151] = 'quinquagintacentillion',
[161] = 'sexagintacentillion',
[171] = 'septuagintacentillion',
[181] = 'octogintacentillion',
[191] = 'nonagintacentillion',
[201] = 'ducentillion',
[301] = 'trecentillion',
[401] = 'quadringentillion',
[501] = 'quingentillion',
[601] = 'sescentillion',
[701] = 'septingentillion',
[801] = 'octingentillion',
[901] = 'nongentillion',
[1001] = 'millinillion',
}
local roman_numerals = {
I = 1,
V = 5,
X = 10,
L = 50,
C = 100,
D = 500,
M = 1000
}
local engord_tens_end = {
['twentieth'] = 20,
['thirtieth'] = 30,
['fortieth'] = 40,
['fiftieth'] = 50,
['sixtieth'] = 60,
['seventieth'] = 70,
['eightieth'] = 80,
['ninetieth'] = 90,
}
local eng_tens_cont = {
['twenty'] = 20,
['thirty'] = 30,
['forty'] = 40,
['fifty'] = 50,
['sixty'] = 60,
['seventy'] = 70,
['eighty'] = 80,
['ninety'] = 90,
}
-- Converts a given valid roman numeral (and some invalid roman numerals) to a number. Returns { -1, errorstring } on error.
local function roman_to_numeral(roman)
if type(roman) ~= "string" then return -1, "roman numeral not a string" end
local rev = roman:reverse()
local raising = true
local last = 0
local result = 0
for i = 1, #rev do
local c = rev:sub(i, i)
local next = roman_numerals[c]
if next == nil then return -1, "roman numeral contains illegal character " .. c end
if next > last then
result = result + next
raising = true
elseif next < last then
result = result - next
raising = false
elseif raising then
result = result + next
else
result = result - next
end
last = next
end
return result
end
-- Converts a given integer between 0 and 100 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_100(num, ordinal, plural, zero)
local terminal_ones, terminal_tens
if ordinal then
terminal_ones = ones_position_ord
terminal_tens = tens_position_ord
elseif plural then
terminal_ones = ones_position_plural
terminal_tens = tens_position_plural
else
terminal_ones = ones_position
terminal_tens = tens_position
end
if num == 0 and zero ~= nil then
return zero
elseif num < 20 then
return terminal_ones[num]
elseif num % 10 == 0 then
return terminal_tens[num / 10]
else
return tens_position[math.floor(num / 10)] .. '-' .. terminal_ones[num % 10]
end
end
local function standard_suffix(ordinal, plural)
if ordinal then return 'th' end
if plural then return 's' end
return ''
end
-- Converts a given integer (in string form) between 0 and 1000 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
num = tonumber(num)
if num < 100 then
return numeral_to_english_less_100(num, ordinal, plural, zero)
elseif num % 100 == 0 then
return ones_position[num/100] .. ' hundred' .. standard_suffix(ordinal, plural)
else
return ones_position[math.floor(num/100)] .. ' hundred ' .. (use_and and 'and ' or '') .. numeral_to_english_less_100(num % 100, ordinal, plural, zero)
end
end
-- Converts an ordinal in English text from 'zeroth' to 'ninety-ninth' inclusive to a number [0–99], else -1.
local function english_to_ordinal(english)
local eng = string.lower(english or '')
local engord_lt20 = {} -- ones_position_ord{} keys & values swapped
for k, v in pairs( ones_position_ord ) do
engord_lt20[v] = k
end
if engord_lt20[eng] then
return engord_lt20[eng] -- e.g. first -> 1
elseif engord_tens_end[eng] then
return engord_tens_end[eng] -- e.g. ninetieth -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = engord_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-ninth -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number in English text from 'zero' to 'ninety-nine' inclusive to a number [0–99], else -1.
local function english_to_numeral(english)
local eng = string.lower(english or '')
local eng_lt20 = { ['single'] = 1 } -- ones_position{} keys & values swapped
for k, v in pairs( ones_position ) do
eng_lt20[v] = k
end
if eng_lt20[eng] then
return eng_lt20[eng] -- e.g. one -> 1
elseif eng_tens_cont[eng] then
return eng_tens_cont[eng] -- e.g. ninety -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = eng_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-nine -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number expressed as a string in scientific notation to a string in standard decimal notation
-- e.g. 1.23E5 -> 123000, 1.23E-5 = .0000123. Conversion is exact, no rounding is performed.
local function scientific_notation_to_decimal(num)
local exponent, subs = num:gsub("^%-?%d*%.?%d*%-?[Ee]([+%-]?%d+)$", "%1")
if subs == 0 then return num end -- Input not in scientific notation, just return unmodified
exponent = tonumber(exponent)
local negative = num:find("^%-")
local _, decimal_pos = num:find("%.")
-- Mantissa will consist of all decimal digits with no decimal point
local mantissa = num:gsub("^%-?(%d*)%.?(%d*)%-?[Ee][+%-]?%d+$", "%1%2")
if negative and decimal_pos then decimal_pos = decimal_pos - 1 end
if not decimal_pos then decimal_pos = #mantissa + 1 end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
-- Shift decimal point right for exponent > 0
while exponent > 0 do
decimal_pos = decimal_pos + 1
exponent = exponent - 1
if decimal_pos > #mantissa + 1 then mantissa = mantissa .. '0' end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
end
-- Shift decimal point left for exponent < 0
while exponent < 0 do
if decimal_pos == 1 then
mantissa = '0' .. mantissa
else
decimal_pos = decimal_pos - 1
end
exponent = exponent + 1
end
-- Insert decimal point in correct position and return
return (negative and '-' or '') .. mantissa:sub(1, decimal_pos - 1) .. '.' .. mantissa:sub(decimal_pos)
end
-- Rounds a number to the nearest integer (NOT USED)
local function round_num(x)
if x%1 >= 0.5 then
return math.ceil(x)
else
return math.floor(x)
end
end
-- Rounds a number to the nearest two-word number (round = up, down, or "on" for round to nearest).
-- Numbers with two digits before the decimal will be rounded to an integer as specified by round.
-- Larger numbers will be rounded to a number with only one nonzero digit in front and all other digits zero.
-- Negative sign is preserved and does not count towards word limit.
local function round_for_english(num, round)
-- If an integer with at most two digits, just return
if num:find("^%-?%d?%d%.?$") then return num end
local negative = num:find("^%-")
if negative then
-- We're rounding magnitude so flip it
if round == 'up' then round = 'down' elseif round == 'down' then round = 'up' end
end
-- If at most two digits before decimal, round to integer and return
local _, _, small_int, trailing_digits, round_digit = num:find("^%-?(%d?%d?)%.((%d)%d*)$")
if small_int then
if small_int == '' then small_int = '0' end
if (round == 'up' and trailing_digits:find('[1-9]')) or (round == 'on' and tonumber(round_digit) >= 5) then
small_int = tostring(tonumber(small_int) + 1)
end
return (negative and '-' or '') .. small_int
end
-- When rounding up, any number with > 1 nonzero digit will round up (e.g. 1000000.001 rounds up to 2000000)
local nonzero_digits = 0
for digit in num:gfind("[1-9]") do
nonzero_digits = nonzero_digits + 1
end
num = num:gsub("%.%d*$", "") -- Remove decimal part
-- Second digit used to determine which way to round lead digit
local _, _, lead_digit, round_digit, round_digit_2, rest = num:find("^%-?(%d)(%d)(%d)(%d*)$")
if tonumber(lead_digit .. round_digit) < 20 and (1 + #rest) % 3 == 0 then
-- In English numbers < 20 are one word so put 2 digits in lead and round based on 3rd
lead_digit = lead_digit .. round_digit
round_digit = round_digit_2
else
rest = round_digit_2 .. rest
end
if (round == 'up' and nonzero_digits > 1) or (round == 'on' and tonumber(round_digit) >= 5) then
lead_digit = tostring(tonumber(lead_digit) + 1)
end
-- All digits but lead digit will turn to zero
rest = rest:gsub("%d", "0")
return (negative and '-' or '') .. lead_digit .. '0' .. rest
end
local denominators = {
[2] = { 'half', plural = 'halves' },
[3] = { 'third' },
[4] = { 'quarter', us = 'fourth' },
[5] = { 'fifth' },
[6] = { 'sixth' },
[8] = { 'eighth' },
[9] = { 'ninth' },
[10] = { 'tenth' },
[16] = { 'sixteenth' },
}
-- Return status, fraction where:
-- status is a string:
-- "finished" if there is a fraction with no whole number;
-- "ok" if fraction is empty or valid;
-- "unsupported" if bad fraction;
-- fraction is a string giving (numerator / denominator) as English text, or is "".
-- Only unsigned fractions with a very limited range of values are supported,
-- except that if whole is empty, the numerator can use "-" to indicate negative.
-- whole (string or nil): nil or "" if no number before the fraction
-- numerator (string or nil): numerator, if any (default = 1 if a denominator is given)
-- denominator (string or nil): denominator, if any
-- sp_us (boolean): true if sp=us
-- negative_word (string): word to use for negative sign, if whole is empty
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function fraction_to_english(whole, numerator, denominator, sp_us, negative_word, use_one)
if numerator or denominator then
local finished = (whole == nil or whole == '')
local sign = ''
if numerator then
if finished and numerator:sub(1, 1) == '-' then
numerator = numerator:sub(2)
sign = negative_word .. ' '
end
else
numerator = '1'
end
if not numerator:match('^%d+$') or not denominator or not denominator:match('^%d+$') then
return 'unsupported', ''
end
numerator = tonumber(numerator)
denominator = tonumber(denominator)
local dendata = denominators[denominator]
if not (dendata and 1 <= numerator and numerator <= 99) then
return 'unsupported', ''
end
local numstr, denstr
local sep = '-'
if numerator == 1 then
denstr = sp_us and dendata.us or dendata[1]
if finished or use_one then
numstr = 'one'
elseif denstr:match('^[aeiou]') then
numstr = 'an'
sep = ' '
else
numstr = 'a'
sep = ' '
end
else
numstr = numeral_to_english_less_100(numerator)
denstr = dendata.plural
if not denstr then
denstr = (sp_us and dendata.us or dendata[1]) .. 's'
end
end
if finished then
return 'finished', sign .. numstr .. sep .. denstr
end
return 'ok', ' and ' .. numstr .. sep .. denstr
end
return 'ok', ''
end
-- Takes a decimal number and converts it to English text.
-- Return nil if a fraction cannot be converted (only some numbers are supported for fractions).
-- num (string or nil): the number to convert.
-- Can be an arbitrarily large decimal, such as "-123456789123456789.345", and
-- can use scientific notation (e.g. "1.23E5").
-- May fail for very large numbers not listed in "groups" such as "1E4000".
-- num is nil if there is no whole number before a fraction.
-- numerator (string or nil): numerator of fraction (nil if no fraction)
-- denominator (string or nil): denominator of fraction (nil if no fraction)
-- capitalize (boolean): whether to capitalize the result (e.g. 'One' instead of 'one')
-- use_and (boolean): whether to use the word 'and' between tens/ones place and higher places
-- hyphenate (boolean): whether to hyphenate all words in the result, useful as an adjective
-- ordinal (boolean): whether to produce an ordinal (e.g. 'first' instead of 'one')
-- plural (boolean): whether to pluralize the resulting number
-- links: nil: do not add any links; 'on': link "billion" and larger to Orders of magnitude article;
-- any other text: list of numbers to link (e.g. "billion,quadrillion")
-- negative_word: word to use for negative sign (typically 'negative' or 'minus'; nil to use default)
-- round: nil or '': no rounding; 'on': round to nearest two-word number; 'up'/'down': round up/down to two-word number
-- zero: word to use for value '0' (nil to use default)
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function _numeral_to_english(num, numerator, denominator, capitalize, use_and, hyphenate, ordinal, plural, links, negative_word, round, zero, use_one)
if not negative_word then
if use_and then
-- TODO Should 'minus' be used when do not have sp=us?
-- If so, need to update testcases, and need to fix "minus zero".
-- negative_word = 'minus'
negative_word = 'negative'
else
negative_word = 'negative'
end
end
local status, fraction_text = fraction_to_english(num, numerator, denominator, not use_and, negative_word, use_one)
if status == 'unsupported' then
return nil
end
if status == 'finished' then
-- Input is a fraction with no whole number.
-- Hack to avoid executing stuff that depends on num being a number.
local s = fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
num = scientific_notation_to_decimal(num)
if round and round ~= '' then
if round ~= 'on' and round ~= 'up' and round ~= 'down' then
error("Invalid rounding mode")
end
num = round_for_english(num, round)
end
-- Separate into negative sign, num (digits before decimal), decimal_places (digits after decimal)
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (may be in values from [[Module:Convert]])
if num:sub(1, #MINUS) == MINUS then
num = '-' .. num:sub(#MINUS + 1) -- replace MINUS with '-'
elseif num:sub(1, 1) == '+' then
num = num:sub(2) -- ignore any '+'
end
local negative = num:find("^%-")
local decimal_places, subs = num:gsub("^%-?%d*%.(%d+)$", "%1")
if subs == 0 then decimal_places = nil end
num, subs = num:gsub("^%-?(%d*)%.?%d*$", "%1")
if num == '' and decimal_places then num = '0' end
if subs == 0 or num == '' then error("Invalid decimal numeral") end
-- For each group of 3 digits except the last one, print with appropriate group name (e.g. million)
local s = ''
while #num > 3 do
if s ~= '' then s = s .. ' ' end
local group_num = math.floor((#num - 1) / 3)
local group = groups[group_num]
local group_digits = #num - group_num*3
s = s .. numeral_to_english_less_1000(num:sub(1, group_digits), false, false, false, zero) .. ' '
if links and (((links == 'on' and group_num >= 3) or links:find(group)) and group_num <= 13) then
s = s .. '[[Orders_of_magnitude_(numbers)#10' .. group_num*3 .. '|' .. group .. ']]'
else
s = s .. group
end
num = num:sub(1 + group_digits)
num = num:gsub("^0*", "") -- Trim leading zeros
end
-- Handle final three digits of integer part
if s ~= '' and num ~= '' then
if #num <= 2 and use_and then
s = s .. ' and '
else
s = s .. ' '
end
end
if s == '' or num ~= '' then
s = s .. numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
elseif ordinal or plural then
-- Round numbers like "one million" take standard suffixes for ordinal/plural
s = s .. standard_suffix(ordinal, plural)
end
-- For decimal places (if any) output "point" followed by spelling out digit by digit
if decimal_places then
s = s .. ' point'
for i = 1, #decimal_places do
s = s .. ' ' .. ones_position[tonumber(decimal_places:sub(i,i))]
end
end
s = s:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
if ordinal and plural then s = s .. 's' end -- s suffix works for all ordinals
if negative and s ~= zero then s = negative_word .. ' ' .. s end
s = s:gsub("negative zero", "zero")
s = s .. fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
local function _numeral_to_english2(args)
local num = tostring(args.num)
num = num:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
num = num:gsub(",", "") -- Remove commas
num = num:gsub("^<span[^<>]*></span>", "") -- Generated by Template:age
if num ~= '' then -- a fraction may have an empty whole number
if not num:find("^%-?%d*%.?%d*%-?[Ee]?[+%-]?%d*$") then
-- Input not in a valid format, try to eval it as an expr to see
-- if that produces a number (e.g. "3 + 5" will become "8").
local noerr, result = pcall(mw.ext.ParserFunctions.expr, num)
if noerr then
num = result
end
end
end
-- Call helper function passing args
return _numeral_to_english(
num,
args['numerator'],
args['denominator'],
args['capitalize'],
args['use_and'],
args['hyphenate'],
args['ordinal'],
args['plural'],
args['links'],
args['negative_word'],
args['round'],
args['zero'],
args['use_one']
) or ''
end
local p = { -- Functions that can be called from another module
roman_to_numeral = roman_to_numeral,
spell_number = _numeral_to_english,
spell_number2 = _numeral_to_english2,
english_to_ordinal = english_to_ordinal,
english_to_numeral = english_to_numeral,
}
function p._roman_to_numeral(frame) -- Callable via {{#invoke:ConvertNumeric|_roman_to_numeral|VI}}
return roman_to_numeral(frame.args[1])
end
function p._english_to_ordinal(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_ordinal|First}}
return english_to_ordinal(frame.args[1])
end
function p._english_to_numeral(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_numeral|One}}
return english_to_numeral(frame.args[1])
end
function p.numeral_to_english(frame)
local args = frame.args
-- Tail call to helper function passing args from frame
return _numeral_to_english2{
['num'] = args[1],
['numerator'] = args['numerator'],
['denominator'] = args['denominator'],
['capitalize'] = args['case'] == 'U' or args['case'] == 'u',
['use_and'] = args['sp'] ~= 'us',
['hyphenate'] = args['adj'] == 'on',
['ordinal'] = args['ord'] == 'on',
['plural'] = args['pl'] == 'on',
['links'] = args['lk'],
['negative_word'] = args['negative'],
['round'] = args['round'],
['zero'] = args['zero'],
['use_one'] = args['one'] == 'one' -- experiment: using '|one=one' makes fraction 2+1/2 give "two and one-half" instead of "two and a half"
}
end
---- recursive function for p.decToHex
local function decToHexDigit(dec)
local dig = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}
local div = math.floor(dec/16)
local mod = dec-(16*div)
if div >= 1 then return decToHexDigit(div)..dig[mod+1] else return dig[mod+1] end
end -- I think this is supposed to be done with a tail call but first I want something that works at all
---- finds all the decimal numbers in the input text and hexes each of them
function p.decToHex(frame)
local args=frame.args
local parent=frame.getParent(frame)
local pargs={}
if parent then pargs=parent.args end
local text=args[1] or pargs[1] or ""
local minlength=args.minlength or pargs.minlength or 1
minlength=tonumber(minlength)
local prowl=mw.ustring.gmatch(text,"(.-)(%d+)")
local output=""
repeat
local chaff,dec=prowl()
if not(dec) then break end
local hex=decToHexDigit(dec)
while (mw.ustring.len(hex)<minlength) do hex="0"..hex end
output=output..chaff..hex
until false
local chaff=mw.ustring.match(text,"(%D+)$") or ""
return output..chaff
end
return p
pnyw663d8z474xbg4qqu86tb8s9yiu2
17073
17072
2026-07-05T06:37:31Z
Gazartashlomo0907
62
17073
Scribunto
text/plain
-- Module for converting between different representations of numbers. See talk page for user documentation.
-- For unit tests see: [[Module:ConvertNumeric/testcases]]
-- When editing, preview with: [[Module_talk:ConvertNumeric/testcases]]
-- First, edit [[Module:ConvertNumeric/sandbox]], then preview with [[Module_talk:ConvertNumeric/sandbox/testcases]]
require('strict')
local ones_position = {
[0] = 'nol',
[1] = 'sada',
[2] = 'dua',
[3] = 'tolu',
[4] = 'opat',
[5] = 'lima',
[6] = 'onom',
[7] = 'pitu',
[8] = 'ualu',
[9] = 'sia',
[10] = 'sampulu',
[11] = 'sampulu sada',
[12] = 'sampulu dua',
[13] = 'sampulu tolu',
[14] = 'sampulu opat',
[15] = 'sampulu lima',
[16] = 'sampulu onom',
[17] = 'sampulu pitu',
[18] = 'sampulu ualu',
[19] = 'sampulu sia'
}
local ones_position_ord = {
[0] = 'nol',
[1] = 'parjolo',
[2] = 'paduahon',
[3] = 'patoluhon',
[4] = 'paopathon',
[5] = 'palimahon',
[6] = 'paonomhon',
[7] = 'papituhon',
[8] = 'paualuhon',
[9] = 'pasiahon',
[10] = 'pasampuluhon',
[11] = 'pasampulusiahon',
[12] = 'pasampuluduahon',
[13] = 'pasampulutoluhon',
[14] = 'pasampuluopathon',
[15] = 'pasampululimahon',
[16] = 'pasampuluonomhon',
[17] = 'pasampulupituhon',
[18] = 'pasampulualuhon',
[19] = 'pasampulusiahon'
}
local ones_position_plural = {
[0] = 'zeros',
[1] = 'ones',
[2] = 'twos',
[3] = 'threes',
[4] = 'fours',
[5] = 'fives',
[6] = 'sixes',
[7] = 'sevens',
[8] = 'eights',
[9] = 'nines',
[10] = 'tens',
[11] = 'elevens',
[12] = 'twelves',
[13] = 'thirteens',
[14] = 'fourteens',
[15] = 'fifteens',
[16] = 'sixteens',
[17] = 'seventeens',
[18] = 'eighteens',
[19] = 'nineteens'
}
local tens_position = {
[2] = 'twenty',
[3] = 'thirty',
[4] = 'forty',
[5] = 'fifty',
[6] = 'sixty',
[7] = 'seventy',
[8] = 'eighty',
[9] = 'ninety'
}
local tens_position_ord = {
[2] = 'twentieth',
[3] = 'thirtieth',
[4] = 'fortieth',
[5] = 'fiftieth',
[6] = 'sixtieth',
[7] = 'seventieth',
[8] = 'eightieth',
[9] = 'ninetieth'
}
local tens_position_plural = {
[2] = 'twenties',
[3] = 'thirties',
[4] = 'forties',
[5] = 'fifties',
[6] = 'sixties',
[7] = 'seventies',
[8] = 'eighties',
[9] = 'nineties'
}
local groups = {
[1] = 'thousand',
[2] = 'million',
[3] = 'billion',
[4] = 'trillion',
[5] = 'quadrillion',
[6] = 'quintillion',
[7] = 'sextillion',
[8] = 'septillion',
[9] = 'octillion',
[10] = 'nonillion',
[11] = 'decillion',
[12] = 'undecillion',
[13] = 'duodecillion',
[14] = 'tredecillion',
[15] = 'quattuordecillion',
[16] = 'quindecillion',
[17] = 'sexdecillion',
[18] = 'septendecillion',
[19] = 'octodecillion',
[20] = 'novemdecillion',
[21] = 'vigintillion',
[22] = 'unvigintillion',
[23] = 'duovigintillion',
[24] = 'tresvigintillion',
[25] = 'quattuorvigintillion',
[26] = 'quinquavigintillion',
[27] = 'sesvigintillion',
[28] = 'septemvigintillion',
[29] = 'octovigintillion',
[30] = 'novemvigintillion',
[31] = 'trigintillion',
[32] = 'untrigintillion',
[33] = 'duotrigintillion',
[34] = 'trestrigintillion',
[35] = 'quattuortrigintillion',
[36] = 'quinquatrigintillion',
[37] = 'sestrigintillion',
[38] = 'septentrigintillion',
[39] = 'octotrigintillion',
[40] = 'noventrigintillion',
[41] = 'quadragintillion',
[51] = 'quinquagintillion',
[61] = 'sexagintillion',
[71] = 'septuagintillion',
[81] = 'octogintillion',
[91] = 'nonagintillion',
[101] = 'centillion',
[102] = 'uncentillion',
[103] = 'duocentillion',
[104] = 'trescentillion',
[111] = 'decicentillion',
[112] = 'undecicentillion',
[121] = 'viginticentillion',
[122] = 'unviginticentillion',
[131] = 'trigintacentillion',
[141] = 'quadragintacentillion',
[151] = 'quinquagintacentillion',
[161] = 'sexagintacentillion',
[171] = 'septuagintacentillion',
[181] = 'octogintacentillion',
[191] = 'nonagintacentillion',
[201] = 'ducentillion',
[301] = 'trecentillion',
[401] = 'quadringentillion',
[501] = 'quingentillion',
[601] = 'sescentillion',
[701] = 'septingentillion',
[801] = 'octingentillion',
[901] = 'nongentillion',
[1001] = 'millinillion',
}
local roman_numerals = {
I = 1,
V = 5,
X = 10,
L = 50,
C = 100,
D = 500,
M = 1000
}
local engord_tens_end = {
['twentieth'] = 20,
['thirtieth'] = 30,
['fortieth'] = 40,
['fiftieth'] = 50,
['sixtieth'] = 60,
['seventieth'] = 70,
['eightieth'] = 80,
['ninetieth'] = 90,
}
local eng_tens_cont = {
['twenty'] = 20,
['thirty'] = 30,
['forty'] = 40,
['fifty'] = 50,
['sixty'] = 60,
['seventy'] = 70,
['eighty'] = 80,
['ninety'] = 90,
}
-- Converts a given valid roman numeral (and some invalid roman numerals) to a number. Returns { -1, errorstring } on error.
local function roman_to_numeral(roman)
if type(roman) ~= "string" then return -1, "roman numeral not a string" end
local rev = roman:reverse()
local raising = true
local last = 0
local result = 0
for i = 1, #rev do
local c = rev:sub(i, i)
local next = roman_numerals[c]
if next == nil then return -1, "roman numeral contains illegal character " .. c end
if next > last then
result = result + next
raising = true
elseif next < last then
result = result - next
raising = false
elseif raising then
result = result + next
else
result = result - next
end
last = next
end
return result
end
-- Converts a given integer between 0 and 100 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_100(num, ordinal, plural, zero)
local terminal_ones, terminal_tens
if ordinal then
terminal_ones = ones_position_ord
terminal_tens = tens_position_ord
elseif plural then
terminal_ones = ones_position_plural
terminal_tens = tens_position_plural
else
terminal_ones = ones_position
terminal_tens = tens_position
end
if num == 0 and zero ~= nil then
return zero
elseif num < 20 then
return terminal_ones[num]
elseif num % 10 == 0 then
return terminal_tens[num / 10]
else
return tens_position[math.floor(num / 10)] .. '-' .. terminal_ones[num % 10]
end
end
local function standard_suffix(ordinal, plural)
if ordinal then return 'th' end
if plural then return 's' end
return ''
end
-- Converts a given integer (in string form) between 0 and 1000 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
num = tonumber(num)
if num < 100 then
return numeral_to_english_less_100(num, ordinal, plural, zero)
elseif num % 100 == 0 then
return ones_position[num/100] .. ' hundred' .. standard_suffix(ordinal, plural)
else
return ones_position[math.floor(num/100)] .. ' hundred ' .. (use_and and 'and ' or '') .. numeral_to_english_less_100(num % 100, ordinal, plural, zero)
end
end
-- Converts an ordinal in English text from 'zeroth' to 'ninety-ninth' inclusive to a number [0–99], else -1.
local function english_to_ordinal(english)
local eng = string.lower(english or '')
local engord_lt20 = {} -- ones_position_ord{} keys & values swapped
for k, v in pairs( ones_position_ord ) do
engord_lt20[v] = k
end
if engord_lt20[eng] then
return engord_lt20[eng] -- e.g. first -> 1
elseif engord_tens_end[eng] then
return engord_tens_end[eng] -- e.g. ninetieth -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = engord_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-ninth -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number in English text from 'zero' to 'ninety-nine' inclusive to a number [0–99], else -1.
local function english_to_numeral(english)
local eng = string.lower(english or '')
local eng_lt20 = { ['single'] = 1 } -- ones_position{} keys & values swapped
for k, v in pairs( ones_position ) do
eng_lt20[v] = k
end
if eng_lt20[eng] then
return eng_lt20[eng] -- e.g. one -> 1
elseif eng_tens_cont[eng] then
return eng_tens_cont[eng] -- e.g. ninety -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = eng_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-nine -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number expressed as a string in scientific notation to a string in standard decimal notation
-- e.g. 1.23E5 -> 123000, 1.23E-5 = .0000123. Conversion is exact, no rounding is performed.
local function scientific_notation_to_decimal(num)
local exponent, subs = num:gsub("^%-?%d*%.?%d*%-?[Ee]([+%-]?%d+)$", "%1")
if subs == 0 then return num end -- Input not in scientific notation, just return unmodified
exponent = tonumber(exponent)
local negative = num:find("^%-")
local _, decimal_pos = num:find("%.")
-- Mantissa will consist of all decimal digits with no decimal point
local mantissa = num:gsub("^%-?(%d*)%.?(%d*)%-?[Ee][+%-]?%d+$", "%1%2")
if negative and decimal_pos then decimal_pos = decimal_pos - 1 end
if not decimal_pos then decimal_pos = #mantissa + 1 end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
-- Shift decimal point right for exponent > 0
while exponent > 0 do
decimal_pos = decimal_pos + 1
exponent = exponent - 1
if decimal_pos > #mantissa + 1 then mantissa = mantissa .. '0' end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
end
-- Shift decimal point left for exponent < 0
while exponent < 0 do
if decimal_pos == 1 then
mantissa = '0' .. mantissa
else
decimal_pos = decimal_pos - 1
end
exponent = exponent + 1
end
-- Insert decimal point in correct position and return
return (negative and '-' or '') .. mantissa:sub(1, decimal_pos - 1) .. '.' .. mantissa:sub(decimal_pos)
end
-- Rounds a number to the nearest integer (NOT USED)
local function round_num(x)
if x%1 >= 0.5 then
return math.ceil(x)
else
return math.floor(x)
end
end
-- Rounds a number to the nearest two-word number (round = up, down, or "on" for round to nearest).
-- Numbers with two digits before the decimal will be rounded to an integer as specified by round.
-- Larger numbers will be rounded to a number with only one nonzero digit in front and all other digits zero.
-- Negative sign is preserved and does not count towards word limit.
local function round_for_english(num, round)
-- If an integer with at most two digits, just return
if num:find("^%-?%d?%d%.?$") then return num end
local negative = num:find("^%-")
if negative then
-- We're rounding magnitude so flip it
if round == 'up' then round = 'down' elseif round == 'down' then round = 'up' end
end
-- If at most two digits before decimal, round to integer and return
local _, _, small_int, trailing_digits, round_digit = num:find("^%-?(%d?%d?)%.((%d)%d*)$")
if small_int then
if small_int == '' then small_int = '0' end
if (round == 'up' and trailing_digits:find('[1-9]')) or (round == 'on' and tonumber(round_digit) >= 5) then
small_int = tostring(tonumber(small_int) + 1)
end
return (negative and '-' or '') .. small_int
end
-- When rounding up, any number with > 1 nonzero digit will round up (e.g. 1000000.001 rounds up to 2000000)
local nonzero_digits = 0
for digit in num:gfind("[1-9]") do
nonzero_digits = nonzero_digits + 1
end
num = num:gsub("%.%d*$", "") -- Remove decimal part
-- Second digit used to determine which way to round lead digit
local _, _, lead_digit, round_digit, round_digit_2, rest = num:find("^%-?(%d)(%d)(%d)(%d*)$")
if tonumber(lead_digit .. round_digit) < 20 and (1 + #rest) % 3 == 0 then
-- In English numbers < 20 are one word so put 2 digits in lead and round based on 3rd
lead_digit = lead_digit .. round_digit
round_digit = round_digit_2
else
rest = round_digit_2 .. rest
end
if (round == 'up' and nonzero_digits > 1) or (round == 'on' and tonumber(round_digit) >= 5) then
lead_digit = tostring(tonumber(lead_digit) + 1)
end
-- All digits but lead digit will turn to zero
rest = rest:gsub("%d", "0")
return (negative and '-' or '') .. lead_digit .. '0' .. rest
end
local denominators = {
[2] = { 'half', plural = 'halves' },
[3] = { 'third' },
[4] = { 'quarter', us = 'fourth' },
[5] = { 'fifth' },
[6] = { 'sixth' },
[8] = { 'eighth' },
[9] = { 'ninth' },
[10] = { 'tenth' },
[16] = { 'sixteenth' },
}
-- Return status, fraction where:
-- status is a string:
-- "finished" if there is a fraction with no whole number;
-- "ok" if fraction is empty or valid;
-- "unsupported" if bad fraction;
-- fraction is a string giving (numerator / denominator) as English text, or is "".
-- Only unsigned fractions with a very limited range of values are supported,
-- except that if whole is empty, the numerator can use "-" to indicate negative.
-- whole (string or nil): nil or "" if no number before the fraction
-- numerator (string or nil): numerator, if any (default = 1 if a denominator is given)
-- denominator (string or nil): denominator, if any
-- sp_us (boolean): true if sp=us
-- negative_word (string): word to use for negative sign, if whole is empty
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function fraction_to_english(whole, numerator, denominator, sp_us, negative_word, use_one)
if numerator or denominator then
local finished = (whole == nil or whole == '')
local sign = ''
if numerator then
if finished and numerator:sub(1, 1) == '-' then
numerator = numerator:sub(2)
sign = negative_word .. ' '
end
else
numerator = '1'
end
if not numerator:match('^%d+$') or not denominator or not denominator:match('^%d+$') then
return 'unsupported', ''
end
numerator = tonumber(numerator)
denominator = tonumber(denominator)
local dendata = denominators[denominator]
if not (dendata and 1 <= numerator and numerator <= 99) then
return 'unsupported', ''
end
local numstr, denstr
local sep = '-'
if numerator == 1 then
denstr = sp_us and dendata.us or dendata[1]
if finished or use_one then
numstr = 'one'
elseif denstr:match('^[aeiou]') then
numstr = 'an'
sep = ' '
else
numstr = 'a'
sep = ' '
end
else
numstr = numeral_to_english_less_100(numerator)
denstr = dendata.plural
if not denstr then
denstr = (sp_us and dendata.us or dendata[1]) .. 's'
end
end
if finished then
return 'finished', sign .. numstr .. sep .. denstr
end
return 'ok', ' and ' .. numstr .. sep .. denstr
end
return 'ok', ''
end
-- Takes a decimal number and converts it to English text.
-- Return nil if a fraction cannot be converted (only some numbers are supported for fractions).
-- num (string or nil): the number to convert.
-- Can be an arbitrarily large decimal, such as "-123456789123456789.345", and
-- can use scientific notation (e.g. "1.23E5").
-- May fail for very large numbers not listed in "groups" such as "1E4000".
-- num is nil if there is no whole number before a fraction.
-- numerator (string or nil): numerator of fraction (nil if no fraction)
-- denominator (string or nil): denominator of fraction (nil if no fraction)
-- capitalize (boolean): whether to capitalize the result (e.g. 'One' instead of 'one')
-- use_and (boolean): whether to use the word 'and' between tens/ones place and higher places
-- hyphenate (boolean): whether to hyphenate all words in the result, useful as an adjective
-- ordinal (boolean): whether to produce an ordinal (e.g. 'first' instead of 'one')
-- plural (boolean): whether to pluralize the resulting number
-- links: nil: do not add any links; 'on': link "billion" and larger to Orders of magnitude article;
-- any other text: list of numbers to link (e.g. "billion,quadrillion")
-- negative_word: word to use for negative sign (typically 'negative' or 'minus'; nil to use default)
-- round: nil or '': no rounding; 'on': round to nearest two-word number; 'up'/'down': round up/down to two-word number
-- zero: word to use for value '0' (nil to use default)
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function _numeral_to_english(num, numerator, denominator, capitalize, use_and, hyphenate, ordinal, plural, links, negative_word, round, zero, use_one)
if not negative_word then
if use_and then
-- TODO Should 'minus' be used when do not have sp=us?
-- If so, need to update testcases, and need to fix "minus zero".
-- negative_word = 'minus'
negative_word = 'negative'
else
negative_word = 'negative'
end
end
local status, fraction_text = fraction_to_english(num, numerator, denominator, not use_and, negative_word, use_one)
if status == 'unsupported' then
return nil
end
if status == 'finished' then
-- Input is a fraction with no whole number.
-- Hack to avoid executing stuff that depends on num being a number.
local s = fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
num = scientific_notation_to_decimal(num)
if round and round ~= '' then
if round ~= 'on' and round ~= 'up' and round ~= 'down' then
error("Invalid rounding mode")
end
num = round_for_english(num, round)
end
-- Separate into negative sign, num (digits before decimal), decimal_places (digits after decimal)
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (may be in values from [[Module:Convert]])
if num:sub(1, #MINUS) == MINUS then
num = '-' .. num:sub(#MINUS + 1) -- replace MINUS with '-'
elseif num:sub(1, 1) == '+' then
num = num:sub(2) -- ignore any '+'
end
local negative = num:find("^%-")
local decimal_places, subs = num:gsub("^%-?%d*%.(%d+)$", "%1")
if subs == 0 then decimal_places = nil end
num, subs = num:gsub("^%-?(%d*)%.?%d*$", "%1")
if num == '' and decimal_places then num = '0' end
if subs == 0 or num == '' then error("Invalid decimal numeral") end
-- For each group of 3 digits except the last one, print with appropriate group name (e.g. million)
local s = ''
while #num > 3 do
if s ~= '' then s = s .. ' ' end
local group_num = math.floor((#num - 1) / 3)
local group = groups[group_num]
local group_digits = #num - group_num*3
s = s .. numeral_to_english_less_1000(num:sub(1, group_digits), false, false, false, zero) .. ' '
if links and (((links == 'on' and group_num >= 3) or links:find(group)) and group_num <= 13) then
s = s .. '[[Orders_of_magnitude_(numbers)#10' .. group_num*3 .. '|' .. group .. ']]'
else
s = s .. group
end
num = num:sub(1 + group_digits)
num = num:gsub("^0*", "") -- Trim leading zeros
end
-- Handle final three digits of integer part
if s ~= '' and num ~= '' then
if #num <= 2 and use_and then
s = s .. ' and '
else
s = s .. ' '
end
end
if s == '' or num ~= '' then
s = s .. numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
elseif ordinal or plural then
-- Round numbers like "one million" take standard suffixes for ordinal/plural
s = s .. standard_suffix(ordinal, plural)
end
-- For decimal places (if any) output "point" followed by spelling out digit by digit
if decimal_places then
s = s .. ' point'
for i = 1, #decimal_places do
s = s .. ' ' .. ones_position[tonumber(decimal_places:sub(i,i))]
end
end
s = s:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
if ordinal and plural then s = s .. 's' end -- s suffix works for all ordinals
if negative and s ~= zero then s = negative_word .. ' ' .. s end
s = s:gsub("negative zero", "zero")
s = s .. fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
local function _numeral_to_english2(args)
local num = tostring(args.num)
num = num:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
num = num:gsub(",", "") -- Remove commas
num = num:gsub("^<span[^<>]*></span>", "") -- Generated by Template:age
if num ~= '' then -- a fraction may have an empty whole number
if not num:find("^%-?%d*%.?%d*%-?[Ee]?[+%-]?%d*$") then
-- Input not in a valid format, try to eval it as an expr to see
-- if that produces a number (e.g. "3 + 5" will become "8").
local noerr, result = pcall(mw.ext.ParserFunctions.expr, num)
if noerr then
num = result
end
end
end
-- Call helper function passing args
return _numeral_to_english(
num,
args['numerator'],
args['denominator'],
args['capitalize'],
args['use_and'],
args['hyphenate'],
args['ordinal'],
args['plural'],
args['links'],
args['negative_word'],
args['round'],
args['zero'],
args['use_one']
) or ''
end
local p = { -- Functions that can be called from another module
roman_to_numeral = roman_to_numeral,
spell_number = _numeral_to_english,
spell_number2 = _numeral_to_english2,
english_to_ordinal = english_to_ordinal,
english_to_numeral = english_to_numeral,
}
function p._roman_to_numeral(frame) -- Callable via {{#invoke:ConvertNumeric|_roman_to_numeral|VI}}
return roman_to_numeral(frame.args[1])
end
function p._english_to_ordinal(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_ordinal|First}}
return english_to_ordinal(frame.args[1])
end
function p._english_to_numeral(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_numeral|One}}
return english_to_numeral(frame.args[1])
end
function p.numeral_to_english(frame)
local args = frame.args
-- Tail call to helper function passing args from frame
return _numeral_to_english2{
['num'] = args[1],
['numerator'] = args['numerator'],
['denominator'] = args['denominator'],
['capitalize'] = args['case'] == 'U' or args['case'] == 'u',
['use_and'] = args['sp'] ~= 'us',
['hyphenate'] = args['adj'] == 'on',
['ordinal'] = args['ord'] == 'on',
['plural'] = args['pl'] == 'on',
['links'] = args['lk'],
['negative_word'] = args['negative'],
['round'] = args['round'],
['zero'] = args['zero'],
['use_one'] = args['one'] == 'one' -- experiment: using '|one=one' makes fraction 2+1/2 give "two and one-half" instead of "two and a half"
}
end
---- recursive function for p.decToHex
local function decToHexDigit(dec)
local dig = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}
local div = math.floor(dec/16)
local mod = dec-(16*div)
if div >= 1 then return decToHexDigit(div)..dig[mod+1] else return dig[mod+1] end
end -- I think this is supposed to be done with a tail call but first I want something that works at all
---- finds all the decimal numbers in the input text and hexes each of them
function p.decToHex(frame)
local args=frame.args
local parent=frame.getParent(frame)
local pargs={}
if parent then pargs=parent.args end
local text=args[1] or pargs[1] or ""
local minlength=args.minlength or pargs.minlength or 1
minlength=tonumber(minlength)
local prowl=mw.ustring.gmatch(text,"(.-)(%d+)")
local output=""
repeat
local chaff,dec=prowl()
if not(dec) then break end
local hex=decToHexDigit(dec)
while (mw.ustring.len(hex)<minlength) do hex="0"..hex end
output=output..chaff..hex
until false
local chaff=mw.ustring.match(text,"(%D+)$") or ""
return output..chaff
end
return p
9gysx0tctu6z1pbk0xweuo6110tkzpx
17074
17073
2026-07-05T06:40:02Z
Gazartashlomo0907
62
17074
Scribunto
text/plain
-- Module for converting between different representations of numbers. See talk page for user documentation.
-- For unit tests see: [[Module:ConvertNumeric/testcases]]
-- When editing, preview with: [[Module_talk:ConvertNumeric/testcases]]
-- First, edit [[Module:ConvertNumeric/sandbox]], then preview with [[Module_talk:ConvertNumeric/sandbox/testcases]]
require('strict')
local ones_position = {
[0] = 'nol',
[1] = 'sada',
[2] = 'dua',
[3] = 'tolu',
[4] = 'opat',
[5] = 'lima',
[6] = 'onom',
[7] = 'pitu',
[8] = 'ualu',
[9] = 'sia',
[10] = 'sampulu',
[11] = 'sampulu sada',
[12] = 'sampulu dua',
[13] = 'sampulu tolu',
[14] = 'sampulu opat',
[15] = 'sampulu lima',
[16] = 'sampulu onom',
[17] = 'sampulu pitu',
[18] = 'sampulu ualu',
[19] = 'sampulu sia'
}
local ones_position_ord = {
[0] = 'nol',
[1] = 'parjolo',
[2] = 'paduahon',
[3] = 'patoluhon',
[4] = 'paopathon',
[5] = 'palimahon',
[6] = 'paonomhon',
[7] = 'papituhon',
[8] = 'paualuhon',
[9] = 'pasiahon',
[10] = 'pasampuluhon',
[11] = 'pasampulusiahon',
[12] = 'pasampuluduahon',
[13] = 'pasampulutoluhon',
[14] = 'pasampuluopathon',
[15] = 'pasampululimahon',
[16] = 'pasampuluonomhon',
[17] = 'pasampulupituhon',
[18] = 'pasampulualuhon',
[19] = 'pasampulusiahon'
}
local ones_position_plural = {
[0] = 'zeros',
[1] = 'ones',
[2] = 'twos',
[3] = 'threes',
[4] = 'fours',
[5] = 'fives',
[6] = 'sixes',
[7] = 'sevens',
[8] = 'eights',
[9] = 'nines',
[10] = 'tens',
[11] = 'elevens',
[12] = 'twelves',
[13] = 'thirteens',
[14] = 'fourteens',
[15] = 'fifteens',
[16] = 'sixteens',
[17] = 'seventeens',
[18] = 'eighteens',
[19] = 'nineteens'
}
local tens_position = {
[2] = 'twenty',
[3] = 'thirty',
[4] = 'forty',
[5] = 'fifty',
[6] = 'sixty',
[7] = 'seventy',
[8] = 'eighty',
[9] = 'ninety'
}
local tens_position_ord = {
[2] = 'twentieth',
[3] = 'thirtieth',
[4] = 'fortieth',
[5] = 'fiftieth',
[6] = 'sixtieth',
[7] = 'seventieth',
[8] = 'eightieth',
[9] = 'ninetieth'
}
local tens_position_plural = {
[2] = 'twenties',
[3] = 'thirties',
[4] = 'forties',
[5] = 'fifties',
[6] = 'sixties',
[7] = 'seventies',
[8] = 'eighties',
[9] = 'nineties'
}
local groups = {
[1] = 'thousand',
[2] = 'million',
[3] = 'billion',
[4] = 'trillion',
[5] = 'quadrillion',
[6] = 'quintillion',
[7] = 'sextillion',
[8] = 'septillion',
[9] = 'octillion',
[10] = 'nonillion',
[11] = 'decillion',
[12] = 'undecillion',
[13] = 'duodecillion',
[14] = 'tredecillion',
[15] = 'quattuordecillion',
[16] = 'quindecillion',
[17] = 'sexdecillion',
[18] = 'septendecillion',
[19] = 'octodecillion',
[20] = 'novemdecillion',
[21] = 'vigintillion',
[22] = 'unvigintillion',
[23] = 'duovigintillion',
[24] = 'tresvigintillion',
[25] = 'quattuorvigintillion',
[26] = 'quinquavigintillion',
[27] = 'sesvigintillion',
[28] = 'septemvigintillion',
[29] = 'octovigintillion',
[30] = 'novemvigintillion',
[31] = 'trigintillion',
[32] = 'untrigintillion',
[33] = 'duotrigintillion',
[34] = 'trestrigintillion',
[35] = 'quattuortrigintillion',
[36] = 'quinquatrigintillion',
[37] = 'sestrigintillion',
[38] = 'septentrigintillion',
[39] = 'octotrigintillion',
[40] = 'noventrigintillion',
[41] = 'quadragintillion',
[51] = 'quinquagintillion',
[61] = 'sexagintillion',
[71] = 'septuagintillion',
[81] = 'octogintillion',
[91] = 'nonagintillion',
[101] = 'centillion',
[102] = 'uncentillion',
[103] = 'duocentillion',
[104] = 'trescentillion',
[111] = 'decicentillion',
[112] = 'undecicentillion',
[121] = 'viginticentillion',
[122] = 'unviginticentillion',
[131] = 'trigintacentillion',
[141] = 'quadragintacentillion',
[151] = 'quinquagintacentillion',
[161] = 'sexagintacentillion',
[171] = 'septuagintacentillion',
[181] = 'octogintacentillion',
[191] = 'nonagintacentillion',
[201] = 'ducentillion',
[301] = 'trecentillion',
[401] = 'quadringentillion',
[501] = 'quingentillion',
[601] = 'sescentillion',
[701] = 'septingentillion',
[801] = 'octingentillion',
[901] = 'nongentillion',
[1001] = 'millinillion',
}
local roman_numerals = {
I = 1,
V = 5,
X = 10,
L = 50,
C = 100,
D = 500,
M = 1000
}
local engord_tens_end = {
['twentieth'] = 20,
['thirtieth'] = 30,
['fortieth'] = 40,
['fiftieth'] = 50,
['sixtieth'] = 60,
['seventieth'] = 70,
['eightieth'] = 80,
['ninetieth'] = 90,
}
local eng_tens_cont = {
['dua pulu'] = 20,
['tolu pulu'] = 30,
['opat pulu'] = 40,
['lima pulu'] = 50,
['onom pulu'] = 60,
['pitu pulu'] = 70,
['ualu pulu'] = 80,
['sia pulu'] = 90,
}
-- Converts a given valid roman numeral (and some invalid roman numerals) to a number. Returns { -1, errorstring } on error.
local function roman_to_numeral(roman)
if type(roman) ~= "string" then return -1, "roman numeral not a string" end
local rev = roman:reverse()
local raising = true
local last = 0
local result = 0
for i = 1, #rev do
local c = rev:sub(i, i)
local next = roman_numerals[c]
if next == nil then return -1, "roman numeral contains illegal character " .. c end
if next > last then
result = result + next
raising = true
elseif next < last then
result = result - next
raising = false
elseif raising then
result = result + next
else
result = result - next
end
last = next
end
return result
end
-- Converts a given integer between 0 and 100 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_100(num, ordinal, plural, zero)
local terminal_ones, terminal_tens
if ordinal then
terminal_ones = ones_position_ord
terminal_tens = tens_position_ord
elseif plural then
terminal_ones = ones_position_plural
terminal_tens = tens_position_plural
else
terminal_ones = ones_position
terminal_tens = tens_position
end
if num == 0 and zero ~= nil then
return zero
elseif num < 20 then
return terminal_ones[num]
elseif num % 10 == 0 then
return terminal_tens[num / 10]
else
return tens_position[math.floor(num / 10)] .. '-' .. terminal_ones[num % 10]
end
end
local function standard_suffix(ordinal, plural)
if ordinal then return 'th' end
if plural then return 's' end
return ''
end
-- Converts a given integer (in string form) between 0 and 1000 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
num = tonumber(num)
if num < 100 then
return numeral_to_english_less_100(num, ordinal, plural, zero)
elseif num % 100 == 0 then
return ones_position[num/100] .. ' hundred' .. standard_suffix(ordinal, plural)
else
return ones_position[math.floor(num/100)] .. ' hundred ' .. (use_and and 'and ' or '') .. numeral_to_english_less_100(num % 100, ordinal, plural, zero)
end
end
-- Converts an ordinal in English text from 'zeroth' to 'ninety-ninth' inclusive to a number [0–99], else -1.
local function english_to_ordinal(english)
local eng = string.lower(english or '')
local engord_lt20 = {} -- ones_position_ord{} keys & values swapped
for k, v in pairs( ones_position_ord ) do
engord_lt20[v] = k
end
if engord_lt20[eng] then
return engord_lt20[eng] -- e.g. first -> 1
elseif engord_tens_end[eng] then
return engord_tens_end[eng] -- e.g. ninetieth -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = engord_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-ninth -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number in English text from 'zero' to 'ninety-nine' inclusive to a number [0–99], else -1.
local function english_to_numeral(english)
local eng = string.lower(english or '')
local eng_lt20 = { ['single'] = 1 } -- ones_position{} keys & values swapped
for k, v in pairs( ones_position ) do
eng_lt20[v] = k
end
if eng_lt20[eng] then
return eng_lt20[eng] -- e.g. one -> 1
elseif eng_tens_cont[eng] then
return eng_tens_cont[eng] -- e.g. ninety -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = eng_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-nine -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number expressed as a string in scientific notation to a string in standard decimal notation
-- e.g. 1.23E5 -> 123000, 1.23E-5 = .0000123. Conversion is exact, no rounding is performed.
local function scientific_notation_to_decimal(num)
local exponent, subs = num:gsub("^%-?%d*%.?%d*%-?[Ee]([+%-]?%d+)$", "%1")
if subs == 0 then return num end -- Input not in scientific notation, just return unmodified
exponent = tonumber(exponent)
local negative = num:find("^%-")
local _, decimal_pos = num:find("%.")
-- Mantissa will consist of all decimal digits with no decimal point
local mantissa = num:gsub("^%-?(%d*)%.?(%d*)%-?[Ee][+%-]?%d+$", "%1%2")
if negative and decimal_pos then decimal_pos = decimal_pos - 1 end
if not decimal_pos then decimal_pos = #mantissa + 1 end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
-- Shift decimal point right for exponent > 0
while exponent > 0 do
decimal_pos = decimal_pos + 1
exponent = exponent - 1
if decimal_pos > #mantissa + 1 then mantissa = mantissa .. '0' end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
end
-- Shift decimal point left for exponent < 0
while exponent < 0 do
if decimal_pos == 1 then
mantissa = '0' .. mantissa
else
decimal_pos = decimal_pos - 1
end
exponent = exponent + 1
end
-- Insert decimal point in correct position and return
return (negative and '-' or '') .. mantissa:sub(1, decimal_pos - 1) .. '.' .. mantissa:sub(decimal_pos)
end
-- Rounds a number to the nearest integer (NOT USED)
local function round_num(x)
if x%1 >= 0.5 then
return math.ceil(x)
else
return math.floor(x)
end
end
-- Rounds a number to the nearest two-word number (round = up, down, or "on" for round to nearest).
-- Numbers with two digits before the decimal will be rounded to an integer as specified by round.
-- Larger numbers will be rounded to a number with only one nonzero digit in front and all other digits zero.
-- Negative sign is preserved and does not count towards word limit.
local function round_for_english(num, round)
-- If an integer with at most two digits, just return
if num:find("^%-?%d?%d%.?$") then return num end
local negative = num:find("^%-")
if negative then
-- We're rounding magnitude so flip it
if round == 'up' then round = 'down' elseif round == 'down' then round = 'up' end
end
-- If at most two digits before decimal, round to integer and return
local _, _, small_int, trailing_digits, round_digit = num:find("^%-?(%d?%d?)%.((%d)%d*)$")
if small_int then
if small_int == '' then small_int = '0' end
if (round == 'up' and trailing_digits:find('[1-9]')) or (round == 'on' and tonumber(round_digit) >= 5) then
small_int = tostring(tonumber(small_int) + 1)
end
return (negative and '-' or '') .. small_int
end
-- When rounding up, any number with > 1 nonzero digit will round up (e.g. 1000000.001 rounds up to 2000000)
local nonzero_digits = 0
for digit in num:gfind("[1-9]") do
nonzero_digits = nonzero_digits + 1
end
num = num:gsub("%.%d*$", "") -- Remove decimal part
-- Second digit used to determine which way to round lead digit
local _, _, lead_digit, round_digit, round_digit_2, rest = num:find("^%-?(%d)(%d)(%d)(%d*)$")
if tonumber(lead_digit .. round_digit) < 20 and (1 + #rest) % 3 == 0 then
-- In English numbers < 20 are one word so put 2 digits in lead and round based on 3rd
lead_digit = lead_digit .. round_digit
round_digit = round_digit_2
else
rest = round_digit_2 .. rest
end
if (round == 'up' and nonzero_digits > 1) or (round == 'on' and tonumber(round_digit) >= 5) then
lead_digit = tostring(tonumber(lead_digit) + 1)
end
-- All digits but lead digit will turn to zero
rest = rest:gsub("%d", "0")
return (negative and '-' or '') .. lead_digit .. '0' .. rest
end
local denominators = {
[2] = { 'half', plural = 'halves' },
[3] = { 'third' },
[4] = { 'quarter', us = 'fourth' },
[5] = { 'fifth' },
[6] = { 'sixth' },
[8] = { 'eighth' },
[9] = { 'ninth' },
[10] = { 'tenth' },
[16] = { 'sixteenth' },
}
-- Return status, fraction where:
-- status is a string:
-- "finished" if there is a fraction with no whole number;
-- "ok" if fraction is empty or valid;
-- "unsupported" if bad fraction;
-- fraction is a string giving (numerator / denominator) as English text, or is "".
-- Only unsigned fractions with a very limited range of values are supported,
-- except that if whole is empty, the numerator can use "-" to indicate negative.
-- whole (string or nil): nil or "" if no number before the fraction
-- numerator (string or nil): numerator, if any (default = 1 if a denominator is given)
-- denominator (string or nil): denominator, if any
-- sp_us (boolean): true if sp=us
-- negative_word (string): word to use for negative sign, if whole is empty
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function fraction_to_english(whole, numerator, denominator, sp_us, negative_word, use_one)
if numerator or denominator then
local finished = (whole == nil or whole == '')
local sign = ''
if numerator then
if finished and numerator:sub(1, 1) == '-' then
numerator = numerator:sub(2)
sign = negative_word .. ' '
end
else
numerator = '1'
end
if not numerator:match('^%d+$') or not denominator or not denominator:match('^%d+$') then
return 'unsupported', ''
end
numerator = tonumber(numerator)
denominator = tonumber(denominator)
local dendata = denominators[denominator]
if not (dendata and 1 <= numerator and numerator <= 99) then
return 'unsupported', ''
end
local numstr, denstr
local sep = '-'
if numerator == 1 then
denstr = sp_us and dendata.us or dendata[1]
if finished or use_one then
numstr = 'one'
elseif denstr:match('^[aeiou]') then
numstr = 'an'
sep = ' '
else
numstr = 'a'
sep = ' '
end
else
numstr = numeral_to_english_less_100(numerator)
denstr = dendata.plural
if not denstr then
denstr = (sp_us and dendata.us or dendata[1]) .. 's'
end
end
if finished then
return 'finished', sign .. numstr .. sep .. denstr
end
return 'ok', ' and ' .. numstr .. sep .. denstr
end
return 'ok', ''
end
-- Takes a decimal number and converts it to English text.
-- Return nil if a fraction cannot be converted (only some numbers are supported for fractions).
-- num (string or nil): the number to convert.
-- Can be an arbitrarily large decimal, such as "-123456789123456789.345", and
-- can use scientific notation (e.g. "1.23E5").
-- May fail for very large numbers not listed in "groups" such as "1E4000".
-- num is nil if there is no whole number before a fraction.
-- numerator (string or nil): numerator of fraction (nil if no fraction)
-- denominator (string or nil): denominator of fraction (nil if no fraction)
-- capitalize (boolean): whether to capitalize the result (e.g. 'One' instead of 'one')
-- use_and (boolean): whether to use the word 'and' between tens/ones place and higher places
-- hyphenate (boolean): whether to hyphenate all words in the result, useful as an adjective
-- ordinal (boolean): whether to produce an ordinal (e.g. 'first' instead of 'one')
-- plural (boolean): whether to pluralize the resulting number
-- links: nil: do not add any links; 'on': link "billion" and larger to Orders of magnitude article;
-- any other text: list of numbers to link (e.g. "billion,quadrillion")
-- negative_word: word to use for negative sign (typically 'negative' or 'minus'; nil to use default)
-- round: nil or '': no rounding; 'on': round to nearest two-word number; 'up'/'down': round up/down to two-word number
-- zero: word to use for value '0' (nil to use default)
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function _numeral_to_english(num, numerator, denominator, capitalize, use_and, hyphenate, ordinal, plural, links, negative_word, round, zero, use_one)
if not negative_word then
if use_and then
-- TODO Should 'minus' be used when do not have sp=us?
-- If so, need to update testcases, and need to fix "minus zero".
-- negative_word = 'minus'
negative_word = 'negative'
else
negative_word = 'negative'
end
end
local status, fraction_text = fraction_to_english(num, numerator, denominator, not use_and, negative_word, use_one)
if status == 'unsupported' then
return nil
end
if status == 'finished' then
-- Input is a fraction with no whole number.
-- Hack to avoid executing stuff that depends on num being a number.
local s = fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
num = scientific_notation_to_decimal(num)
if round and round ~= '' then
if round ~= 'on' and round ~= 'up' and round ~= 'down' then
error("Invalid rounding mode")
end
num = round_for_english(num, round)
end
-- Separate into negative sign, num (digits before decimal), decimal_places (digits after decimal)
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (may be in values from [[Module:Convert]])
if num:sub(1, #MINUS) == MINUS then
num = '-' .. num:sub(#MINUS + 1) -- replace MINUS with '-'
elseif num:sub(1, 1) == '+' then
num = num:sub(2) -- ignore any '+'
end
local negative = num:find("^%-")
local decimal_places, subs = num:gsub("^%-?%d*%.(%d+)$", "%1")
if subs == 0 then decimal_places = nil end
num, subs = num:gsub("^%-?(%d*)%.?%d*$", "%1")
if num == '' and decimal_places then num = '0' end
if subs == 0 or num == '' then error("Invalid decimal numeral") end
-- For each group of 3 digits except the last one, print with appropriate group name (e.g. million)
local s = ''
while #num > 3 do
if s ~= '' then s = s .. ' ' end
local group_num = math.floor((#num - 1) / 3)
local group = groups[group_num]
local group_digits = #num - group_num*3
s = s .. numeral_to_english_less_1000(num:sub(1, group_digits), false, false, false, zero) .. ' '
if links and (((links == 'on' and group_num >= 3) or links:find(group)) and group_num <= 13) then
s = s .. '[[Orders_of_magnitude_(numbers)#10' .. group_num*3 .. '|' .. group .. ']]'
else
s = s .. group
end
num = num:sub(1 + group_digits)
num = num:gsub("^0*", "") -- Trim leading zeros
end
-- Handle final three digits of integer part
if s ~= '' and num ~= '' then
if #num <= 2 and use_and then
s = s .. ' and '
else
s = s .. ' '
end
end
if s == '' or num ~= '' then
s = s .. numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
elseif ordinal or plural then
-- Round numbers like "one million" take standard suffixes for ordinal/plural
s = s .. standard_suffix(ordinal, plural)
end
-- For decimal places (if any) output "point" followed by spelling out digit by digit
if decimal_places then
s = s .. ' point'
for i = 1, #decimal_places do
s = s .. ' ' .. ones_position[tonumber(decimal_places:sub(i,i))]
end
end
s = s:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
if ordinal and plural then s = s .. 's' end -- s suffix works for all ordinals
if negative and s ~= zero then s = negative_word .. ' ' .. s end
s = s:gsub("negative zero", "zero")
s = s .. fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
local function _numeral_to_english2(args)
local num = tostring(args.num)
num = num:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
num = num:gsub(",", "") -- Remove commas
num = num:gsub("^<span[^<>]*></span>", "") -- Generated by Template:age
if num ~= '' then -- a fraction may have an empty whole number
if not num:find("^%-?%d*%.?%d*%-?[Ee]?[+%-]?%d*$") then
-- Input not in a valid format, try to eval it as an expr to see
-- if that produces a number (e.g. "3 + 5" will become "8").
local noerr, result = pcall(mw.ext.ParserFunctions.expr, num)
if noerr then
num = result
end
end
end
-- Call helper function passing args
return _numeral_to_english(
num,
args['numerator'],
args['denominator'],
args['capitalize'],
args['use_and'],
args['hyphenate'],
args['ordinal'],
args['plural'],
args['links'],
args['negative_word'],
args['round'],
args['zero'],
args['use_one']
) or ''
end
local p = { -- Functions that can be called from another module
roman_to_numeral = roman_to_numeral,
spell_number = _numeral_to_english,
spell_number2 = _numeral_to_english2,
english_to_ordinal = english_to_ordinal,
english_to_numeral = english_to_numeral,
}
function p._roman_to_numeral(frame) -- Callable via {{#invoke:ConvertNumeric|_roman_to_numeral|VI}}
return roman_to_numeral(frame.args[1])
end
function p._english_to_ordinal(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_ordinal|First}}
return english_to_ordinal(frame.args[1])
end
function p._english_to_numeral(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_numeral|One}}
return english_to_numeral(frame.args[1])
end
function p.numeral_to_english(frame)
local args = frame.args
-- Tail call to helper function passing args from frame
return _numeral_to_english2{
['num'] = args[1],
['numerator'] = args['numerator'],
['denominator'] = args['denominator'],
['capitalize'] = args['case'] == 'U' or args['case'] == 'u',
['use_and'] = args['sp'] ~= 'us',
['hyphenate'] = args['adj'] == 'on',
['ordinal'] = args['ord'] == 'on',
['plural'] = args['pl'] == 'on',
['links'] = args['lk'],
['negative_word'] = args['negative'],
['round'] = args['round'],
['zero'] = args['zero'],
['use_one'] = args['one'] == 'one' -- experiment: using '|one=one' makes fraction 2+1/2 give "two and one-half" instead of "two and a half"
}
end
---- recursive function for p.decToHex
local function decToHexDigit(dec)
local dig = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}
local div = math.floor(dec/16)
local mod = dec-(16*div)
if div >= 1 then return decToHexDigit(div)..dig[mod+1] else return dig[mod+1] end
end -- I think this is supposed to be done with a tail call but first I want something that works at all
---- finds all the decimal numbers in the input text and hexes each of them
function p.decToHex(frame)
local args=frame.args
local parent=frame.getParent(frame)
local pargs={}
if parent then pargs=parent.args end
local text=args[1] or pargs[1] or ""
local minlength=args.minlength or pargs.minlength or 1
minlength=tonumber(minlength)
local prowl=mw.ustring.gmatch(text,"(.-)(%d+)")
local output=""
repeat
local chaff,dec=prowl()
if not(dec) then break end
local hex=decToHexDigit(dec)
while (mw.ustring.len(hex)<minlength) do hex="0"..hex end
output=output..chaff..hex
until false
local chaff=mw.ustring.match(text,"(%D+)$") or ""
return output..chaff
end
return p
jgn2yfsblzmsb1kmp9p1sylv16kyzyu
17075
17074
2026-07-05T06:42:00Z
Gazartashlomo0907
62
17075
Scribunto
text/plain
-- Module for converting between different representations of numbers. See talk page for user documentation.
-- For unit tests see: [[Module:ConvertNumeric/testcases]]
-- When editing, preview with: [[Module_talk:ConvertNumeric/testcases]]
-- First, edit [[Module:ConvertNumeric/sandbox]], then preview with [[Module_talk:ConvertNumeric/sandbox/testcases]]
require('strict')
local ones_position = {
[0] = 'nol',
[1] = 'sada',
[2] = 'dua',
[3] = 'tolu',
[4] = 'opat',
[5] = 'lima',
[6] = 'onom',
[7] = 'pitu',
[8] = 'ualu',
[9] = 'sia',
[10] = 'sampulu',
[11] = 'sampulu sada',
[12] = 'sampulu dua',
[13] = 'sampulu tolu',
[14] = 'sampulu opat',
[15] = 'sampulu lima',
[16] = 'sampulu onom',
[17] = 'sampulu pitu',
[18] = 'sampulu ualu',
[19] = 'sampulu sia'
}
local ones_position_ord = {
[0] = 'nol',
[1] = 'parjolo',
[2] = 'paduahon',
[3] = 'patoluhon',
[4] = 'paopathon',
[5] = 'palimahon',
[6] = 'paonomhon',
[7] = 'papituhon',
[8] = 'paualuhon',
[9] = 'pasiahon',
[10] = 'pasampuluhon',
[11] = 'pasampulusiahon',
[12] = 'pasampuluduahon',
[13] = 'pasampulutoluhon',
[14] = 'pasampuluopathon',
[15] = 'pasampululimahon',
[16] = 'pasampuluonomhon',
[17] = 'pasampulupituhon',
[18] = 'pasampulualuhon',
[19] = 'pasampulusiahon'
}
local ones_position_plural = {
[0] = 'zeros',
[1] = 'ones',
[2] = 'twos',
[3] = 'threes',
[4] = 'fours',
[5] = 'fives',
[6] = 'sixes',
[7] = 'sevens',
[8] = 'eights',
[9] = 'nines',
[10] = 'tens',
[11] = 'elevens',
[12] = 'twelves',
[13] = 'thirteens',
[14] = 'fourteens',
[15] = 'fifteens',
[16] = 'sixteens',
[17] = 'seventeens',
[18] = 'eighteens',
[19] = 'nineteens'
}
local tens_position = {
[2] = 'dua pulu',
[3] = 'tolu pulu',
[4] = 'opat pulu',
[5] = 'lima pulu',
[6] = 'onom pulu',
[7] = 'pitu pulu',
[8] = 'ualu pulu',
[9] = 'sia pulu'
}
local tens_position_ord = {
[2] = 'twentieth',
[3] = 'thirtieth',
[4] = 'fortieth',
[5] = 'fiftieth',
[6] = 'sixtieth',
[7] = 'seventieth',
[8] = 'eightieth',
[9] = 'ninetieth'
}
local tens_position_plural = {
[2] = 'twenties',
[3] = 'thirties',
[4] = 'forties',
[5] = 'fifties',
[6] = 'sixties',
[7] = 'seventies',
[8] = 'eighties',
[9] = 'nineties'
}
local groups = {
[1] = 'thousand',
[2] = 'million',
[3] = 'billion',
[4] = 'trillion',
[5] = 'quadrillion',
[6] = 'quintillion',
[7] = 'sextillion',
[8] = 'septillion',
[9] = 'octillion',
[10] = 'nonillion',
[11] = 'decillion',
[12] = 'undecillion',
[13] = 'duodecillion',
[14] = 'tredecillion',
[15] = 'quattuordecillion',
[16] = 'quindecillion',
[17] = 'sexdecillion',
[18] = 'septendecillion',
[19] = 'octodecillion',
[20] = 'novemdecillion',
[21] = 'vigintillion',
[22] = 'unvigintillion',
[23] = 'duovigintillion',
[24] = 'tresvigintillion',
[25] = 'quattuorvigintillion',
[26] = 'quinquavigintillion',
[27] = 'sesvigintillion',
[28] = 'septemvigintillion',
[29] = 'octovigintillion',
[30] = 'novemvigintillion',
[31] = 'trigintillion',
[32] = 'untrigintillion',
[33] = 'duotrigintillion',
[34] = 'trestrigintillion',
[35] = 'quattuortrigintillion',
[36] = 'quinquatrigintillion',
[37] = 'sestrigintillion',
[38] = 'septentrigintillion',
[39] = 'octotrigintillion',
[40] = 'noventrigintillion',
[41] = 'quadragintillion',
[51] = 'quinquagintillion',
[61] = 'sexagintillion',
[71] = 'septuagintillion',
[81] = 'octogintillion',
[91] = 'nonagintillion',
[101] = 'centillion',
[102] = 'uncentillion',
[103] = 'duocentillion',
[104] = 'trescentillion',
[111] = 'decicentillion',
[112] = 'undecicentillion',
[121] = 'viginticentillion',
[122] = 'unviginticentillion',
[131] = 'trigintacentillion',
[141] = 'quadragintacentillion',
[151] = 'quinquagintacentillion',
[161] = 'sexagintacentillion',
[171] = 'septuagintacentillion',
[181] = 'octogintacentillion',
[191] = 'nonagintacentillion',
[201] = 'ducentillion',
[301] = 'trecentillion',
[401] = 'quadringentillion',
[501] = 'quingentillion',
[601] = 'sescentillion',
[701] = 'septingentillion',
[801] = 'octingentillion',
[901] = 'nongentillion',
[1001] = 'millinillion',
}
local roman_numerals = {
I = 1,
V = 5,
X = 10,
L = 50,
C = 100,
D = 500,
M = 1000
}
local engord_tens_end = {
['twentieth'] = 20,
['thirtieth'] = 30,
['fortieth'] = 40,
['fiftieth'] = 50,
['sixtieth'] = 60,
['seventieth'] = 70,
['eightieth'] = 80,
['ninetieth'] = 90,
}
local eng_tens_cont = {
['dua pulu'] = 20,
['tolu pulu'] = 30,
['opat pulu'] = 40,
['lima pulu'] = 50,
['onom pulu'] = 60,
['pitu pulu'] = 70,
['ualu pulu'] = 80,
['sia pulu'] = 90,
}
-- Converts a given valid roman numeral (and some invalid roman numerals) to a number. Returns { -1, errorstring } on error.
local function roman_to_numeral(roman)
if type(roman) ~= "string" then return -1, "roman numeral not a string" end
local rev = roman:reverse()
local raising = true
local last = 0
local result = 0
for i = 1, #rev do
local c = rev:sub(i, i)
local next = roman_numerals[c]
if next == nil then return -1, "roman numeral contains illegal character " .. c end
if next > last then
result = result + next
raising = true
elseif next < last then
result = result - next
raising = false
elseif raising then
result = result + next
else
result = result - next
end
last = next
end
return result
end
-- Converts a given integer between 0 and 100 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_100(num, ordinal, plural, zero)
local terminal_ones, terminal_tens
if ordinal then
terminal_ones = ones_position_ord
terminal_tens = tens_position_ord
elseif plural then
terminal_ones = ones_position_plural
terminal_tens = tens_position_plural
else
terminal_ones = ones_position
terminal_tens = tens_position
end
if num == 0 and zero ~= nil then
return zero
elseif num < 20 then
return terminal_ones[num]
elseif num % 10 == 0 then
return terminal_tens[num / 10]
else
return tens_position[math.floor(num / 10)] .. '-' .. terminal_ones[num % 10]
end
end
local function standard_suffix(ordinal, plural)
if ordinal then return 'th' end
if plural then return 's' end
return ''
end
-- Converts a given integer (in string form) between 0 and 1000 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
num = tonumber(num)
if num < 100 then
return numeral_to_english_less_100(num, ordinal, plural, zero)
elseif num % 100 == 0 then
return ones_position[num/100] .. ' hundred' .. standard_suffix(ordinal, plural)
else
return ones_position[math.floor(num/100)] .. ' hundred ' .. (use_and and 'and ' or '') .. numeral_to_english_less_100(num % 100, ordinal, plural, zero)
end
end
-- Converts an ordinal in English text from 'zeroth' to 'ninety-ninth' inclusive to a number [0–99], else -1.
local function english_to_ordinal(english)
local eng = string.lower(english or '')
local engord_lt20 = {} -- ones_position_ord{} keys & values swapped
for k, v in pairs( ones_position_ord ) do
engord_lt20[v] = k
end
if engord_lt20[eng] then
return engord_lt20[eng] -- e.g. first -> 1
elseif engord_tens_end[eng] then
return engord_tens_end[eng] -- e.g. ninetieth -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = engord_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-ninth -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number in English text from 'zero' to 'ninety-nine' inclusive to a number [0–99], else -1.
local function english_to_numeral(english)
local eng = string.lower(english or '')
local eng_lt20 = { ['single'] = 1 } -- ones_position{} keys & values swapped
for k, v in pairs( ones_position ) do
eng_lt20[v] = k
end
if eng_lt20[eng] then
return eng_lt20[eng] -- e.g. one -> 1
elseif eng_tens_cont[eng] then
return eng_tens_cont[eng] -- e.g. ninety -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = eng_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-nine -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number expressed as a string in scientific notation to a string in standard decimal notation
-- e.g. 1.23E5 -> 123000, 1.23E-5 = .0000123. Conversion is exact, no rounding is performed.
local function scientific_notation_to_decimal(num)
local exponent, subs = num:gsub("^%-?%d*%.?%d*%-?[Ee]([+%-]?%d+)$", "%1")
if subs == 0 then return num end -- Input not in scientific notation, just return unmodified
exponent = tonumber(exponent)
local negative = num:find("^%-")
local _, decimal_pos = num:find("%.")
-- Mantissa will consist of all decimal digits with no decimal point
local mantissa = num:gsub("^%-?(%d*)%.?(%d*)%-?[Ee][+%-]?%d+$", "%1%2")
if negative and decimal_pos then decimal_pos = decimal_pos - 1 end
if not decimal_pos then decimal_pos = #mantissa + 1 end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
-- Shift decimal point right for exponent > 0
while exponent > 0 do
decimal_pos = decimal_pos + 1
exponent = exponent - 1
if decimal_pos > #mantissa + 1 then mantissa = mantissa .. '0' end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
end
-- Shift decimal point left for exponent < 0
while exponent < 0 do
if decimal_pos == 1 then
mantissa = '0' .. mantissa
else
decimal_pos = decimal_pos - 1
end
exponent = exponent + 1
end
-- Insert decimal point in correct position and return
return (negative and '-' or '') .. mantissa:sub(1, decimal_pos - 1) .. '.' .. mantissa:sub(decimal_pos)
end
-- Rounds a number to the nearest integer (NOT USED)
local function round_num(x)
if x%1 >= 0.5 then
return math.ceil(x)
else
return math.floor(x)
end
end
-- Rounds a number to the nearest two-word number (round = up, down, or "on" for round to nearest).
-- Numbers with two digits before the decimal will be rounded to an integer as specified by round.
-- Larger numbers will be rounded to a number with only one nonzero digit in front and all other digits zero.
-- Negative sign is preserved and does not count towards word limit.
local function round_for_english(num, round)
-- If an integer with at most two digits, just return
if num:find("^%-?%d?%d%.?$") then return num end
local negative = num:find("^%-")
if negative then
-- We're rounding magnitude so flip it
if round == 'up' then round = 'down' elseif round == 'down' then round = 'up' end
end
-- If at most two digits before decimal, round to integer and return
local _, _, small_int, trailing_digits, round_digit = num:find("^%-?(%d?%d?)%.((%d)%d*)$")
if small_int then
if small_int == '' then small_int = '0' end
if (round == 'up' and trailing_digits:find('[1-9]')) or (round == 'on' and tonumber(round_digit) >= 5) then
small_int = tostring(tonumber(small_int) + 1)
end
return (negative and '-' or '') .. small_int
end
-- When rounding up, any number with > 1 nonzero digit will round up (e.g. 1000000.001 rounds up to 2000000)
local nonzero_digits = 0
for digit in num:gfind("[1-9]") do
nonzero_digits = nonzero_digits + 1
end
num = num:gsub("%.%d*$", "") -- Remove decimal part
-- Second digit used to determine which way to round lead digit
local _, _, lead_digit, round_digit, round_digit_2, rest = num:find("^%-?(%d)(%d)(%d)(%d*)$")
if tonumber(lead_digit .. round_digit) < 20 and (1 + #rest) % 3 == 0 then
-- In English numbers < 20 are one word so put 2 digits in lead and round based on 3rd
lead_digit = lead_digit .. round_digit
round_digit = round_digit_2
else
rest = round_digit_2 .. rest
end
if (round == 'up' and nonzero_digits > 1) or (round == 'on' and tonumber(round_digit) >= 5) then
lead_digit = tostring(tonumber(lead_digit) + 1)
end
-- All digits but lead digit will turn to zero
rest = rest:gsub("%d", "0")
return (negative and '-' or '') .. lead_digit .. '0' .. rest
end
local denominators = {
[2] = { 'half', plural = 'halves' },
[3] = { 'third' },
[4] = { 'quarter', us = 'fourth' },
[5] = { 'fifth' },
[6] = { 'sixth' },
[8] = { 'eighth' },
[9] = { 'ninth' },
[10] = { 'tenth' },
[16] = { 'sixteenth' },
}
-- Return status, fraction where:
-- status is a string:
-- "finished" if there is a fraction with no whole number;
-- "ok" if fraction is empty or valid;
-- "unsupported" if bad fraction;
-- fraction is a string giving (numerator / denominator) as English text, or is "".
-- Only unsigned fractions with a very limited range of values are supported,
-- except that if whole is empty, the numerator can use "-" to indicate negative.
-- whole (string or nil): nil or "" if no number before the fraction
-- numerator (string or nil): numerator, if any (default = 1 if a denominator is given)
-- denominator (string or nil): denominator, if any
-- sp_us (boolean): true if sp=us
-- negative_word (string): word to use for negative sign, if whole is empty
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function fraction_to_english(whole, numerator, denominator, sp_us, negative_word, use_one)
if numerator or denominator then
local finished = (whole == nil or whole == '')
local sign = ''
if numerator then
if finished and numerator:sub(1, 1) == '-' then
numerator = numerator:sub(2)
sign = negative_word .. ' '
end
else
numerator = '1'
end
if not numerator:match('^%d+$') or not denominator or not denominator:match('^%d+$') then
return 'unsupported', ''
end
numerator = tonumber(numerator)
denominator = tonumber(denominator)
local dendata = denominators[denominator]
if not (dendata and 1 <= numerator and numerator <= 99) then
return 'unsupported', ''
end
local numstr, denstr
local sep = '-'
if numerator == 1 then
denstr = sp_us and dendata.us or dendata[1]
if finished or use_one then
numstr = 'one'
elseif denstr:match('^[aeiou]') then
numstr = 'an'
sep = ' '
else
numstr = 'a'
sep = ' '
end
else
numstr = numeral_to_english_less_100(numerator)
denstr = dendata.plural
if not denstr then
denstr = (sp_us and dendata.us or dendata[1]) .. 's'
end
end
if finished then
return 'finished', sign .. numstr .. sep .. denstr
end
return 'ok', ' and ' .. numstr .. sep .. denstr
end
return 'ok', ''
end
-- Takes a decimal number and converts it to English text.
-- Return nil if a fraction cannot be converted (only some numbers are supported for fractions).
-- num (string or nil): the number to convert.
-- Can be an arbitrarily large decimal, such as "-123456789123456789.345", and
-- can use scientific notation (e.g. "1.23E5").
-- May fail for very large numbers not listed in "groups" such as "1E4000".
-- num is nil if there is no whole number before a fraction.
-- numerator (string or nil): numerator of fraction (nil if no fraction)
-- denominator (string or nil): denominator of fraction (nil if no fraction)
-- capitalize (boolean): whether to capitalize the result (e.g. 'One' instead of 'one')
-- use_and (boolean): whether to use the word 'and' between tens/ones place and higher places
-- hyphenate (boolean): whether to hyphenate all words in the result, useful as an adjective
-- ordinal (boolean): whether to produce an ordinal (e.g. 'first' instead of 'one')
-- plural (boolean): whether to pluralize the resulting number
-- links: nil: do not add any links; 'on': link "billion" and larger to Orders of magnitude article;
-- any other text: list of numbers to link (e.g. "billion,quadrillion")
-- negative_word: word to use for negative sign (typically 'negative' or 'minus'; nil to use default)
-- round: nil or '': no rounding; 'on': round to nearest two-word number; 'up'/'down': round up/down to two-word number
-- zero: word to use for value '0' (nil to use default)
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function _numeral_to_english(num, numerator, denominator, capitalize, use_and, hyphenate, ordinal, plural, links, negative_word, round, zero, use_one)
if not negative_word then
if use_and then
-- TODO Should 'minus' be used when do not have sp=us?
-- If so, need to update testcases, and need to fix "minus zero".
-- negative_word = 'minus'
negative_word = 'negative'
else
negative_word = 'negative'
end
end
local status, fraction_text = fraction_to_english(num, numerator, denominator, not use_and, negative_word, use_one)
if status == 'unsupported' then
return nil
end
if status == 'finished' then
-- Input is a fraction with no whole number.
-- Hack to avoid executing stuff that depends on num being a number.
local s = fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
num = scientific_notation_to_decimal(num)
if round and round ~= '' then
if round ~= 'on' and round ~= 'up' and round ~= 'down' then
error("Invalid rounding mode")
end
num = round_for_english(num, round)
end
-- Separate into negative sign, num (digits before decimal), decimal_places (digits after decimal)
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (may be in values from [[Module:Convert]])
if num:sub(1, #MINUS) == MINUS then
num = '-' .. num:sub(#MINUS + 1) -- replace MINUS with '-'
elseif num:sub(1, 1) == '+' then
num = num:sub(2) -- ignore any '+'
end
local negative = num:find("^%-")
local decimal_places, subs = num:gsub("^%-?%d*%.(%d+)$", "%1")
if subs == 0 then decimal_places = nil end
num, subs = num:gsub("^%-?(%d*)%.?%d*$", "%1")
if num == '' and decimal_places then num = '0' end
if subs == 0 or num == '' then error("Invalid decimal numeral") end
-- For each group of 3 digits except the last one, print with appropriate group name (e.g. million)
local s = ''
while #num > 3 do
if s ~= '' then s = s .. ' ' end
local group_num = math.floor((#num - 1) / 3)
local group = groups[group_num]
local group_digits = #num - group_num*3
s = s .. numeral_to_english_less_1000(num:sub(1, group_digits), false, false, false, zero) .. ' '
if links and (((links == 'on' and group_num >= 3) or links:find(group)) and group_num <= 13) then
s = s .. '[[Orders_of_magnitude_(numbers)#10' .. group_num*3 .. '|' .. group .. ']]'
else
s = s .. group
end
num = num:sub(1 + group_digits)
num = num:gsub("^0*", "") -- Trim leading zeros
end
-- Handle final three digits of integer part
if s ~= '' and num ~= '' then
if #num <= 2 and use_and then
s = s .. ' and '
else
s = s .. ' '
end
end
if s == '' or num ~= '' then
s = s .. numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
elseif ordinal or plural then
-- Round numbers like "one million" take standard suffixes for ordinal/plural
s = s .. standard_suffix(ordinal, plural)
end
-- For decimal places (if any) output "point" followed by spelling out digit by digit
if decimal_places then
s = s .. ' point'
for i = 1, #decimal_places do
s = s .. ' ' .. ones_position[tonumber(decimal_places:sub(i,i))]
end
end
s = s:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
if ordinal and plural then s = s .. 's' end -- s suffix works for all ordinals
if negative and s ~= zero then s = negative_word .. ' ' .. s end
s = s:gsub("negative zero", "zero")
s = s .. fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
local function _numeral_to_english2(args)
local num = tostring(args.num)
num = num:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
num = num:gsub(",", "") -- Remove commas
num = num:gsub("^<span[^<>]*></span>", "") -- Generated by Template:age
if num ~= '' then -- a fraction may have an empty whole number
if not num:find("^%-?%d*%.?%d*%-?[Ee]?[+%-]?%d*$") then
-- Input not in a valid format, try to eval it as an expr to see
-- if that produces a number (e.g. "3 + 5" will become "8").
local noerr, result = pcall(mw.ext.ParserFunctions.expr, num)
if noerr then
num = result
end
end
end
-- Call helper function passing args
return _numeral_to_english(
num,
args['numerator'],
args['denominator'],
args['capitalize'],
args['use_and'],
args['hyphenate'],
args['ordinal'],
args['plural'],
args['links'],
args['negative_word'],
args['round'],
args['zero'],
args['use_one']
) or ''
end
local p = { -- Functions that can be called from another module
roman_to_numeral = roman_to_numeral,
spell_number = _numeral_to_english,
spell_number2 = _numeral_to_english2,
english_to_ordinal = english_to_ordinal,
english_to_numeral = english_to_numeral,
}
function p._roman_to_numeral(frame) -- Callable via {{#invoke:ConvertNumeric|_roman_to_numeral|VI}}
return roman_to_numeral(frame.args[1])
end
function p._english_to_ordinal(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_ordinal|First}}
return english_to_ordinal(frame.args[1])
end
function p._english_to_numeral(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_numeral|One}}
return english_to_numeral(frame.args[1])
end
function p.numeral_to_english(frame)
local args = frame.args
-- Tail call to helper function passing args from frame
return _numeral_to_english2{
['num'] = args[1],
['numerator'] = args['numerator'],
['denominator'] = args['denominator'],
['capitalize'] = args['case'] == 'U' or args['case'] == 'u',
['use_and'] = args['sp'] ~= 'us',
['hyphenate'] = args['adj'] == 'on',
['ordinal'] = args['ord'] == 'on',
['plural'] = args['pl'] == 'on',
['links'] = args['lk'],
['negative_word'] = args['negative'],
['round'] = args['round'],
['zero'] = args['zero'],
['use_one'] = args['one'] == 'one' -- experiment: using '|one=one' makes fraction 2+1/2 give "two and one-half" instead of "two and a half"
}
end
---- recursive function for p.decToHex
local function decToHexDigit(dec)
local dig = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}
local div = math.floor(dec/16)
local mod = dec-(16*div)
if div >= 1 then return decToHexDigit(div)..dig[mod+1] else return dig[mod+1] end
end -- I think this is supposed to be done with a tail call but first I want something that works at all
---- finds all the decimal numbers in the input text and hexes each of them
function p.decToHex(frame)
local args=frame.args
local parent=frame.getParent(frame)
local pargs={}
if parent then pargs=parent.args end
local text=args[1] or pargs[1] or ""
local minlength=args.minlength or pargs.minlength or 1
minlength=tonumber(minlength)
local prowl=mw.ustring.gmatch(text,"(.-)(%d+)")
local output=""
repeat
local chaff,dec=prowl()
if not(dec) then break end
local hex=decToHexDigit(dec)
while (mw.ustring.len(hex)<minlength) do hex="0"..hex end
output=output..chaff..hex
until false
local chaff=mw.ustring.match(text,"(%D+)$") or ""
return output..chaff
end
return p
32bqsl00t9nrljdfxybjoqy5j6ukqjt
17076
17075
2026-07-05T06:44:31Z
Gazartashlomo0907
62
17076
Scribunto
text/plain
-- Module for converting between different representations of numbers. See talk page for user documentation.
-- For unit tests see: [[Module:ConvertNumeric/testcases]]
-- When editing, preview with: [[Module_talk:ConvertNumeric/testcases]]
-- First, edit [[Module:ConvertNumeric/sandbox]], then preview with [[Module_talk:ConvertNumeric/sandbox/testcases]]
require('strict')
local ones_position = {
[0] = 'nol',
[1] = 'sada',
[2] = 'dua',
[3] = 'tolu',
[4] = 'opat',
[5] = 'lima',
[6] = 'onom',
[7] = 'pitu',
[8] = 'ualu',
[9] = 'sia',
[10] = 'sampulu',
[11] = 'sampulu sada',
[12] = 'sampulu dua',
[13] = 'sampulu tolu',
[14] = 'sampulu opat',
[15] = 'sampulu lima',
[16] = 'sampulu onom',
[17] = 'sampulu pitu',
[18] = 'sampulu ualu',
[19] = 'sampulu sia'
}
local ones_position_ord = {
[0] = 'nol',
[1] = 'parjolo',
[2] = 'paduahon',
[3] = 'patoluhon',
[4] = 'paopathon',
[5] = 'palimahon',
[6] = 'paonomhon',
[7] = 'papituhon',
[8] = 'paualuhon',
[9] = 'pasiahon',
[10] = 'pasampuluhon',
[11] = 'pasampulusiahon',
[12] = 'pasampuluduahon',
[13] = 'pasampulutoluhon',
[14] = 'pasampuluopathon',
[15] = 'pasampululimahon',
[16] = 'pasampuluonomhon',
[17] = 'pasampulupituhon',
[18] = 'pasampulualuhon',
[19] = 'pasampulusiahon'
}
local ones_position_plural = {
[0] = 'zeros',
[1] = 'ones',
[2] = 'twos',
[3] = 'threes',
[4] = 'fours',
[5] = 'fives',
[6] = 'sixes',
[7] = 'sevens',
[8] = 'eights',
[9] = 'nines',
[10] = 'tens',
[11] = 'elevens',
[12] = 'twelves',
[13] = 'thirteens',
[14] = 'fourteens',
[15] = 'fifteens',
[16] = 'sixteens',
[17] = 'seventeens',
[18] = 'eighteens',
[19] = 'nineteens'
}
local tens_position = {
[2] = 'dua pulu',
[3] = 'tolu pulu',
[4] = 'opat pulu',
[5] = 'lima pulu',
[6] = 'onom pulu',
[7] = 'pitu pulu',
[8] = 'ualu pulu',
[9] = 'sia pulu'
}
local tens_position_ord = {
[2] = 'paduapuluhon',
[3] = 'patolupuluhon',
[4] = 'paopatpuluhon',
[5] = 'palimapuluhon',
[6] = 'panonompuluhon',
[7] = 'papitupuluhon',
[8] = 'paualupuluhon',
[9] = 'pasiapuluhon'
}
local tens_position_plural = {
[2] = 'twenties',
[3] = 'thirties',
[4] = 'forties',
[5] = 'fifties',
[6] = 'sixties',
[7] = 'seventies',
[8] = 'eighties',
[9] = 'nineties'
}
local groups = {
[1] = 'thousand',
[2] = 'million',
[3] = 'billion',
[4] = 'trillion',
[5] = 'quadrillion',
[6] = 'quintillion',
[7] = 'sextillion',
[8] = 'septillion',
[9] = 'octillion',
[10] = 'nonillion',
[11] = 'decillion',
[12] = 'undecillion',
[13] = 'duodecillion',
[14] = 'tredecillion',
[15] = 'quattuordecillion',
[16] = 'quindecillion',
[17] = 'sexdecillion',
[18] = 'septendecillion',
[19] = 'octodecillion',
[20] = 'novemdecillion',
[21] = 'vigintillion',
[22] = 'unvigintillion',
[23] = 'duovigintillion',
[24] = 'tresvigintillion',
[25] = 'quattuorvigintillion',
[26] = 'quinquavigintillion',
[27] = 'sesvigintillion',
[28] = 'septemvigintillion',
[29] = 'octovigintillion',
[30] = 'novemvigintillion',
[31] = 'trigintillion',
[32] = 'untrigintillion',
[33] = 'duotrigintillion',
[34] = 'trestrigintillion',
[35] = 'quattuortrigintillion',
[36] = 'quinquatrigintillion',
[37] = 'sestrigintillion',
[38] = 'septentrigintillion',
[39] = 'octotrigintillion',
[40] = 'noventrigintillion',
[41] = 'quadragintillion',
[51] = 'quinquagintillion',
[61] = 'sexagintillion',
[71] = 'septuagintillion',
[81] = 'octogintillion',
[91] = 'nonagintillion',
[101] = 'centillion',
[102] = 'uncentillion',
[103] = 'duocentillion',
[104] = 'trescentillion',
[111] = 'decicentillion',
[112] = 'undecicentillion',
[121] = 'viginticentillion',
[122] = 'unviginticentillion',
[131] = 'trigintacentillion',
[141] = 'quadragintacentillion',
[151] = 'quinquagintacentillion',
[161] = 'sexagintacentillion',
[171] = 'septuagintacentillion',
[181] = 'octogintacentillion',
[191] = 'nonagintacentillion',
[201] = 'ducentillion',
[301] = 'trecentillion',
[401] = 'quadringentillion',
[501] = 'quingentillion',
[601] = 'sescentillion',
[701] = 'septingentillion',
[801] = 'octingentillion',
[901] = 'nongentillion',
[1001] = 'millinillion',
}
local roman_numerals = {
I = 1,
V = 5,
X = 10,
L = 50,
C = 100,
D = 500,
M = 1000
}
local engord_tens_end = {
['twentieth'] = 20,
['thirtieth'] = 30,
['fortieth'] = 40,
['fiftieth'] = 50,
['sixtieth'] = 60,
['seventieth'] = 70,
['eightieth'] = 80,
['ninetieth'] = 90,
}
local eng_tens_cont = {
['dua pulu'] = 20,
['tolu pulu'] = 30,
['opat pulu'] = 40,
['lima pulu'] = 50,
['onom pulu'] = 60,
['pitu pulu'] = 70,
['ualu pulu'] = 80,
['sia pulu'] = 90,
}
-- Converts a given valid roman numeral (and some invalid roman numerals) to a number. Returns { -1, errorstring } on error.
local function roman_to_numeral(roman)
if type(roman) ~= "string" then return -1, "roman numeral not a string" end
local rev = roman:reverse()
local raising = true
local last = 0
local result = 0
for i = 1, #rev do
local c = rev:sub(i, i)
local next = roman_numerals[c]
if next == nil then return -1, "roman numeral contains illegal character " .. c end
if next > last then
result = result + next
raising = true
elseif next < last then
result = result - next
raising = false
elseif raising then
result = result + next
else
result = result - next
end
last = next
end
return result
end
-- Converts a given integer between 0 and 100 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_100(num, ordinal, plural, zero)
local terminal_ones, terminal_tens
if ordinal then
terminal_ones = ones_position_ord
terminal_tens = tens_position_ord
elseif plural then
terminal_ones = ones_position_plural
terminal_tens = tens_position_plural
else
terminal_ones = ones_position
terminal_tens = tens_position
end
if num == 0 and zero ~= nil then
return zero
elseif num < 20 then
return terminal_ones[num]
elseif num % 10 == 0 then
return terminal_tens[num / 10]
else
return tens_position[math.floor(num / 10)] .. '-' .. terminal_ones[num % 10]
end
end
local function standard_suffix(ordinal, plural)
if ordinal then return 'th' end
if plural then return 's' end
return ''
end
-- Converts a given integer (in string form) between 0 and 1000 to English text (e.g. 47 -> forty-seven).
local function numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
num = tonumber(num)
if num < 100 then
return numeral_to_english_less_100(num, ordinal, plural, zero)
elseif num % 100 == 0 then
return ones_position[num/100] .. ' hundred' .. standard_suffix(ordinal, plural)
else
return ones_position[math.floor(num/100)] .. ' hundred ' .. (use_and and 'and ' or '') .. numeral_to_english_less_100(num % 100, ordinal, plural, zero)
end
end
-- Converts an ordinal in English text from 'zeroth' to 'ninety-ninth' inclusive to a number [0–99], else -1.
local function english_to_ordinal(english)
local eng = string.lower(english or '')
local engord_lt20 = {} -- ones_position_ord{} keys & values swapped
for k, v in pairs( ones_position_ord ) do
engord_lt20[v] = k
end
if engord_lt20[eng] then
return engord_lt20[eng] -- e.g. first -> 1
elseif engord_tens_end[eng] then
return engord_tens_end[eng] -- e.g. ninetieth -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = engord_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-ninth -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number in English text from 'zero' to 'ninety-nine' inclusive to a number [0–99], else -1.
local function english_to_numeral(english)
local eng = string.lower(english or '')
local eng_lt20 = { ['single'] = 1 } -- ones_position{} keys & values swapped
for k, v in pairs( ones_position ) do
eng_lt20[v] = k
end
if eng_lt20[eng] then
return eng_lt20[eng] -- e.g. one -> 1
elseif eng_tens_cont[eng] then
return eng_tens_cont[eng] -- e.g. ninety -> 90
else
local tens, ones = string.match(eng, '^([a-z]+)[%s%-]+([a-z]+)$')
if tens and ones then
local tens_cont = eng_tens_cont[tens]
local ones_end = eng_lt20[ones]
if tens_cont and ones_end then
return tens_cont + ones_end -- e.g. ninety-nine -> 99
end
end
end
return -1 -- Failed
end
-- Converts a number expressed as a string in scientific notation to a string in standard decimal notation
-- e.g. 1.23E5 -> 123000, 1.23E-5 = .0000123. Conversion is exact, no rounding is performed.
local function scientific_notation_to_decimal(num)
local exponent, subs = num:gsub("^%-?%d*%.?%d*%-?[Ee]([+%-]?%d+)$", "%1")
if subs == 0 then return num end -- Input not in scientific notation, just return unmodified
exponent = tonumber(exponent)
local negative = num:find("^%-")
local _, decimal_pos = num:find("%.")
-- Mantissa will consist of all decimal digits with no decimal point
local mantissa = num:gsub("^%-?(%d*)%.?(%d*)%-?[Ee][+%-]?%d+$", "%1%2")
if negative and decimal_pos then decimal_pos = decimal_pos - 1 end
if not decimal_pos then decimal_pos = #mantissa + 1 end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
-- Shift decimal point right for exponent > 0
while exponent > 0 do
decimal_pos = decimal_pos + 1
exponent = exponent - 1
if decimal_pos > #mantissa + 1 then mantissa = mantissa .. '0' end
-- Remove leading zeros unless decimal point is in first position
while decimal_pos > 1 and mantissa:sub(1,1) == '0' do
mantissa = mantissa:sub(2)
decimal_pos = decimal_pos - 1
end
end
-- Shift decimal point left for exponent < 0
while exponent < 0 do
if decimal_pos == 1 then
mantissa = '0' .. mantissa
else
decimal_pos = decimal_pos - 1
end
exponent = exponent + 1
end
-- Insert decimal point in correct position and return
return (negative and '-' or '') .. mantissa:sub(1, decimal_pos - 1) .. '.' .. mantissa:sub(decimal_pos)
end
-- Rounds a number to the nearest integer (NOT USED)
local function round_num(x)
if x%1 >= 0.5 then
return math.ceil(x)
else
return math.floor(x)
end
end
-- Rounds a number to the nearest two-word number (round = up, down, or "on" for round to nearest).
-- Numbers with two digits before the decimal will be rounded to an integer as specified by round.
-- Larger numbers will be rounded to a number with only one nonzero digit in front and all other digits zero.
-- Negative sign is preserved and does not count towards word limit.
local function round_for_english(num, round)
-- If an integer with at most two digits, just return
if num:find("^%-?%d?%d%.?$") then return num end
local negative = num:find("^%-")
if negative then
-- We're rounding magnitude so flip it
if round == 'up' then round = 'down' elseif round == 'down' then round = 'up' end
end
-- If at most two digits before decimal, round to integer and return
local _, _, small_int, trailing_digits, round_digit = num:find("^%-?(%d?%d?)%.((%d)%d*)$")
if small_int then
if small_int == '' then small_int = '0' end
if (round == 'up' and trailing_digits:find('[1-9]')) or (round == 'on' and tonumber(round_digit) >= 5) then
small_int = tostring(tonumber(small_int) + 1)
end
return (negative and '-' or '') .. small_int
end
-- When rounding up, any number with > 1 nonzero digit will round up (e.g. 1000000.001 rounds up to 2000000)
local nonzero_digits = 0
for digit in num:gfind("[1-9]") do
nonzero_digits = nonzero_digits + 1
end
num = num:gsub("%.%d*$", "") -- Remove decimal part
-- Second digit used to determine which way to round lead digit
local _, _, lead_digit, round_digit, round_digit_2, rest = num:find("^%-?(%d)(%d)(%d)(%d*)$")
if tonumber(lead_digit .. round_digit) < 20 and (1 + #rest) % 3 == 0 then
-- In English numbers < 20 are one word so put 2 digits in lead and round based on 3rd
lead_digit = lead_digit .. round_digit
round_digit = round_digit_2
else
rest = round_digit_2 .. rest
end
if (round == 'up' and nonzero_digits > 1) or (round == 'on' and tonumber(round_digit) >= 5) then
lead_digit = tostring(tonumber(lead_digit) + 1)
end
-- All digits but lead digit will turn to zero
rest = rest:gsub("%d", "0")
return (negative and '-' or '') .. lead_digit .. '0' .. rest
end
local denominators = {
[2] = { 'half', plural = 'halves' },
[3] = { 'third' },
[4] = { 'quarter', us = 'fourth' },
[5] = { 'fifth' },
[6] = { 'sixth' },
[8] = { 'eighth' },
[9] = { 'ninth' },
[10] = { 'tenth' },
[16] = { 'sixteenth' },
}
-- Return status, fraction where:
-- status is a string:
-- "finished" if there is a fraction with no whole number;
-- "ok" if fraction is empty or valid;
-- "unsupported" if bad fraction;
-- fraction is a string giving (numerator / denominator) as English text, or is "".
-- Only unsigned fractions with a very limited range of values are supported,
-- except that if whole is empty, the numerator can use "-" to indicate negative.
-- whole (string or nil): nil or "" if no number before the fraction
-- numerator (string or nil): numerator, if any (default = 1 if a denominator is given)
-- denominator (string or nil): denominator, if any
-- sp_us (boolean): true if sp=us
-- negative_word (string): word to use for negative sign, if whole is empty
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function fraction_to_english(whole, numerator, denominator, sp_us, negative_word, use_one)
if numerator or denominator then
local finished = (whole == nil or whole == '')
local sign = ''
if numerator then
if finished and numerator:sub(1, 1) == '-' then
numerator = numerator:sub(2)
sign = negative_word .. ' '
end
else
numerator = '1'
end
if not numerator:match('^%d+$') or not denominator or not denominator:match('^%d+$') then
return 'unsupported', ''
end
numerator = tonumber(numerator)
denominator = tonumber(denominator)
local dendata = denominators[denominator]
if not (dendata and 1 <= numerator and numerator <= 99) then
return 'unsupported', ''
end
local numstr, denstr
local sep = '-'
if numerator == 1 then
denstr = sp_us and dendata.us or dendata[1]
if finished or use_one then
numstr = 'one'
elseif denstr:match('^[aeiou]') then
numstr = 'an'
sep = ' '
else
numstr = 'a'
sep = ' '
end
else
numstr = numeral_to_english_less_100(numerator)
denstr = dendata.plural
if not denstr then
denstr = (sp_us and dendata.us or dendata[1]) .. 's'
end
end
if finished then
return 'finished', sign .. numstr .. sep .. denstr
end
return 'ok', ' and ' .. numstr .. sep .. denstr
end
return 'ok', ''
end
-- Takes a decimal number and converts it to English text.
-- Return nil if a fraction cannot be converted (only some numbers are supported for fractions).
-- num (string or nil): the number to convert.
-- Can be an arbitrarily large decimal, such as "-123456789123456789.345", and
-- can use scientific notation (e.g. "1.23E5").
-- May fail for very large numbers not listed in "groups" such as "1E4000".
-- num is nil if there is no whole number before a fraction.
-- numerator (string or nil): numerator of fraction (nil if no fraction)
-- denominator (string or nil): denominator of fraction (nil if no fraction)
-- capitalize (boolean): whether to capitalize the result (e.g. 'One' instead of 'one')
-- use_and (boolean): whether to use the word 'and' between tens/ones place and higher places
-- hyphenate (boolean): whether to hyphenate all words in the result, useful as an adjective
-- ordinal (boolean): whether to produce an ordinal (e.g. 'first' instead of 'one')
-- plural (boolean): whether to pluralize the resulting number
-- links: nil: do not add any links; 'on': link "billion" and larger to Orders of magnitude article;
-- any other text: list of numbers to link (e.g. "billion,quadrillion")
-- negative_word: word to use for negative sign (typically 'negative' or 'minus'; nil to use default)
-- round: nil or '': no rounding; 'on': round to nearest two-word number; 'up'/'down': round up/down to two-word number
-- zero: word to use for value '0' (nil to use default)
-- use_one (boolean): false: 2+1/2 → "two and a half"; true: "two and one-half"
local function _numeral_to_english(num, numerator, denominator, capitalize, use_and, hyphenate, ordinal, plural, links, negative_word, round, zero, use_one)
if not negative_word then
if use_and then
-- TODO Should 'minus' be used when do not have sp=us?
-- If so, need to update testcases, and need to fix "minus zero".
-- negative_word = 'minus'
negative_word = 'negative'
else
negative_word = 'negative'
end
end
local status, fraction_text = fraction_to_english(num, numerator, denominator, not use_and, negative_word, use_one)
if status == 'unsupported' then
return nil
end
if status == 'finished' then
-- Input is a fraction with no whole number.
-- Hack to avoid executing stuff that depends on num being a number.
local s = fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
num = scientific_notation_to_decimal(num)
if round and round ~= '' then
if round ~= 'on' and round ~= 'up' and round ~= 'down' then
error("Invalid rounding mode")
end
num = round_for_english(num, round)
end
-- Separate into negative sign, num (digits before decimal), decimal_places (digits after decimal)
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (may be in values from [[Module:Convert]])
if num:sub(1, #MINUS) == MINUS then
num = '-' .. num:sub(#MINUS + 1) -- replace MINUS with '-'
elseif num:sub(1, 1) == '+' then
num = num:sub(2) -- ignore any '+'
end
local negative = num:find("^%-")
local decimal_places, subs = num:gsub("^%-?%d*%.(%d+)$", "%1")
if subs == 0 then decimal_places = nil end
num, subs = num:gsub("^%-?(%d*)%.?%d*$", "%1")
if num == '' and decimal_places then num = '0' end
if subs == 0 or num == '' then error("Invalid decimal numeral") end
-- For each group of 3 digits except the last one, print with appropriate group name (e.g. million)
local s = ''
while #num > 3 do
if s ~= '' then s = s .. ' ' end
local group_num = math.floor((#num - 1) / 3)
local group = groups[group_num]
local group_digits = #num - group_num*3
s = s .. numeral_to_english_less_1000(num:sub(1, group_digits), false, false, false, zero) .. ' '
if links and (((links == 'on' and group_num >= 3) or links:find(group)) and group_num <= 13) then
s = s .. '[[Orders_of_magnitude_(numbers)#10' .. group_num*3 .. '|' .. group .. ']]'
else
s = s .. group
end
num = num:sub(1 + group_digits)
num = num:gsub("^0*", "") -- Trim leading zeros
end
-- Handle final three digits of integer part
if s ~= '' and num ~= '' then
if #num <= 2 and use_and then
s = s .. ' and '
else
s = s .. ' '
end
end
if s == '' or num ~= '' then
s = s .. numeral_to_english_less_1000(num, use_and, ordinal, plural, zero)
elseif ordinal or plural then
-- Round numbers like "one million" take standard suffixes for ordinal/plural
s = s .. standard_suffix(ordinal, plural)
end
-- For decimal places (if any) output "point" followed by spelling out digit by digit
if decimal_places then
s = s .. ' point'
for i = 1, #decimal_places do
s = s .. ' ' .. ones_position[tonumber(decimal_places:sub(i,i))]
end
end
s = s:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
if ordinal and plural then s = s .. 's' end -- s suffix works for all ordinals
if negative and s ~= zero then s = negative_word .. ' ' .. s end
s = s:gsub("negative zero", "zero")
s = s .. fraction_text
if hyphenate then s = s:gsub("%s", "-") end
if capitalize then s = s:gsub("^%l", string.upper) end
return s
end
local function _numeral_to_english2(args)
local num = tostring(args.num)
num = num:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace
num = num:gsub(",", "") -- Remove commas
num = num:gsub("^<span[^<>]*></span>", "") -- Generated by Template:age
if num ~= '' then -- a fraction may have an empty whole number
if not num:find("^%-?%d*%.?%d*%-?[Ee]?[+%-]?%d*$") then
-- Input not in a valid format, try to eval it as an expr to see
-- if that produces a number (e.g. "3 + 5" will become "8").
local noerr, result = pcall(mw.ext.ParserFunctions.expr, num)
if noerr then
num = result
end
end
end
-- Call helper function passing args
return _numeral_to_english(
num,
args['numerator'],
args['denominator'],
args['capitalize'],
args['use_and'],
args['hyphenate'],
args['ordinal'],
args['plural'],
args['links'],
args['negative_word'],
args['round'],
args['zero'],
args['use_one']
) or ''
end
local p = { -- Functions that can be called from another module
roman_to_numeral = roman_to_numeral,
spell_number = _numeral_to_english,
spell_number2 = _numeral_to_english2,
english_to_ordinal = english_to_ordinal,
english_to_numeral = english_to_numeral,
}
function p._roman_to_numeral(frame) -- Callable via {{#invoke:ConvertNumeric|_roman_to_numeral|VI}}
return roman_to_numeral(frame.args[1])
end
function p._english_to_ordinal(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_ordinal|First}}
return english_to_ordinal(frame.args[1])
end
function p._english_to_numeral(frame) -- callable via {{#invoke:ConvertNumeric|_english_to_numeral|One}}
return english_to_numeral(frame.args[1])
end
function p.numeral_to_english(frame)
local args = frame.args
-- Tail call to helper function passing args from frame
return _numeral_to_english2{
['num'] = args[1],
['numerator'] = args['numerator'],
['denominator'] = args['denominator'],
['capitalize'] = args['case'] == 'U' or args['case'] == 'u',
['use_and'] = args['sp'] ~= 'us',
['hyphenate'] = args['adj'] == 'on',
['ordinal'] = args['ord'] == 'on',
['plural'] = args['pl'] == 'on',
['links'] = args['lk'],
['negative_word'] = args['negative'],
['round'] = args['round'],
['zero'] = args['zero'],
['use_one'] = args['one'] == 'one' -- experiment: using '|one=one' makes fraction 2+1/2 give "two and one-half" instead of "two and a half"
}
end
---- recursive function for p.decToHex
local function decToHexDigit(dec)
local dig = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}
local div = math.floor(dec/16)
local mod = dec-(16*div)
if div >= 1 then return decToHexDigit(div)..dig[mod+1] else return dig[mod+1] end
end -- I think this is supposed to be done with a tail call but first I want something that works at all
---- finds all the decimal numbers in the input text and hexes each of them
function p.decToHex(frame)
local args=frame.args
local parent=frame.getParent(frame)
local pargs={}
if parent then pargs=parent.args end
local text=args[1] or pargs[1] or ""
local minlength=args.minlength or pargs.minlength or 1
minlength=tonumber(minlength)
local prowl=mw.ustring.gmatch(text,"(.-)(%d+)")
local output=""
repeat
local chaff,dec=prowl()
if not(dec) then break end
local hex=decToHexDigit(dec)
while (mw.ustring.len(hex)<minlength) do hex="0"..hex end
output=output..chaff..hex
until false
local chaff=mw.ustring.match(text,"(%D+)$") or ""
return output..chaff
end
return p
h27937bkfqn4jk3lp3bc9ezbwcbnm5r