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

Local enumeration on the website #132

Closed
niruvt opened this issue Feb 13, 2021 · 4 comments
Closed

Local enumeration on the website #132

niruvt opened this issue Feb 13, 2021 · 4 comments

Comments

@niruvt
Copy link
Contributor

niruvt commented Feb 13, 2021

This issue is related to this comment. Auto-generated numerals are Arabic on the website, is there any way to change the script of the numerals. I need Devanagari numerals on my fork for Marathi translation.

https://niranjantambe.github.io/learnlatex.github.io/mr/

@davidcarlisle
Copy link
Member

davidcarlisle commented Feb 13, 2021

Yes we can certainly do that I just experimented here

https://davidcarlisle.github.io/ll/

I hope that's the correct digit sequence, apologies if not.

The code for that is in _includes/toc.html in that test repository but basically means
adding a new array

  {% assign digits="०;,१,२,३,४,५,६,७,८,९,१॰,११,१२,१३,१४,१५,१६,१<७" | split: "," %}

Then (conditionally for mr but in my test I did it always), replace direct use of the number

page.path | replace: '.md','' | replace: pp ,''

by casting to an integer and looking up in the array

{% assign pageno = page.path | replace: '.md','' | replace: pp ,'' | floor%}
{{ digits[pageno] }}

So subject to getting in the conditional tests in the right place we can certainly make this work

@niruvt
Copy link
Contributor Author

niruvt commented Feb 14, 2021

Thank you so much for this information.

There is a tiny mistake in number '10'. The symbol used for zero in 10 is wrong and should actually be १०.

Doubts

  1. Is the semicolon after the first zero (i.e. {% assign digits="०;) intentional? If yes why?
  2. Why are we giving 0-16 numbers? Can't we just map 0,1,2,3,4,5,6,7,8,9 to ०,१,२,३,४,५,६,७,८,९ and the rest can be generated?
  3. Is the < between १<७ intentional? Why? Does that mean It will generate the rest of the numbers?

Apart from this thanks for suggesting me the code, but I hardly know this programming language and I don't want to mess things up in my commit history, so is it okay if I ask you to add these few lines as an MR for my fork?

@davidcarlisle
Copy link
Member

Thank you so much for this information.

There is a tiny mistake in number '10'. The symbol used for zero in 10 is wrong and should actually be १०.

Hey I only got one wrong, better than I hoped, I will correct thanks:-)

Doubts

1. Is the semicolon after the first zero (i.e. `{% assign digits="०;`) intentional? If yes why?

Because I originally wrote this using html &#x...; numeric references then decided to use the characters directly (as the references don't work well in the liquid scripting), and it seems I left a semicolon in by mistake...

2. Why are we giving 0-16 numbers? Can't we just map `0,1,2,3,4,5,6,7,8,9` to `०,१,२,३,४,५,६,७,८,९` and the rest can be generated?

That was what I originally intended but liquid scripting is very weird and just having a simple array where the Marathi (or in principle other languages) can simply use digits[number] turned out to be a lot simpler.

3. Is the `<` between `१<७` intentional? Why? Does that mean It will generate the rest of the numbers?

No that is nonsense, I'll delete.

Apart from this thanks for suggesting me the code, but I hardly know this programming language and I don't want to mess things up in my commit history, so is it okay if I ask you to add these few lines as an MR for my fork?

Yes, of course: I was just checking it could work, also I just did it in my test site (which still has the old table of contents layout) we can sort it out later when we merge your files in.

@niruvt
Copy link
Contributor Author

niruvt commented Feb 14, 2021

Hey I only got one wrong, better than I hoped, I will correct thanks:-)

😅

Because I originally wrote this using html &#x...; numeric references then decided to use the characters directly (as the references don't work well in the liquid scripting), and it seems I left a semicolon in by mistake...

No problem. I see that you have removed it in the MR. That's great.

That was what I originally intended but liquid scripting is very weird and just having a simple array where the Marathi (or in principle other languages) can simply use digits[number] turned out to be a lot simpler.

Okay. So in case I need a number greater than 17, I just have to add it in the above array, right?

Yes, of course: I was just checking it could work, also I just did it in my test site (which still has the old table of contents layout) we can sort it out later when we merge your files in.

I can see your MR. I am merging it and closing this. Thank you so much for this help 😄

@niruvt niruvt closed this as completed Feb 14, 2021
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

2 participants