Sha256: 10306d9aae9fb03e0274b93b71e1e80dda33d5422395894511647339f8c6ae76

Contents?: true

Size: 628 Bytes

Versions: 8

Compression:

Stored size: 628 Bytes

Contents

const { concat, group, hardline, indent, join } = require("../../prettier");

// https://haml.info/docs/yardoc/file.REFERENCE.html#html-comments-
function comment(path, _opts, print) {
  const { children, value } = path.getValue();
  const parts = ["/"];

  if (value.revealed) {
    parts.push("!");
  }

  if (value.conditional) {
    parts.push(value.conditional);
  } else if (value.text) {
    parts.push(" ", value.text);
  }

  if (children.length > 0) {
    parts.push(
      indent(concat([hardline, join(hardline, path.map(print, "children"))]))
    );
  }

  return group(concat(parts));
}

module.exports = comment;

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
prettier-1.5.5 src/haml/nodes/comment.js
prettier-1.5.4 src/haml/nodes/comment.js
prettier-1.5.3 src/haml/nodes/comment.js
prettier-1.5.2 src/haml/nodes/comment.js
prettier-1.5.1 src/haml/nodes/comment.js
prettier-1.5.0 src/haml/nodes/comment.js
prettier-1.4.0 src/haml/nodes/comment.js
prettier-1.3.0 src/haml/nodes/comment.js