parse txt file and show file structure on the panel
- Author
- Message
-
Offline
- Posts: 8
- Joined: Wed Feb 03, 2021 8:31 am
parse txt file and show file structure on the panel
Hi, I'm newer to the Akelpad, now I want to develop a plug to parse some big txt file, and show the txt structure tree list on the panel, which will be look like the code function list. I have no idea about it, would u kindly to give some suggestion? thanks.
-
Offline
- Posts: 1250
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: parse txt file and show file structure on the panel
To be able to parse a text file, your text file should follow some predefined structure. It means each "section" (or "chapter", or "part") of your text should use some exact words or characters to identify the beginning and the end of each "section".
You may look at the "AkelPad\AkelFiles\Plugs\Coder\ini.coder" as an example. Just open any .ini file and notice how its structure looks in AkelPad according to the rules specified within the "ini.coder".
Inside the "ini.coder", you are interested in the sections "Quotes:" and "Folds:". The "Quotes:" section uses flags (sum of flags) defined in the "HighLight" section; the "Folds:" section uses flags (sum of flags) defined in the "CodeFold" section.
You can create a copy of the "ini.coder" file, giving this copy a name of "txt.coder". Then, under the "Files:" section of this "txt.coder", specify "*.txt" instead of "*.ini", "*.inf" and other file types mentioned there. After that, your "txt.coder" will be applied to all files with .txt extension. Feel free to modify the content of this "txt.coder" according to your needs.
Note: you may need to delete the file "AkelPad\AkelFiles\Plugs\Coder\cache" right after you have created your "txt.coder".
You may look at the "AkelPad\AkelFiles\Plugs\Coder\ini.coder" as an example. Just open any .ini file and notice how its structure looks in AkelPad according to the rules specified within the "ini.coder".
Inside the "ini.coder", you are interested in the sections "Quotes:" and "Folds:". The "Quotes:" section uses flags (sum of flags) defined in the "HighLight" section; the "Folds:" section uses flags (sum of flags) defined in the "CodeFold" section.
You can create a copy of the "ini.coder" file, giving this copy a name of "txt.coder". Then, under the "Files:" section of this "txt.coder", specify "*.txt" instead of "*.ini", "*.inf" and other file types mentioned there. After that, your "txt.coder" will be applied to all files with .txt extension. Feel free to modify the content of this "txt.coder" according to your needs.
Note: you may need to delete the file "AkelPad\AkelFiles\Plugs\Coder\cache" right after you have created your "txt.coder".