Page 1 of 2

Wrong reStructuredText tree structure

Posted: 17.08.2022 14:01
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 973 times

Posted: 17.08.2022 17:05
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?

Posted: 18.08.2022 02:20
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.

Posted: 19.08.2022 14:05
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/

Posted: 22.08.2022 01:45
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.

Posted: 22.08.2022 02:26
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!

Posted: 22.08.2022 08:32
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

Posted: 22.08.2022 13:45
by lookoutside
Aha, I have just translated the first 200 items. Thank you very much. I can stop it now.

Posted: 23.08.2022 08:11
by lookoutside

Posted: 23.08.2022 08:46
by main Alexey
i didn't find the tool to translate this web page. it is some review of CudaText in CHS?