Skip to content

template.htmx - Embedded JS will overwrite Interface <code class="methods-code language-go"> block with empty string #2

@lezelelyba

Description

@lezelelyba

The return `` in the map processing returns "" when processing the interface definition.
All interfaces code in the documentation then shows as empty blocks

The output shows up when the lines are removed/commented out

                  const newContent = lines
                     .map((line) => {
                        const trimmed = line.trim();
                        const nameMatch = trimmed.match(
                           /^([A-Za-z_][A-Za-z0-9_]*)/
                        );
                        if (!nameMatch && !trimmed.endsWith("{") && trimmed != "}") {
                           return `<span class="method-line">${line}</span>`;
>>>                     // } else {
>>>                     //    return ``;
                        }

                        const name = nameMatch[1];
                        const isPriv = isPrivate(name);
                        return `<span class="method-line${
                           isPriv ? " hidden private" : ""
                        }" data-name="${name}">${line}</span><br />`;
                     })
                     .join("");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions