ಮಾಡ್ಯೂಲ್:Databox
ಈ ಮಾಡ್ಯೂಲ್ ವಿಕಿಡೇಟಾ (Wikidata) ಆಧಾರಿತ ಅತ್ಯಂತ ಸರಳವಾದ ಇನ್ಫೋಬಾಕ್ಸ್ (infobox) ವ್ಯವಸ್ಥೆಯನ್ನು ಒದಗಿಸುತ್ತದೆ.

ಇದು ಸಂಪೂರ್ಣವಾಗಿ ಸ್ವಯಂಚಾಲಿತವಾಗಿದೆ, ಇದನ್ನು ಬಳಸಲು ಯಾವುದೇ ಸಂರಚನೆಯ ಅಗತ್ಯವಿಲ್ಲ ಮತ್ತು ಅಸ್ತಿತ್ವದ ಪ್ರಕಾರಕ್ಕೆ (ವ್ಯಕ್ತಿ, ಸ್ಥಳ...) ಅನುಗುಣವಾಗಿ ಯಾವುದೇ ಬದಲಾವಣೆಗಳನ್ನು ಹೊಂದುವುದಿಲ್ಲ.
ಇದು ಹೇಗೆ ಕೆಲಸ ಮಾಡುತ್ತದೆ?
[ಬದಲಾಯಿಸಿ]ಈ ಮಾಡ್ಯೂಲ್ Databox template ನ ಬ್ಯಾಕೆಂಡ್ ಕೋಡ್ ಆಗಿದೆ.
ಇದು ಪ್ರಸ್ತುತ ಪುಟಕ್ಕೆ ಲಿಂಕ್ ಮಾಡಲಾದ ವಿಕಿಡೇಟಾ ಐಟಂ ಅಥವಾ 'item' ಪ್ಯಾರಾಮೀಟರ್ನಲ್ಲಿ ಭರ್ತಿ ಮಾಡಲಾದ ಐಟಂ ಐಡಿಯನ್ನು ಬಳಸಿಕೊಂಡು ಸ್ವಯಂಚಾಲಿತವಾಗಿ ಇನ್ಫೋಬಾಕ್ಸ್ ಅನ್ನು ನಿರ್ಮಿಸುತ್ತದೆ.
ಇದರ ಮೂಲ ಅಲ್ಗಾರಿದಮ್ ಹೀಗಿದೆ:
- ಇನ್ಫೋಬಾಕ್ಸ್ ಶೀರ್ಷಿಕೆಗಾಗಿ ಐಟಂನ ಲೇಬಲ್ ಅನ್ನು ಬಳಸಿ, ಅಥವಾ ಯಾವುದೂ ಇಲ್ಲದಿದ್ದರೆ, ಪುಟದ ಶೀರ್ಷಿಕೆಯನ್ನು ಬಳಸಿ.
- ಮುಖ್ಯ ಚಿತ್ರಕ್ಕಾಗಿ ಚಿತ್ರ (P18) ರ ಮೌಲ್ಯವನ್ನು ಬಳಸಿ.
- ಡೇಟಾ ಟೇಬಲ್ ಶೀರ್ಷಿಕೆಗಾಗಿ ಉದಾಹರಣೆಗೆ (P31) ರ ಮೌಲ್ಯವನ್ನು ಬಳಸಿ.
- ಐಟಂ ಬಳಸುವ ಎಲ್ಲಾ ಪ್ರಾಪರ್ಟಿಗಳನ್ನು (Properties) ತೆಗೆದುಕೊಂಡು, ಅವುಗಳನ್ನು MediaWiki:Wikibase-SortedProperties ಪ್ರಕಾರ ವಿಂಗಡಿಸಿ, ಮತ್ತು ಪ್ರತಿಯೊಂದಕ್ಕೂ:
- ಪ್ರಾಪರ್ಟಿಯು External identifier, Commons media file ಅಥವಾ Quantity ಡೇಟಾ ಪ್ರಕಾರವನ್ನು ಹೊಂದಿದ್ದರೆ, ಏನನ್ನೂ ಪ್ರದರ್ಶಿಸಬೇಡಿ.
- ಪ್ರಾಪರ್ಟಿಯು ಮಾಡ್ಯೂಲ್ನ 'site_excluded_properties' ಅರ್ರೇನಲ್ಲಿದ್ದರೆ, ಏನನ್ನೂ ಪ್ರದರ್ಶಿಸಬೇಡಿ (ಇನ್ಫೋಬಾಕ್ಸ್ಗಳಲ್ಲಿ ಪ್ರದರ್ಶಿಸಲು ಅಷ್ಟು ಪ್ರಸ್ತುತವಲ್ಲದ ಪ್ರಾಪರ್ಟಿಗಳನ್ನು ಫಿಲ್ಟರ್ ಮಾಡಲು ಇದನ್ನು ಮಾಡಲಾಗುತ್ತದೆ).
- ಪ್ರಾಪರ್ಟಿಯು 5 ಕ್ಕಿಂತ ಹೆಚ್ಚು ಮೌಲ್ಯಗಳನ್ನು ಹೊಂದಿದ್ದರೆ ಏನನ್ನೂ ಪ್ರದರ್ಶಿಸಬೇಡಿ (ಇನ್ಫೋಬಾಕ್ಸ್ನಲ್ಲಿ ದೀರ್ಘ ಪಟ್ಟಿಗಳನ್ನು ತಪ್ಪಿಸಲು).
- "ಅತ್ಯುತ್ತಮ" ಶ್ರೇಯಾಂಕವನ್ನು ಹೊಂದಿರುವ ಮೌಲ್ಯಗಳನ್ನು ಪ್ರದರ್ಶಿಸಲು ಡಿಫಾಲ್ಟ್ Wikibase ರೆಂಡರಿಂಗ್ ವ್ಯವಸ್ಥೆಯನ್ನು ಬಳಸಿ.
- ಸ್ಥಳದ ನಿರ್ದೇಶಾಂಕಗಳ (P625) ಗೆ ಮೌಲ್ಯವಿದ್ದರೆ, Kartographer ಬಳಸಿ ನಕ್ಷೆಯನ್ನು ಪ್ರದರ್ಶಿಸಿ.
ಅನುಸ್ಥಾಪನಾ ಸೂಚನೆಗಳು
[ಬದಲಾಯಿಸಿ]ಮಾಡ್ಯೂಲ್ ಕೋಡ್ ಸೇರಿಸಿ 1. ಡೇಟಾಬಾಕ್ಸ್ ಮಾಡ್ಯೂಲ್ ಅನ್ನು ನಿಮ್ಮ ವಿಕಿಗೆ ಕಾಪಿ-ಪೇಸ್ಟ್ ಮಾಡಿ
Module:Databox-Codeಗೆ ಹೋಗಿ ಮತ್ತು ಕೋಡ್ ಬ್ಲಾಕ್ನಲ್ಲಿರುವ ಎಲ್ಲಾ ವಿಷಯಗಳನ್ನು ಕಾಪಿ ಮಾಡಿ.- ಈ ವಿಷಯಗಳನ್ನು ನಿಮ್ಮ ಸ್ವಂತ ವಿಕಿಯ
Module:Databoxಪುಟಕ್ಕೆ ಪೇಸ್ಟ್ ಮಾಡಿ (ಇನ್ನೂ ಇಲ್ಲದಿದ್ದರೆ, ಒಂದನ್ನು ರಚಿಸಿ).
2. ಹೊಸದಾಗಿ ರಚಿಸಲಾದ ಪುಟದ (Module:Databox) ಸೈಟ್ಲಿಂಕ್ ಅನ್ನು ವಿಕಿಡೇಟಾ ಐಟಂ Module:Databox (Q53931871) ಗೆ ಸೇರಿಸಿ.
ಟೆಂಪ್ಲೇಟ್ ಕೋಡ್ ಸೇರಿಸಿ
3. ಕೆಳಗಿನ ಟೆಂಪ್ಲೇಟ್ ಕೋಡ್ ಅನ್ನು ನಿಮ್ಮ ಸ್ವಂತ ವಿಕಿ Template:Databox ಪುಟಕ್ಕೆ ಕಾಪಿ-ಪೇಸ್ಟ್ ಮಾಡಿ.
4. ಹೊಸದಾಗಿ ರಚಿಸಲಾದ Template:Databox ಪುಟವನ್ನು ವಿಕಿಡೇಟಾ ಐಟಂ Template:Databox (Q20702632) ಗೆ ಸಂಪರ್ಕಿಸಿ.
5. ಟೆಂಪ್ಲೇಟ್ ಅನ್ನು ಪರೀಕ್ಷಿಸಿ
- ವಿಕಿಡೇಟಾ ಐಟಂಗೆ ಸಂಪರ್ಕಗೊಂಡಿರುವ ಲೇಖನವನ್ನು ಎಡಿಟ್ ಮಾಡಿ, ಉದಾಹರಣೆಗೆ ನಿಮ್ಮ ದೇಶದ ರಾಜಧಾನಿ ನಗರ.
- ಎಡಿಟ್ ಸೋರ್ಸ್ (edit source) ವೀಕ್ಷಣೆಗೆ ಹೋಗಿ ಮತ್ತು ಪುಟದ ಮೇಲ್ಭಾಗದಲ್ಲಿ {{Databox}} ಕೋಡ್ ಸೇರಿಸಿ.
- ಪುಟದಲ್ಲಿ ಡೇಟಾಬಾಕ್ಸ್ ಕಾಣಿಸಿಕೊಂಡಿದೆಯೇ ಎಂದು ಪರಿಶೀಲಿಸಲು ಮುನ್ನೋಟ (Preview) ನೋಡಿ, ತದನಂತರ ಬದಲಾವಣೆಗಳನ್ನು ಉಳಿಸಲು ಪ್ರಕಟಿಸಿ.
- ಅಭಿನಂದನೆಗಳು, ನೀವು ನಿಮ್ಮ ಮೊದಲ ಡೇಟಾಬಾಕ್ಸ್ ಅನ್ನು ಸ್ಥಾಪಿಸಿದ್ದೀರಿ!
ಡೇಟಾಬಾಕ್ಸ್ ಡೇಟಾವನ್ನು ಎಡಿಟ್ ಮಾಡಿ
[ಬದಲಾಯಿಸಿ]ಕೆಲವೊಮ್ಮೆ ಡೇಟಾ ತಪ್ಪಾಗಿರಬಹುದು ಅಥವಾ ಹಳೆಯದಾಗಿರಬಹುದು ಮತ್ತು ಅದನ್ನು ಬದಲಾಯಿಸುವ ಅಥವಾ ನವೀಕರಿಸುವ ಅಗತ್ಯವಿರುತ್ತದೆ, ಆದರೆ ನೀವು ಅದನ್ನು ಪ್ರಸ್ತುತ ಪುಟದಿಂದ ಮಾಡಲು ಸಾಧ್ಯವಿಲ್ಲ. ಡೇಟಾಬಾಕ್ಸ್ನಲ್ಲಿ ಕಂಡುಬರುವ ಡೇಟಾವನ್ನು ಸ್ಥಳೀಯವಾಗಿ ಸಂಗ್ರಹಿಸಲಾಗಿರುವುದಿಲ್ಲ, ಇದನ್ನು Wikidata ನಿಂದ ಪಡೆಯಲಾಗುತ್ತದೆ.
ಡೇಟಾಬಾಕ್ಸ್ನಲ್ಲಿ ತೋರಿಸಲಾದ ಡೇಟಾವನ್ನು ಬದಲಾಯಿಸಲು ಅಥವಾ ಎಡಿಟ್ ಮಾಡಲು:
1. ಡೇಟಾಬಾಕ್ಸ್ನಲ್ಲಿರುವ ಹೇಳಿಕೆಯ (statement) ಪಕ್ಕದಲ್ಲಿರುವ ಪೆನ್ಸಿಲ್ ಐಕಾನ್
ಮೇಲೆ ಕ್ಲಿಕ್ ಮಾಡಿ.
2. ಇದು ನಿಮ್ಮನ್ನು ವಿಕಿಡೇಟಾ ಐಟಂನಲ್ಲಿ ಆ ಹೇಳಿಕೆಯನ್ನು ಎಲ್ಲಿ ಸಂಗ್ರಹಿಸಲಾಗಿದೆ ಎಂಬುದಕ್ಕೆ ಕರೆದೊಯ್ಯುತ್ತದೆ.
3. ಸ್ಟೇಟ್ಮೆಂಟ್ ಬಾಕ್ಸ್ನ ಬದಿಯಲ್ಲಿರುವ ಪೆನ್ಸಿಲ್ ಐಕಾನ್ ಮೇಲೆ ಮತ್ತೆ ಕ್ಲಿಕ್ ಮಾಡಿ. ಇದು ವಿಕಿಡೇಟಾದಲ್ಲಿ ಎಡಿಟ್ ಮೋಡ್ ಅನ್ನು ತೆರೆಯುತ್ತದೆ.
- ಇನ್ಪುಟ್ ಫೀಲ್ಡ್ನಲ್ಲಿ ಹೊಸ ಮೌಲ್ಯವನ್ನು ನಮೂದಿಸಿ. ಅಗತ್ಯವಿದ್ದಲ್ಲಿ ಕ್ವಾಲಿಫೈಯರ್ ಅಥವಾ ಉಲ್ಲೇಖಗಳನ್ನು ಸೇರಿಸಿ.
- ಮೌಲ್ಯವು ಹಳೆಯದಾಗಿದ್ದರೂ ಇನ್ನೂ ಸರಿಯಾಗಿದ್ದರೆ (ಜನಗಣತಿ ಡೇಟಾದಂತೆ), ಪೆನ್ಸಿಲ್ ಐಕಾನ್ ಬದಲಿಗೆ ಅದರ ಬಲಭಾಗದಲ್ಲಿರುವ '+' ಐಕಾನ್ ಕ್ಲಿಕ್ ಮಾಡಿ ಮತ್ತು ಹೊಸ ಮೌಲ್ಯವನ್ನು ನಮೂದಿಸಿ.
4. ಹೇಳಿಕೆಯನ್ನು ಪ್ರಕಟಿಸಲು ಚೆಕ್ಮಾರ್ಕ್
ಬಟನ್ ಕ್ಲಿಕ್ ಮಾಡಿ. ಡೇಟಾಬಾಕ್ಸ್ ತಕ್ಷಣವೇ ನವೀಕರಣಗೊಳ್ಳುತ್ತದೆ ಮತ್ತು ಹೊಸ ಮಾಹಿತಿ ಕಾಣಿಸಿಕೊಳ್ಳುತ್ತದೆ.
ಟಿಪ್ಪಣಿಗಳು
[ಬದಲಾಯಿಸಿ]
ಉದಾಹರಣೆಗಳು
[ಬದಲಾಯಿಸಿ]Early Modern Swedish
Lucy
|
ಈಥೈಲ್ ಆಲ್ಕೋಹಾಲ್
|
ಹಬಲ್ ದೂರದರ್ಶಕ
|
4 Vesta
|
atheism
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ಐರನ್ ಮ್ಯಾನ್
|
ಏರ್ ಬಸ್
|
ಎಸ್ಪೆರಾಂಟೊ
![]() |
ಬರ್ಲಿನ್
![]() |
ಡಗ್ಲಸ್ ಆಡಮ್ಸ್
|
No description.
| ಪರಿಮಿತಿ | ವಿವರ | ನಮೂನೆ | ಸ್ಥಾನಮಾನ | |
|---|---|---|---|---|
| from | from | ಪುಟಕ್ಕೆ ಲಿಂಕ್ ಮಾಡಲಾದ ವಿಕಿಡೇಟಾ ಐಟಂ ಬದಲಿಗೆ ನಿರ್ದಿಷ್ಟ ವಿಕಿಡೇಟಾ ಐಟಂನಿಂದ (Q123) ಡೇಟಾವನ್ನು ಹಿಂಪಡೆಯಲು ಡೇಟಾಬಾಕ್ಸ್ ಅನ್ನು ಒತ್ತಾಯಿಸುತ್ತದೆ. | String | ಐಚ್ಛಿಕ |
| useImage | useImage | ವಿಕಿಡೇಟಾ ಎಂಟಿಟಿಯಿಂದ ಬಳಸಲು ಆದ್ಯತೆಯ ಚಿತ್ರದ ಫೈಲ್ ಹೆಸರು | String | ಐಚ್ಛಿಕ |
| excludeProperties | excludeProperties | ಡೇಟಾಬಾಕ್ಸ್ನಿಂದ ತೆಗೆದುಹಾಕಬೇಕಾದ ವಿಕಿಡೇಟಾ ಪ್ರಾಪರ್ಟಿ ಐಡಿಗಳ ಕಾಮಾ ಬೇರ್ಪಡಿಸಿದ ಪಟ್ಟಿ | String | ಐಚ್ಛಿಕ |
ವಿಕಿಟೆಕ್ಸ್ಟ್ ಡೇಟಾಬಾಕ್ಸ್ ಉದಾಹರಣೆಗಳು
[ಬದಲಾಯಿಸಿ]ಕೆಳಗಿನ ಉದಾಹರಣೆಗಳು ಎಡಿಟ್ ಸೋರ್ಸ್ ವೀಕ್ಷಣೆಯಲ್ಲಿ ಡೇಟಾಬಾಕ್ಸ್ ಟೆಂಪ್ಲೇಟ್ ಹೇಗೆ ಕಾಣಿಸಬಹುದು ಎಂಬುದನ್ನು ತೋರಿಸುತ್ತವೆ.
{{Databox}}
- ಡಿಫಾಲ್ಟ್ ಆಯ್ಕೆ. ಇದು ಪುಟಕ್ಕೆ ಸಂಪರ್ಕಗೊಂಡಿರುವ ವಿಕಿಡೇಟಾ ಐಟಂನಿಂದ ಡೇಟಾವನ್ನು ಹಿಂಪಡೆಯುತ್ತದೆ.
{{Databox|from=Q123}}
- ನಿರ್ದಿಷ್ಟಪಡಿಸಿದ ವಿಕಿಡೇಟಾ ಐಟಂನಿಂದ ಡೇಟಾವನ್ನು ಪಡೆಯಲು ಡೇಟಾಬಾಕ್ಸ್ ಅನ್ನು ಒತ್ತಾಯಿಸುತ್ತದೆ.
{{Databox|useImage=filename.jpg}}
- ಡೇಟಾಬಾಕ್ಸ್ನಲ್ಲಿ ಪ್ರದರ್ಶಿಸಲು ಇನ್ನೊಂದು ಚಿತ್ರವನ್ನು (P18) ಹಸ್ತಚಾಲಿತವಾಗಿ ನಿರ್ದಿಷ್ಟಪಡಿಸಿ.
{{Databox|excludeProperties=P123}}
- ಪ್ರಸ್ತುತ ಡೇಟಾಬಾಕ್ಸ್ನಲ್ಲಿ ತೋರಿಸಬಾರದ ವಿಕಿಡೇಟಾ ಪ್ರಾಪರ್ಟಿಗಳ (PID ಗಳು) ಪಟ್ಟಿಯನ್ನು ನಿರ್ದಿಷ್ಟಪಡಿಸಿ.
{{Databox|useImage=filename.jpg|excludeProperties=P123}}
- ಪ್ಯಾರಾಮೀಟರ್ಗಳನ್ನು ಸಂಯೋಜಿಸುವುದು ವಿಷಯದ ಮೇಲೆ ಹೆಚ್ಚಿನ ನಿಯಂತ್ರಣಕ್ಕೆ ಅನುವು ಮಾಡಿಕೊಡುತ್ತದೆ.
ಇದನ್ನೂ ನೋಡಿ
[ಬದಲಾಯಿಸಿ]- ru:Template:Универсальная карточка - ರಷ್ಯನ್ ವಿಕಿಪೀಡಿಯಾದಲ್ಲಿರುವ ಇದೇ ರೀತಿಯ ಆದರೆ ಹೆಚ್ಚು ಅಭಿವೃದ್ಧಿ ಹೊಂದಿದ ಟೆಂಪ್ಲೇಟ್.
- en:Template:Infobox person/Wikidata - ಇಂಗ್ಲಿಷ್ ವಿಕಿಪೀಡಿಯಾದಲ್ಲಿ ಕೇವಲ ವ್ಯಕ್ತಿಗಳಿಗಾಗಿ ಇರುವ ಇದೇ ರೀತಿಯ ಟೆಂಪ್ಲೇಟ್.
- commons:Template:Wikidata Infobox - ಕಾಮನ್ಸ್ನ ಸಮಾನ ರೂಪ; ಹೆಚ್ಚಾಗಿ ವರ್ಗಗಳಿಗಾಗಿ (categories) ಬಳಸಲಾಗುತ್ತದೆ.
-- A more extensive version is stored and documented at the Swedish Wikipedia site, sv.wikipedia.org/wiki/Modul:Databox
-- It is supposed to work for any language.
-- Properties excluded for all Databoxes in Dagbani Wikipedia
local site_excluded_properties = {
'P109', -- signature
'P360', --is a list of
'P4224', --category contains
'P935', -- Commons gallery
'P1472', -- Commons Creator page
'P1612', -- Commons Institution page
'P373', -- Commons category
'P3722', -- Commons maps category
'P1151', -- topic's main Wikimedia portal
'P1424', -- topic's main template
'P910', -- topic's main category
'P1200', -- bodies of water basin category
'P1792', -- category of associated people
'P1464', -- category for people born here
'P1465', -- category for people who died here
'P1791', -- category of people buried here
'P1740', -- category for films shot at this location
'P2033', -- Category for pictures taken with camera
'P2517', -- category for recipients of this award
'P4195', -- category for employees of the organization
'P1754', -- category related to list
'P301', -- category's main topic
'P971', -- category combines topics
'P3876', -- category for alumni of educational institution
'P1753', -- list related to category
'P3921', -- Wikidata SPARQL query equivalent
'P1204', -- Wikimedia portal's main topic
'P1423', -- template's main topic
'P1709', -- equivalent class
'P3950', -- narrower external class
'P2888', -- exact match
'P1382', -- coincident with
'P527', -- has part
'P2670', -- has parts of the class
'P3113', -- does not have part
'P2737', -- union of
'P2738', -- disjoint union of
'P2445', -- metasubclass of
'P1963', -- properties for this type
'P3176', -- uses property
'P1889', -- different from
'P460', -- said to be the same as
'P2959', -- permanent duplicated item
'P2860', -- cites
'P5125', -- wikimedia outline
'P5008', -- on focus list of Wikimedia project
'P2559', -- Wikidata usage instructions
'P1343', -- described by source
'P972', -- catalogu
'P1282', -- OSM tag or key
'P4839', -- Wolfram Language entity code
'P6104', -- Maintained by Wikiproject
'P5996' -- Category for films in this language
}
function valuesToKeys(array)
local result = {}
for _, v in pairs(array) do
result[v] = true
end
return result
end
local p = {}
function p.databox(frame)
local args = frame:getParent().args
local argsLocal = frame.args
local itemId = nil
if args.item then
itemId = args.item
end
local argsLocal = frame.args
local useImage = nil
if argsLocal.useImage then
useImage = argsLocal["useImage"]
end
-- excludeProperties is a local parameter to exclude given properties for a Databox on a specific page
local excludeProperties = {}
if argsLocal.excludeProperties then
for item in string.gmatch(argsLocal.excludeProperties, "[^,]+") do
table.insert(excludeProperties, item)
end
end
local lang = mw.language.getContentLanguage()
local item = mw.wikibase.getEntity(itemId)
if item == nil then
mw.addWarning("Wikidata item not found")
return ""
end
local databoxRoot = mw.html.create('div')
:addClass('infobox')
:css({
float = 'right',
border = '1px solid #aaa',
['max-width'] = '250px',
padding = '0 0.4em',
margin = '0 0 0.4em 0.4em',
})
--Title
databoxRoot:tag('div')
:css({
['text-align'] = 'center',
['background-color'] = '#f5f5f5',
padding = '0.5em 0',
margin = '0.5em 0',
['font-size'] = '120%',
['font-weight'] = 'bold',
})
:wikitext(item:getLabel() or mw.title.getCurrentTitle().text)
--Image
local databoxImage = nil
if useImage and useImage ~= "" then
local allWikidataImages = item:getAllStatements('P18')
if #allWikidataImages >= 1 then
for _, image in ipairs( allWikidataImages ) do
if image.mainsnak.datavalue.value == useImage then
databoxImage = useImage
break
end
end
end
end
if databoxImage == nil then
local bestWikidataImages = item:getBestStatements('P18')
if #bestWikidataImages >= 1 then
databoxImage = bestWikidataImages[1].mainsnak.datavalue.value
end
end
if databoxImage then
databoxRoot
:tag('div')
:wikitext('[[File:' .. databoxImage .. '|frameless|240px|center]]')
end
--Signature (P109)
local signatureImage = nil
local signatureImages = item:getBestStatements('P109')
if #signatureImages >= 1 then
signatureImage = signatureImages[1].mainsnak.datavalue.value
end
if signatureImage then
databoxRoot
:tag('div')
:css({
['text-align'] = 'center',
['font-size'] = '90%',
['font-style'] = 'italic',
padding = '0.2em 0',
})
:wikitext('Signature')
databoxRoot
:tag('div')
:wikitext('[[File:' .. signatureImage .. '|frameless|200px|center]]')
end
--Table
local dataTable = databoxRoot
:tag('table')
:css({
['text-align'] = 'left',
['font-size'] = '90%',
['word-break'] = 'break-word',
['width'] = '100%',
['table-layout'] = 'fixed',
})
dataTable:tag('caption')
:addClass('notheme')
:css({
['background-color'] = '#f5f5f5',
['font-weight'] = 'bold',
['margin-top'] = '0.2em',
})
:wikitext(item:formatStatements('P31').value)
local properties = mw.wikibase.orderProperties(item:getProperties())
local site_excluded_properties_hash = valuesToKeys(site_excluded_properties)
site_excluded_properties_hash['P31'] = true --Special property
local excludeProperties_hash = valuesToKeys(excludeProperties)
local edit_message = mw.message.new('vector-view-edit'):plain()
for _, property in pairs(properties) do
local datatype = item.claims[property][1].mainsnak.datatype
local valueCount = #item:getBestStatements(property)
if datatype ~= 'commonsMedia' and datatype ~= 'external-id' and datatype ~= 'quantity' and datatype ~= 'wikibase-property' and datatype ~= 'geo-shape' and datatype ~= 'tabular-data' and not site_excluded_properties_hash[property] and not excludeProperties_hash[property] and valueCount > 0 and valueCount <= 5 then
local propertyValue = item:formatStatements(property)
dataTable:tag('tr')
:tag('th')
:attr('scope', 'row')
:wikitext(lang:ucfirst(propertyValue.label)):done()
:tag('td')
:wikitext(frame:preprocess(propertyValue.value))
:wikitext(' [[File:OOjs UI icon edit-ltr.svg|' .. edit_message .. '|12px|baseline|class=noviewer|link=https://www.wikidata.org/wiki/' .. item.id .. '#' .. property .. ']]')
end
end
--Map
local coordinates_statements = item:getBestStatements('P625')
if #coordinates_statements >= 1 and coordinates_statements[1].mainsnak.datavalue and coordinates_statements[1].mainsnak.datavalue.value.globe == 'http://www.wikidata.org/entity/Q2' then
--We build the call to mapframe
local latitude = coordinates_statements[1].mainsnak.datavalue.value.latitude
local longitude = coordinates_statements[1].mainsnak.datavalue.value.longitude
local geojson = {
type = 'Feature',
geometry = {
type = 'Point',
coordinates = { longitude, latitude }
},
properties = {
title = item:getLabel() or mw.title.getCurrentTitle().text,
['marker-symbol'] = 'marker',
['marker-color'] = '#224422',
}
}
databoxRoot:wikitext(frame:extensionTag('mapframe', mw.text.jsonEncode(geojson), {
height = 240,
width = 240,
frameless = 'frameless',
align = 'center',
latitude = latitude,
longitude = longitude,
zoom = zoom
}))
end
--Wikidata Link
databoxRoot:tag('div')
:css({
['display'] = 'flex',
padding = '0.3em 0',
['width'] = '100%',
['font-size'] = '90%',
})
:addClass('databox-from-wikidata-link')
:wikitext(' [[File:Wikidata-logo.svg|22px|class=noviewer skin-invert|link=https://www.wikidata.org/wiki/' .. item.id .. ']]')
:tag('div')
:css({
margin = '0.05em 0 0 0',
})
:wikitext(' [[d:' .. item.id .. '|From Wikidata]]')
return tostring(databoxRoot)
end
return p


