Skip to content

html output of code-block includes extra line breaks #27

@xrme

Description

@xrme

From this:

;;; -*- Mode: Lisp; Package: CCL; Coding: utf-8; -*-

(document "bug in code-block"
  (code-block "#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <pwd.h>

int bufsize;

if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
  abort();

char buffer[bufsize];
struct passwd pwd, *result = NULL;
if (getpwuid_r(getuid(), &pwd, buffer, bufsize, &result) != 0 || !result)
  abort();

printf(\"%s\n\", pwd.pw_dir);"))

We get the output:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
bug in code-block</title>
</head>
<body>
<header><h1>bug in code-block</h1></header>
<div id="main-wrapper">  <div id="toc"><div class="sidebar">
<h2>Table of Contents</h2><nav><ul>
</ul>
</nav></div>
  </div>  <div id="contents-wrapper">    <div id="contents"><pre><code><p>#include &lt;sys/types.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;pwd.h&gt;</p>
<p>int bufsize;</p>
<p>if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
  abort();</p>
<p>char buffer[bufsize];
struct passwd pwd, *result = NULL;
if (getpwuid_r(getuid(), &amp;pwd, buffer, bufsize, &amp;result) != 0 || !result)
  abort();</p>
<p>printf("%sn", pwd.pw_dir);</p>
</code>
</pre>
    </div>  </div></div></body>
</html>

We need to respect whitespace and line breaks in the code-block. We don't want paragraphs in there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions