{"id":294,"date":"2008-06-09T17:07:41","date_gmt":"2008-06-09T15:07:41","guid":{"rendered":"http:\/\/www.lucas-nussbaum.net\/blog\/?p=294"},"modified":"2008-06-09T17:07:41","modified_gmt":"2008-06-09T15:07:41","slug":"text-normalizer-anyone","status":"publish","type":"post","link":"https:\/\/www.lucas-nussbaum.net\/blog\/?p=294","title":{"rendered":"Text normalizer, anyone?"},"content":{"rendered":"<p>When I write text documents (using LaTeX or Docbook), I like to wrap lines, as it makes them easier to edit (less things moving on the screen), and allow to have easy-to-read diffs.<\/p>\n<p>However, I always hesitate before rewrapping paragraphs (using vim&#8217;s gqap): this mean that I will add noise to my git history. So I only do that from time to time, making &#8220;rewrapping-only commits&#8221;. But that sucks, since in the meantime, I sometimes make a lot of changes, and my lines grow long again. Of course, I could rewrap my paragraphs before each commit, but if I simply add a word to a paragraph, it might cause all the lines to be rewrapped.<\/p>\n<p>So I what I would need is some kind of &#8220;text normalizer&#8221; that will:<\/p>\n<ul>\n<li>split lines at The Right Place. After &#8216;.&#8217;, &#8216;,&#8217;, &#8216;:&#8217;, &#8216;;&#8217;, etc. So rewrapping won&#8217;t propagate changes too far away.<\/li>\n<li>understand the basics of LaTeX, so it won&#8217;t rewrap\n<pre>\\begin{tabular}{|l|l|}\\hline\r\nx & y \\\\\r\n1 & 2 \\\\\\hline\r\n\\end{tabular}<\/pre>\n<p>or <\/p>\n<pre>\\begin{figure}\r\n\\centerline{\\includegraphics{fig}}\r\n\\caption{Cool stuff}\r\n\\label{coolstuff}\r\n\\end{figure}<\/pre>\n<p>(vim does rewrap those examples.)<\/li>\n<li>be editor-agnostic. So other committers could use it as well.<\/li>\n<li>support for other document formats (docbook XML) would be nice too.<\/li>\n<\/ul>\n<p>I&#8217;ve looked at plasTeX: I could use it to parse a LaTeX document, and export it as LaTeX. But then it would be a LaTeX-only solution. Does anyone have a better solution?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I write text documents (using LaTeX or Docbook), I like to wrap lines, as it makes them easier to edit (less things moving on the screen), and allow to have easy-to-read diffs. However, I always hesitate before rewrapping paragraphs (using vim&#8217;s gqap): this mean that I will add noise to my git history. So [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"0","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,12],"tags":[],"class_list":["post-294","post","type-post","status-publish","format-standard","hentry","category-planetdebian","category-planetubuntu"],"_links":{"self":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=294"}],"version-history":[{"count":0,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/294\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}