public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* transform txt file to html. newline<br> with newline
@ 2022-08-06  8:58 jian he
  0 siblings, 0 replies; only message in thread
From: jian he @ 2022-08-06  8:58 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1784 bytes --]

Hi there. Trying to use pandoc convert txt file to html file. Encountered
some issues with newline.

using postgresql query:

> copy (select '
> <pre>
> <tt>#include &lt;math.h&gt;
> <br>
> double
> norm1(const double v[], const int n)
> {
> int i;
> double n1_v; /* 1-norm of v */
> <br>
> n1_v = 0;
> for (i=0; i&lt;n; i++) {
> n1_v += fabs (v[i]);
> }
> <br>
> return n1_v;
> }
> </tt>
> </pre>')
> to '/home/jian/Desktop/test2.txt';
>

 convert to one record one line test2.txt
Then I do

pandoc -s /home/jian/Desktop/test2.txt -o test2.html
test2.html render

>
> \n#include <math.h>\n
> \ndouble\nnorm1(const double v[], const int n)\n{\n int i;\n double n1_v;
> /* 1-norm of v */\n
> \n n1_v = 0;\n for (i=0; i<n; i++) {\n n1_v += fabs (v[i]);\n }\n
> \n return n1_v;\n}\n\n
>

Is possible to test2.html render the following result.

>     #include <math.h>
>
>
>     double
>     norm1(const double v[], const int n)
>     {
>         int     i;
>         double  n1_v;  /* 1-norm of v */
>
>
>         n1_v = 0;
>         for (i=0; i<n; i++) {
>             n1_v += fabs (v[i]);
>         }
>
>
>         return n1_v;
>     }
>
>
> However If I save the string to an txt file (test3.txt) then I do

pandoc -s /home/jian/Desktop/test3.txt -o test3.html
>
will work as intended.
-- 
 I recommend David Deutsch's <<The Beginning of Infinity>>

  Jian

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CACJufxGrT-Rjx%3Db%2B2e2p_f30Vo_FN1Aby8PuJrWA0hoibpD-xQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4658 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-06  8:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-06  8:58 transform txt file to html. newline<br> with newline jian he

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).