Wrong reStructuredText tree structure

Solved bugs are moved into this topic...
lookoutside
Posts: 51
Joined: 17.08.2022 13:42

Wrong reStructuredText tree structure

Post by lookoutside »

Excellent software, thank you!

I am a new user and I use CudaText (version 1.168.6.1) to write restructuredtext documents. It works very well in various ways. But I have difficulty to make the (code) tree structure to work correctly. Even I install the cuda_tree_rest plugin, it does not help.

cuda_tree_rest: https://github.com/medvosa/cuda_tree_rest

The following is the Headers on the right and tree on the left. You can see I use FIVE level headings, but only the first three of them render correctly, the last two are wrong. Can you help? Thank you very much!
wrong-rst-tree.png
wrong-rst-tree.png (7.3 KiB) Viewed 970 times
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

the detection of header's level is wrong in Cud.

Code: Select all

class function TTreeHelperRest.GetLevel(ch: WideChar): integer;
begin
  case ch of
    '=': Result:= 1;
    '-': Result:= 2;
    '~': Result:= 3;
    '"': Result:= 4;
    else Result:= 1;
  end;
end;
do you know the algorithm to detect the headder level from header's char? or do we need to calc it dinamically from each document?
lookoutside
Posts: 51
Joined: 17.08.2022 13:42

Post by lookoutside »

Thank you for your reply. I will use the first four head level markers as you suggested before your updates coming.

I think you should calc it dynamically from each document according to the online docs:

https://www.sphinx-doc.org/en/master/us ... l#sections
Normally, there are no heading levels assigned to certain characters as the structure is determined from the succession of headings.
https://docutils.sourceforge.io/docs/re ... l#sections
Rather than imposing a fixed number and order of section title adornment styles, the order enforced will be the order as encountered. The first style encountered will be an outermost title (like HTML H1), the second style will be a subtitle, the third will be a subsubtitle, and so on.
By the way, Cudatext is so an excellent editor to write (restructuredtext) docs that I will recommend it to others.

Thank you again.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

>that I will recommend it to others.
great, we need to advertise it.
or some youtube videos.

I now reworked the detection of levels ((it was not easy to invent the algorithm, so the 2-3 days delay).
beta for win64, please test, on your sample it works:
http://uvviewsoft.com/c/
lookoutside
Posts: 51
Joined: 17.08.2022 13:42

Post by lookoutside »

great, we need to advertise it.
or some youtube videos.
You will see. I will do so after I can translate the UI and some Cudatext's basic wiki help documents to Chinese. My introduction is for Chinese uses. I think millions of them need Cudatext-like editors. This work will take some time but you will not wait too long.
Last edited by lookoutside on 22.08.2022 02:37, edited 1 time in total.
lookoutside
Posts: 51
Joined: 17.08.2022 13:42

Post by lookoutside »

I now reworked the detection of levels ((it was not easy to invent the algorithm, so the 2-3 days delay).
beta for win64, please test, on your sample it works:
http://uvviewsoft.com/c/
Yes, it works correctly. thank you!
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

about Chs translations - we already have them. in Addons Manager:
https://sourceforge.net/projects/cudate ... nslations/

files there: zh_CN (updated), zh_CN_2 (updated), zh_TW (5 years old, bad).

history of translations:
https://github.com/Alexey-T/CudaText/bl ... istory.txt
lookoutside
Posts: 51
Joined: 17.08.2022 13:42

Post by lookoutside »

Aha, I have just translated the first 200 items. Thank you very much. I can stop it now.
lookoutside
Posts: 51
Joined: 17.08.2022 13:42

Post by lookoutside »

main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

i didn't find the tool to translate this web page. it is some review of CudaText in CHS?
Post Reply