Skip to content

Commit

Permalink
Do not indent struct member previews anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
AljoschaMeyer committed Jan 16, 2024
1 parent cb6cb1b commit 5a8e8b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pseudocode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,14 @@ function item_spacing(): Expression {
function render_line(...exps: Expression[]): Expression {
const macro = new_macro(
(args, ctx) => {
return div(
{ class: "loc" },
div({
style: `margin-left: ${2 * pseudocode_state(ctx).indentation}rem;`,
}, ...args),
);
const indentation = pseudocode_state(ctx).indentation;
let content: Expression = [...args];

for (let i = 0; i < indentation; i++) {
content = div({class: "locindent"}, content);
}

return div({class: "loc"}, content);
},
);

Expand Down Expand Up @@ -372,7 +374,8 @@ function render_struct(struct: Struct): Expression {
type_name,
),
indent(
struct.fields.map(render_field),
div({class: "composite_type_def"}, struct.fields.map(render_field)),
// struct.fields.map(render_field),
),
];
},
Expand Down
4 changes: 4 additions & 0 deletions willowtest/typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ code.pseudocode {
margin-top: 0;
}

.composite_type_def .locindent {
margin-left: 2rem;
}

.preview code.pseudocode {
margin: 0;
}
Expand Down

0 comments on commit 5a8e8b0

Please sign in to comment.