no_empty_line_between_headings.pl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. use vars qw(%result_texis %result_texts %result_trees %result_errors
  2. %result_indices %result_sectioning %result_nodes %result_menus
  3. %result_floats %result_converted %result_converted_errors
  4. %result_elements %result_directions_text);
  5. use utf8;
  6. $result_trees{'no_empty_line_between_headings'} = {
  7. 'contents' => [
  8. {
  9. 'contents' => [],
  10. 'parent' => {},
  11. 'type' => 'text_root'
  12. },
  13. {
  14. 'args' => [
  15. {
  16. 'contents' => [
  17. {
  18. 'extra' => {
  19. 'command' => {}
  20. },
  21. 'parent' => {},
  22. 'text' => ' ',
  23. 'type' => 'empty_spaces_after_command'
  24. },
  25. {
  26. 'parent' => {},
  27. 'text' => 'Top'
  28. },
  29. {
  30. 'parent' => {},
  31. 'text' => '
  32. ',
  33. 'type' => 'spaces_at_end'
  34. }
  35. ],
  36. 'parent' => {},
  37. 'type' => 'misc_line_arg'
  38. }
  39. ],
  40. 'cmdname' => 'top',
  41. 'contents' => [
  42. {
  43. 'args' => [
  44. {
  45. 'contents' => [
  46. {
  47. 'extra' => {
  48. 'command' => {}
  49. },
  50. 'parent' => {},
  51. 'text' => ' ',
  52. 'type' => 'empty_spaces_after_command'
  53. },
  54. {
  55. 'parent' => {},
  56. 'text' => 'Subheading'
  57. },
  58. {
  59. 'parent' => {},
  60. 'text' => '
  61. ',
  62. 'type' => 'spaces_at_end'
  63. }
  64. ],
  65. 'parent' => {},
  66. 'type' => 'misc_line_arg'
  67. }
  68. ],
  69. 'cmdname' => 'subheading',
  70. 'extra' => {
  71. 'misc_content' => [
  72. {}
  73. ],
  74. 'spaces_after_command' => {}
  75. },
  76. 'level' => 3,
  77. 'line_nr' => {
  78. 'file_name' => '',
  79. 'line_nr' => 2,
  80. 'macro' => ''
  81. },
  82. 'parent' => {}
  83. }
  84. ],
  85. 'extra' => {
  86. 'misc_content' => [
  87. {}
  88. ],
  89. 'spaces_after_command' => {}
  90. },
  91. 'level' => 0,
  92. 'line_nr' => {
  93. 'file_name' => '',
  94. 'line_nr' => 1,
  95. 'macro' => ''
  96. },
  97. 'parent' => {}
  98. },
  99. {
  100. 'args' => [
  101. {
  102. 'contents' => [
  103. {
  104. 'extra' => {
  105. 'command' => {}
  106. },
  107. 'parent' => {},
  108. 'text' => ' ',
  109. 'type' => 'empty_spaces_after_command'
  110. },
  111. {
  112. 'parent' => {},
  113. 'text' => 'Chapter'
  114. },
  115. {
  116. 'parent' => {},
  117. 'text' => '
  118. ',
  119. 'type' => 'spaces_at_end'
  120. }
  121. ],
  122. 'parent' => {},
  123. 'type' => 'misc_line_arg'
  124. }
  125. ],
  126. 'cmdname' => 'chapter',
  127. 'contents' => [],
  128. 'extra' => {
  129. 'misc_content' => [
  130. {}
  131. ],
  132. 'spaces_after_command' => {}
  133. },
  134. 'level' => 1,
  135. 'line_nr' => {
  136. 'file_name' => '',
  137. 'line_nr' => 3,
  138. 'macro' => ''
  139. },
  140. 'number' => 1,
  141. 'parent' => {}
  142. },
  143. {
  144. 'args' => [
  145. {
  146. 'contents' => [
  147. {
  148. 'extra' => {
  149. 'command' => {}
  150. },
  151. 'parent' => {},
  152. 'text' => ' ',
  153. 'type' => 'empty_spaces_after_command'
  154. },
  155. {
  156. 'parent' => {},
  157. 'text' => 'Section'
  158. },
  159. {
  160. 'parent' => {},
  161. 'text' => '
  162. ',
  163. 'type' => 'spaces_at_end'
  164. }
  165. ],
  166. 'parent' => {},
  167. 'type' => 'misc_line_arg'
  168. }
  169. ],
  170. 'cmdname' => 'section',
  171. 'contents' => [],
  172. 'extra' => {
  173. 'misc_content' => [
  174. {}
  175. ],
  176. 'spaces_after_command' => {}
  177. },
  178. 'level' => 2,
  179. 'line_nr' => {
  180. 'file_name' => '',
  181. 'line_nr' => 4,
  182. 'macro' => ''
  183. },
  184. 'number' => '1.1',
  185. 'parent' => {}
  186. }
  187. ],
  188. 'type' => 'document_root'
  189. };
  190. $result_trees{'no_empty_line_between_headings'}{'contents'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'};
  191. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'extra'}{'command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1];
  192. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0];
  193. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'contents'}[1]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0];
  194. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'contents'}[2]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0];
  195. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1];
  196. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0]{'extra'}{'command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0];
  197. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0];
  198. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[1]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0];
  199. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[2]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0];
  200. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0];
  201. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'extra'}{'misc_content'}[0] = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[1];
  202. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'extra'}{'spaces_after_command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0];
  203. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'contents'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1];
  204. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'extra'}{'misc_content'}[0] = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'contents'}[1];
  205. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'extra'}{'spaces_after_command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'args'}[0]{'contents'}[0];
  206. $result_trees{'no_empty_line_between_headings'}{'contents'}[1]{'parent'} = $result_trees{'no_empty_line_between_headings'};
  207. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[2];
  208. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0];
  209. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'contents'}[1]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0];
  210. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'contents'}[2]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0];
  211. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[2];
  212. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'extra'}{'misc_content'}[0] = $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'contents'}[1];
  213. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'extra'}{'spaces_after_command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'args'}[0]{'contents'}[0];
  214. $result_trees{'no_empty_line_between_headings'}{'contents'}[2]{'parent'} = $result_trees{'no_empty_line_between_headings'};
  215. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'contents'}[0]{'extra'}{'command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[3];
  216. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'contents'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0];
  217. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'contents'}[1]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0];
  218. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'contents'}[2]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0];
  219. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'parent'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[3];
  220. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'extra'}{'misc_content'}[0] = $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'contents'}[1];
  221. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'extra'}{'spaces_after_command'} = $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'args'}[0]{'contents'}[0];
  222. $result_trees{'no_empty_line_between_headings'}{'contents'}[3]{'parent'} = $result_trees{'no_empty_line_between_headings'};
  223. $result_texis{'no_empty_line_between_headings'} = '@top Top
  224. @subheading Subheading
  225. @chapter Chapter
  226. @section Section
  227. ';
  228. $result_texts{'no_empty_line_between_headings'} = 'Top
  229. ***
  230. Subheading
  231. ----------
  232. 1 Chapter
  233. *********
  234. 1.1 Section
  235. ===========
  236. ';
  237. $result_sectioning{'no_empty_line_between_headings'} = {
  238. 'level' => -1,
  239. 'section_childs' => [
  240. {
  241. 'cmdname' => 'top',
  242. 'extra' => {},
  243. 'level' => 0,
  244. 'section_childs' => [
  245. {
  246. 'cmdname' => 'chapter',
  247. 'extra' => {},
  248. 'level' => 1,
  249. 'number' => 1,
  250. 'section_childs' => [
  251. {
  252. 'cmdname' => 'section',
  253. 'extra' => {},
  254. 'level' => 2,
  255. 'number' => '1.1',
  256. 'section_up' => {}
  257. }
  258. ],
  259. 'section_up' => {},
  260. 'toplevel_prev' => {},
  261. 'toplevel_up' => {}
  262. }
  263. ],
  264. 'section_up' => {}
  265. }
  266. ]
  267. };
  268. $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0]{'section_childs'}[0]{'section_childs'}[0]{'section_up'} = $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0]{'section_childs'}[0];
  269. $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0]{'section_childs'}[0]{'section_up'} = $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0];
  270. $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0]{'section_childs'}[0]{'toplevel_prev'} = $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0];
  271. $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0]{'section_childs'}[0]{'toplevel_up'} = $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0];
  272. $result_sectioning{'no_empty_line_between_headings'}{'section_childs'}[0]{'section_up'} = $result_sectioning{'no_empty_line_between_headings'};
  273. $result_errors{'no_empty_line_between_headings'} = [];
  274. $result_converted{'plaintext'}->{'no_empty_line_between_headings'} = 'Top
  275. ***
  276. Subheading
  277. ----------
  278. 1 Chapter
  279. *********
  280. 1.1 Section
  281. ===========
  282. ';
  283. $result_converted{'html_text'}->{'no_empty_line_between_headings'} = '<a name="Top"></a>
  284. <h1 class="top">Top</h1>
  285. <a name="Subheading"></a>
  286. <h4 class="subheading">Subheading</h4>
  287. <a name="Chapter"></a>
  288. <h2 class="chapter">1 Chapter</h2>
  289. <a name="Section"></a>
  290. <h3 class="section">1.1 Section</h3>
  291. <hr>
  292. ';
  293. $result_converted{'docbook'}->{'no_empty_line_between_headings'} = '<chapter label="">
  294. <title>Top</title>
  295. <bridgehead renderas="sect2">Subheading</bridgehead>
  296. </chapter>
  297. <chapter label="1">
  298. <title>Chapter</title>
  299. <sect1 label="1.1">
  300. <title>Section</title>
  301. </sect1>
  302. </chapter>
  303. ';
  304. 1;