|
| 1 | +place ** where new rows are supposed to start in the word file. |
| 2 | + |
| 3 | +save word file as plain txt, unicode utf 8. |
| 4 | + |
| 5 | +open in google sheets, remove columns after first column, check if they have text first |
| 6 | + |
| 7 | +download as excel file, find and select, go to special, blanks. then in "cells" menu, click delete. save as plain text called input |
| 8 | + |
| 9 | +... |
| 10 | + |
| 11 | +i have text file that looks somewhat like this: |
| 12 | + |
| 13 | +ދަންނާށެވެ! އިސްލާމްދީނަކީ ސުންނަތެވެ. އަދި ސުންނަތަކީ އިސްލާމްދީނެވެ. އެއިން އެއްކަމެއްވެސް އަނެއްކަމާއި ލައިގެން މެނުވީ ޤާއިމްނުވާހުއްޓެވެ.[5] |
| 14 | +** |
| 15 | +ފަހެ ސުންނަތުގެ ތެރޭގައި: ޖަމާޢަތުގައި ލާޒިމްވެހުރުން ހިމެނެއެވެ. ޖަމާޢަތް ފިޔަވައި އެހެން އެއްޗަކަށް އެދުންވެރިވެ އެޖަމާޢަތާއި ވަކިވެގަނެއްޖެމީހާ ފަހެ އިސްލާމްކަމުގެ އުޅައްގަނޑު އޭނާގެ ކަރުން މަހާ އެއްލާލައިފިއެވެ. އަދި އޭނާ ވާހުށީ މަގުފުރެދިގެންވާ މަގުފުރައްދަނިވި މީހެއްކަމުގައިއެވެ.[6]** |
| 16 | +އަދި އެކަމެއްގެ މަތީގައި ޖަމާޢަތް ބިނާވެގެންވާ އަސާސަކީ އަދި އެޖަމާޢަތަކީ: މުޙައްމަދު صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ ގެ އަޞްޙާބުންނެވެ. -އެހުރިހާ ބޭކަލުންނަށް އެކަލާނގެ ރަޙްމަތްލައްވާށިއެވެ- އަދި އެބޭކަލުންނީ އަހުލުއްސުންނާ ވަލްޖަމާޢަތެވެ. ފަހެ އެބޭކަލުންގެ އަރިހުން (ހިދާޔަތާއި މަގު) ނުނަގާ މީހާ، ހަމަކަށަވަރުންވެސް މަގުފުރެދިގަނެ ބިދުޢަ ހަދައިފިއެވެ. އަދި ކޮންމެ ބިދުޢައަކީ މަގުފުރެދުމެކެވެ. އަދި ކޮންމެ މަގުފުރެދުމަކާއި އޭގެ އަހުލުވެރިންވަނީ ނަރަކާގައިއެވެ.[7] |
| 17 | + |
| 18 | +... |
| 19 | + |
| 20 | +every new line should join the line before and after that, with a "#" in between them |
| 21 | + |
| 22 | +after that is done, every "**" should be replaced with a new line |
| 23 | + |
| 24 | +input file is called "input.txt" |
| 25 | + |
| 26 | +output file should be called "output.txt" |
| 27 | + |
| 28 | +do it in js |
| 29 | + |
| 30 | +... |
| 31 | + |
| 32 | + |
| 33 | +open output text in excel. check if any data is in another column. if that data is from footnote, it doesnt matter. |
| 34 | + |
| 35 | +copy plain paste the first column onto google sheets. |
| 36 | + |
| 37 | +download as csv, convert to json via papaparse. |
| 38 | + |
| 39 | +open json in vscode, replace "#" with "\n" (make sure regex is off) |
| 40 | + |
| 41 | +convert to csv |
| 42 | +https://www.convertcsv.com/json-to-csv.htm |
| 43 | +dont include header in first row |
| 44 | + |
| 45 | +import to google sheets |
| 46 | +data cleaup, trim whitespace |
| 47 | + |
| 48 | +regular copy paste (not plain paste) column over to final db table sheet |
| 49 | + |
| 50 | +check whether a row is missing, and fix. maybe you forgot to put a ** somewhere |
| 51 | + |
| 52 | +everything should fit. as for the last row, it will contain footnotes, and maybe fihristh if that was present |
| 53 | + |
| 54 | +... |
| 55 | + |
| 56 | +as for footnotes, you can find them in the initial plain text file we made |
| 57 | + |
| 58 | +look for "[1]" to know where it begins |
| 59 | + |
| 60 | +copy that text over to a new text file called footnotes.txt |
| 61 | + |
| 62 | +replace "\n" with "#" |
| 63 | + |
| 64 | +... |
| 65 | + |
| 66 | +i have a json file 2d array file called "addfootnotes.json" |
| 67 | + |
| 68 | +it looks somewhat like this: |
| 69 | + |
| 70 | + [ |
| 71 | + "އަދި (ސުންނަތުގެ ތެރޭގައި) ޤިޔާމަތްދުވަހު ﷲ ތަޢާލާ ފެންނާނޭކަމަށް އީމާންވުންވެއެވެ. (މުއުމިނުން)ގެ ބޯތަކުގައިވާ ލޯތަކުން ސީދާ އެކަލާނގެ ފެންނަހުއްޓެވެ. އަދި އެއްވެސް ފަރްދާއެއް ތަރްޖަމާނެއްނެތި އެކަލާނގެ އެބައިމީހުންގެ ޙިސާބު ބައްލަވާނެތެވެ.[23]", |
| 72 | + "column2 row1 data" |
| 73 | + ], |
| 74 | + [ |
| 75 | + "އަދި ޤިޔާމަތްދުވަހުގައިވާ ތިލަފަތަށް އީމާންވުމެވެ. އެތިލަފަތުގައި ހެޔޮކަންތަކާއި ނުބައިކަންތައް މިނެކިރޭހުއްޓެވެ. އެތިލަފަތަށް ދެކިބައާއި މެދުދަނޑި ލިބިގެންވެއެވެ.[24]", |
| 76 | + "" |
| 77 | + ], |
| 78 | + [ |
| 79 | + "އަދި ޤަބުރުގެ ޢަޛާބާއި މުންކަރުއާއި ނަކީރު ދެމަލާއިކަތުންނަށް އީމާންވުންވެއެވެ.[25]", |
| 80 | + "" |
| 81 | + ], |
| 82 | + |
| 83 | +i also have a txt file called "footnotes.txt" |
| 84 | + |
| 85 | +it has data similar to the following: |
| 86 | + |
| 87 | +[1] تاريخ بغداد: 13/534 [2] البداية والنهاية: 11/227 [3] طبقات الحنابلة: 2/44-45، المنتظم: 14/14 [4] المنتظم: 14/15 |
| 88 | + |
| 89 | +now what i want you to do is, using js, check the first row of the first column in addfootnotes.json, if it has a number like so "[4]" then look for that same number within the same brackets in the footnotes.txt, and copy all the text (from that number in the footnotes.txt to right before start of the next such number in footnotes.txt) to the second column of the corresponding row in addfootnotes.json. |
| 90 | + |
| 91 | +note that a row in the first column can have multiple such numbers. in which case, copy over the first instance of that number and its text from footnotes.txt, and after that, copy the next such number to the same row in the second column, but after the previous copied over number, seperating them with a new line |
| 92 | + |
| 93 | +output should be called "output.json" |
| 94 | + |
| 95 | +... |
| 96 | + |
| 97 | +that does copy over the text into the second column, but not the number |
| 98 | + |
| 99 | +the output i am getting is: |
| 100 | + |
| 101 | +[ |
| 102 | + "ޢީސާ ބްނު މަރްޔަމް عَلَيْهَا السَّلَام ފައިބާވަޑައިގެންފުމަށް ދާންދެން ޚިލާފަތްވަނީ ޤުރައިޝުވަންހައިގެ ތެރޭގައިއެވެ.[41]", |
| 103 | + "ހުރިހާ މުސްލިމުން ކިޔަމަންވާ އެއް ވެރިޔަކުކަމުގައި ޚަލީފާއެއް ކަނޑައެޅުމަކީ ބޮޑުވެގެންވާ ވާޖިބެކެވެ. އަދި އެއްޒަމާނެއްގައި ދެޚަލީފާއިން ތިބުން ހުއްދަވެގެން", |
| 104 | +] |
| 105 | + |
| 106 | +when i should be getting: |
| 107 | + |
| 108 | +[ |
| 109 | + "ޢީސާ ބްނު މަރްޔަމް عَلَيْهَا السَّلَام ފައިބާވަޑައިގެންފުމަށް ދާންދެން ޚިލާފަތްވަނީ ޤުރައިޝުވަންހައިގެ ތެރޭގައިއެވެ.[41]", |
| 110 | + "[41] ހުރިހާ މުސްލިމުން ކިޔަމަންވާ އެއް ވެރިޔަކުކަމުގައި ޚަލީފާއެއް ކަނޑައެޅުމަކީ ބޮޑުވެގެންވާ ވާޖިބެކެވެ. އަދި އެއްޒަމާނެއްގައި ދެޚަލީފާއިން ތިބުން ހުއްދަވެގެން", |
| 111 | +] |
| 112 | + |
| 113 | +... |
| 114 | + |
| 115 | +remove the |
| 116 | + |
| 117 | +column2 row1 data |
| 118 | +it might exist in more than 1 place |
| 119 | + |
| 120 | +at the beginning |
| 121 | + |
| 122 | +convert json to csv |
| 123 | +dont include header in first row |
| 124 | + |
| 125 | +import to google sheets |
| 126 | + |
| 127 | + |
| 128 | + |
0 commit comments