Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get HTML data from reader #36

Open
maeyler opened this issue Jul 30, 2023 · 1 comment
Open

get HTML data from reader #36

maeyler opened this issue Jul 30, 2023 · 1 comment

Comments

@maeyler
Copy link
Contributor

maeyler commented Jul 30, 2023

Problem: extract several verses from a given chapter, with the root of each word in data tag

Solution: https://github.com/Okuyun/Kitap/blob/main/ders/huruf.html

  1. open https://okuyun.github.io/Kuran/reader
  2. define the snippets below
  3. run chapToHTML(2, 4) // get from chapter 2 the first 4 verses
// c: chapter [1-114], n: number of verses
chapToHTML = (c,n) => { 
    let i = indexOf(c,1)
    let s = Q.qur.data.slice(i,i+n).map(verseToHTML).join('*\n')
    console.log(header(c)+s+'<br>\n')
}
header = c => `  <tr>
    <td>
<a class=sure href="/Kuran/reader.html#v=${c}:1" target="iqra">${c} ${suraNames.tr[c]}</a>
<span data="harf"></span> 
    <td class=ayet>
<a class=sure href="/Kuran/reader.html#v=${c}:1" target="iqra">${suraNames.ar[c]}</a>
<span data="harf"></span> `
verseToHTML = s => s.split(' ').slice(1).map(wordToHTML).join(' ')
wordToHTML = x => {
    let r = Q.roots.wordToRoot(toBuckwalter(x));
    return r? '<span data='+r+'>'+x+'</span>': x
}
@maeyler
Copy link
Contributor Author

maeyler commented Oct 19, 2023

This is not a real issue -- just a litlle note to myself

I need this snippet often, that's why I placed in an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant