Sha256: 6342f1f4726be194a89c633a7fffe58ae580ade52cecb85bd94af658f3255ba5

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 Bytes

Contents

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

// http://haml.info/docs/yardoc/file.REFERENCE.html#html-comments-
const 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-0.20.0 src/haml/nodes/comment.js
prettier-0.19.1 src/haml/nodes/comment.js
prettier-0.19.0 src/haml/nodes/comment.js
prettier-0.18.2 src/haml/nodes/comment.js
prettier-0.18.1 src/haml/nodes/comment.js
prettier-0.18.0 src/haml/nodes/comment.js
prettier-0.17.0 src/haml/nodes/comment.js
prettier-0.16.0 src/haml/nodes/comment.js