https://github.com/arrayiterator/json-dhikr
https://github.com/arrayiterator/json-dhikr
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/arrayiterator/json-dhikr
- Owner: ArrayIterator
- License: mit
- Created: 2020-08-14T10:19:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-21T08:51:49.000Z (over 5 years ago)
- Last Synced: 2025-02-15T06:30:39.153Z (10 months ago)
- Language: PHP
- Size: 272 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## DOA
### STRUCTURES
```json
[
{
"title_en": "(string) title on english (en) as identifier",
"title_id": "(string) title on indonesian (id) as identifier",
"type": "(string) data type purpose for (note|dua)",
"pre_contents": [
{
"pre_text_id": "(string|null) string if there are content otherwise null of pre text before text (arabic)",
"post_text_id": "(string|null) string if there are content otherwise null of pre text after inline_post_translation_(id) / end of text",
"text": "(string|null) string arabic text otherwise null",
"translation_id": "(string|null) translation or notes, id as identifier. (add double quote to text)",
"inline_pre_translation_id": "(string|null) string or null, put in-line (one line) before translation start",
"inline_post_translation_id": "(string|null) string or null, put in-line (one line) after translation end"
}
],
"contents": [
{
"pre_text_id": "(string|null) string if there are content otherwise null of pre text before text (arabic)",
"post_text_id": "(string|null) string if there are content otherwise null of pre text after inline_post_translation_(id) / end of text",
"text": "(string|null) string arabic text otherwise null",
"translation_id": "(string|null) translation or notes, id as identifier. (add double quote to text)",
"inline_pre_translation_id": "(string|null) string or null, put in-line (one line) before translation start",
"inline_post_translation_id": "(string|null) string or null, put in-line (one line) after translation end"
}
]
}
]
```
### SAMPLE
if there are new lines on contents value of string, please add it as list. (ul/li)
```javascript
// object doa
var doa = [{}];
function convertTo(data, tag, isRTL, attr)
{
if (!data) {
return '';
}
tag = tag ? tag : 'div';
attr = attr && typeof attr === 'string' ? attr : '';
attr = attr.trim();
var html = isRTL ? '<'+tag+' dir="rtl" '+attr+'>' : '
';
if (data.match(/[\n]/)) {
var new_data = data.split("\n");
html += "";
for (i = 0;new_data.length > i;i++) {
html += "- "+new_data[i]+"
";
}
html += "
";
} else {
html += data;
}
html += ''+tag+'>';
return html;
}
var allHtmls = [];
for (var rootKey in doa) {
if (!doa.hasOwnProperty(rootKey)) {
continue;
}
var currentDoa = doa[rootKey];
if (typeof currentDoa['contents'] === 'undefined'
|| !currentDoa['contents']
|| currentDoa['contents'] !== 'object'
|| !currentDoa['contents'].length
) {
continue;
}
var title = currentDoa['title_id']||null;
if (!title_id) {
continue;
}
var html = '
'+title+'
';
var currentContents = currentDoa['contents'];
html += '';
for (var i=0; currentContents.length > i;i++) {
var current = currentContents[i];
var pre = current['pre_text_id'];
var post = current['post_text_id'];
var text = current['text'];
var trans = current['translation_id'];
var inline_pre = current['inline_pre_translation_id'];
var inline_post = current['inline_post_translation_id'];
if (pre) {
// pre is paragraf
html += convertTo(pre, 'p', false, 'class="pre-text"');
}
if (text) {
// text is div cause it was arabian
html += convertTo(pre, 'div', true, 'class="arabian-text rtl"');
}
var currentTrans = '';
if (inline_pre) {
// put pre of translation use span
currentTrans += convertTo(inline_pre, 'span', false, 'class="pre-trans"') + ' '; // add 1 space
}
if (trans) {
currentTrans += '"'+ convertTo(trans, 'span', false, 'class="trans"') +'"'; // add double quotes
}
if (inline_post) {
// put post of translation
currentTrans += ' ' + convertTo(inline_post, 'span', false, 'class="post-trans"') + ' '; // add 1 space before
}
if (currentTrans !== '') {
// if is on trans
html += convertTo(pre, 'p', false, 'class="translation-info"');
}
if (post) {
// post is paragraf
html += convertTo(pre, 'p', false, 'class="post-text"');
}
}
html+= '
';
allHtmls.push(html);
}
// console.log(allHtmls);
```
### DESCRIPTION OF DOA LIST KEYS
> `title_`(string|iso code: en|id) : important
Title in display mode, and must be show as heading text
> `contents` (array|list of doa: array[]) : important
List of doa on sections of title.
> Sample Structure:
```html
{title_id}
{pre_contents.pre_text_id}
{pre_contents.text}
{pre_contents.inline_pre_translation_id}
{pre_contents.translation_id}
{pre_contents.inline_post_translation_id}
{pre_contents.post_text_id}
{contents.pre_text_id}
{contents.text}
{contents.inline_pre_translation_id}
{contents.translation_id}
{contents.inline_post_translation_id}
{contents.post_text_id}
```
## MANASIK
No `inline_pre_translation_id` & `inline_post_translation_id`
### STRUCTURES
```json
[
{
"title_en": "(string) title on english (en) as identifier",
"title_id": "(string) title on indonesian (id) as identifier",
"type": "(string) data type purpose for (section)",
"pre_contents": [
{
"pre_text_id": "(string|null) string if there are content otherwise null of pre text before text (arabic)",
"post_text_id": "(string|null) string if there are content otherwise null end of text",
"text": "(string|null) string arabic text otherwise null",
"translation_id": "(string|null) translation or notes, id as identifier. (add double quote to text)"
}
],
"contents": [
{
"pre_text_id": "(string|null) string if there are content otherwise null of pre text before text (arabic)",
"post_text_id": "(string|null) string if there are content otherwise null end of text",
"text": "(string|null) string arabic text otherwise null",
"translation_id": "(string|null) translation or notes, id as identifier. (add double quote to text)"
}
],
"section": [
[
{
"title_id": "(string) title on indonesian (id) as identifier",
"type": "(string) data type purpose for (list|note)",
"pre_text_id": "(string|null) string if there are content otherwise null of pre text before text (arabic)",
"post_text_id": "(string|null) string if there are content otherwise null end of text",
"text": "(string|null) string arabic text otherwise null",
"translation_id": "(string|null) translation or notes, id as identifier. (add double quote to text)",
"pre_contents": ["See @pre_contents"],
"contents": ["see @contents"],
"list":[
{
"pre_text_id": "(string|null) string if there are content otherwise null of pre text before text (arabic)",
"post_text_id": "(string|null) string if there are content otherwise null end of text",
"text": "(string|null) string arabic text otherwise null",
"translation_id": "(string|null) translation or notes, id as identifier. (add double quote to text)",
"type": "(string) data type purpose for (sublist|note) `note` key as a `contents`",
"sublist": [
"*@inheritance type(note|list)"
],
"pre_contents": [],
"contents": []
}
]
}
]
]
}
]
```