Changeset View
Changeset View
Standalone View
Standalone View
addons/symbolviewer/testfile.txt
- This file was added.
1 | Test And Demo File For The PlainText-Parser | ||||
---|---|---|---|---|---|
2 | ============================================= | ||||
3 | With this you have something like a table of contents when reading/edit a plain | ||||
4 | text file like a README. | ||||
5 | | ||||
6 | | ||||
7 | Section | ||||
8 | ========= | ||||
9 | Recognized right now is only === as section and --- as header starting at a | ||||
10 | length of 3 characters, all other text is treated as paragraph. | ||||
11 | | ||||
12 | | ||||
13 | | ||||
14 | There can be any space before or after some recognized section/header/paragraph | ||||
15 | which must not affect the desired result. | ||||
16 | | ||||
17 | | ||||
18 | | ||||
19 | | ||||
20 | Header | ||||
21 | -------- | ||||
22 | | ||||
23 | | ||||
24 | | ||||
25 | So this is a paragraph consist only of one line. | ||||
26 | | ||||
27 | - This paragraph has | ||||
28 | - two lines | ||||
29 | | ||||
30 | This is a new paragraph | ||||
31 | with a lengh | ||||
32 | of three lines. | ||||
33 | | ||||
34 | There is no lengh compare done to test if the underlining fit the title lengh. | ||||
35 | I had though about to add these check in a way that it is somehow fuzzy, because | ||||
36 | my style is to add to more underlining characters, others prefer to fill a | ||||
37 | complete line or 70%, 80% of a full line. | ||||
38 | | ||||
39 | The decision to use a min lengh of three fit to all these but of cause no | ||||
40 | shorter headers, because that looks to me rather unlikely. | ||||
41 | (Don't wonder, see also "Special Treatments" below) | ||||
42 | | ||||
43 | 1 | ||||
44 | - | ||||
45 | | ||||
46 | 2) | ||||
47 | -- | ||||
48 | | ||||
49 | For my taste works this all pretty charming when you have a well formatted file. | ||||
50 | It works so nicely that also a bad styled formatting is treated correctly. | ||||
51 | | ||||
52 | Bad Formatting Example | ||||
53 | ======================== | ||||
54 | Missed Empty Line | ||||
55 | ------------------- | ||||
56 | Foo bar text | ||||
57 | | ||||
58 | ^-- Well done as Section/Header/Paragraph | ||||
59 | | ||||
60 | | ||||
61 | But there could be things improved. As hint what I talk about I have | ||||
62 | inserted below some example lines. | ||||
63 | | ||||
64 | | ||||
65 | Special Treatments | ||||
66 | ==================== | ||||
67 | | ||||
68 | Avoided Paragraphs | ||||
69 | -------------------- | ||||
70 | To keep the symbol list free from useless entries, will some lines treated as an | ||||
71 | empty line. So none of the following must treated as start of a new paragraph. | ||||
72 | | ||||
73 | A single line of section/header characters... | ||||
74 | | ||||
75 | --- | ||||
76 | === | ||||
77 | | ||||
78 | ...any line consists of only one charater... | ||||
79 | | ||||
80 | x | ||||
81 | y | ||||
82 | # | ||||
83 | ? | ||||
84 | ! | ||||
85 | | ||||
86 | ...and any line with only two characters if there are as follows: | ||||
87 | | ||||
88 | -- | ||||
89 | ## | ||||
90 | ** | ||||
91 | .. | ||||
92 | // | ||||
93 | | ||||
94 | The sharp is obviously useful in some config file, the others I have added | ||||
95 | without an concrete example, just only by a gut feeling. | ||||
96 | | ||||
97 | | ||||
98 | ISO-Date Forced Sections | ||||
99 | -------------------------- | ||||
100 | I have the habit to write down some notes like a diary, starting with a ISO | ||||
101 | date, sometimes underlined the date, sometimes not. So I added a special check | ||||
102 | that these ISO dates are treated as if written like so... | ||||
103 | | ||||
104 | 2018-07-19 Made first commit of my Kate patches | ||||
105 | ================================================= | ||||
106 | | ||||
107 | ...but my entries looks this way: | ||||
108 | | ||||
109 | 2018-07-19 | ||||
110 | ============ | ||||
111 | Made first commit of my Kate patches to the symbol view plugin | ||||
112 | | ||||
113 | - Fix broken toggle actions | ||||
114 | - Avoid unneeded update of current item | ||||
115 | - Add a plain-text-parser | ||||
116 | - Fix: Find new current item when symbol is in first line | ||||
117 | | ||||
118 | 2018-07-22 | ||||
119 | Contacted the "Kate-Devils" at there list | ||||
120 | Nice people, but a bit taciturn | ||||
121 | | ||||
122 | 2018-07-25 | ||||
123 | ============ | ||||
124 | Very cool, my first patch is upstream | ||||
125 | That was lastly faster than thought | ||||
126 | | ||||
127 | | ||||
128 | Without this trick would only be the date appears in the symbol list, which is | ||||
129 | not a sufficient information for my taste, and in one case not a section | ||||
130 | created. What sadly not work is when an empty line is between the date and the | ||||
131 | next paragraph. | ||||
132 | | ||||
133 | 2018-07-22 | ||||
134 | | ||||
135 | Contacted the "Kate-Devils" at there list | ||||
136 | | ||||
137 | | ||||
138 | 2018-07-25 | ||||
139 | ============ | ||||
140 | | ||||
141 | Very cool, my first patch is upstream | ||||
142 | | ||||
143 | | ||||
144 | The former could be added but I'm not sure if that may cause unexpected results, | ||||
145 | because there are only three consecutive lines compared. So, no check can by | ||||
146 | made if above the date is the line empty. To catch the ladder there would be make | ||||
147 | a check of five lines or some other special quirk. | ||||
148 | | ||||
149 | | ||||
150 | Other Seen Structuring Styles | ||||
151 | ------------------------------- | ||||
152 | I can remeber that I have seen plain text files where was other characters used | ||||
153 | as underlining to indicate a section or header, e.g. | ||||
154 | | ||||
155 | Using Sharp | ||||
156 | ########### | ||||
157 | | ||||
158 | Using Tilde | ||||
159 | ~~~~~~~~~~~ | ||||
160 | | ||||
161 | Using Asterisk | ||||
162 | ************** | ||||
163 | | ||||
164 | Using Caret | ||||
165 | ^^^^^^^^^^^ | ||||
166 | | ||||
167 | I have quickly added these as you can see, but in a (too?) very lazy way: | ||||
168 | | ||||
169 | Feel Free | ||||
170 | #*=#*=#*= | ||||
171 | | ||||
172 | To Fix Me | ||||
173 | -^-~-^-~- | ||||
174 | | ||||
175 | Perhaps not a problem but a funny feature. | ||||
176 | | ||||
177 | | ||||
178 | Room For Improvements | ||||
179 | ======================= | ||||
180 | There could be a list with items indented to the paragraph. But that's not only | ||||
181 | an issue of parsing, There are not enough menu options to control these. But, | ||||
182 | perhaps may this not a real problem. |