Skip to content

Commit

Permalink
hide title and other meta tags from <htm> tag
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Dec 28, 2024
1 parent 7b39469 commit 1848bce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/input.salam
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
صفحه:
عنوان = «سلام دنیا - خوش آمدید»
زبان = «فارسی»
جهت = «راست به چپ»
// جهت = «چپ به راست»
Expand Down
27 changes: 27 additions & 0 deletions src/generator_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,24 @@ void generator_code_layout_body(generator_t *generator,
body_content->destroy(body_content);
}

// TODO
bool is_generator_code_head(ast_layout_attribute_t *attribute)
{
switch (attribute->type) {
case AST_LAYOUT_ATTRIBUTE_TYPE_TITLE:
case AST_LAYOUT_ATTRIBUTE_TYPE_AUTHOR:
case AST_LAYOUT_ATTRIBUTE_TYPE_DESCRIPTION:
case AST_LAYOUT_ATTRIBUTE_TYPE_KEYWORDS:
case AST_LAYOUT_ATTRIBUTE_TYPE_CHARSET:
case AST_LAYOUT_ATTRIBUTE_TYPE_VIEWPORT:
case AST_LAYOUT_ATTRIBUTE_TYPE_REFRESH:
return true;

default:
return false;
}
}

/**
*
* @function generator_code_head_item
Expand All @@ -359,6 +377,11 @@ void generator_code_layout_body(generator_t *generator,
void generator_code_head_item(ast_layout_attribute_t *attribute,
string_t *head) {
DEBUG_ME;
if (! is_generator_code_head(attribute))
{
return;
}

if (head == NULL) {
return;
}
Expand Down Expand Up @@ -669,6 +692,10 @@ void generator_code_layout_html(generator_t *generator,

generator_code_layout_value(layout_block->attributes, NULL,
attribute);

if (is_generator_code_head(attribute)) {
attribute->belongsToLayout = false;
}

entry = cast(hashmap_entry_t *, entry->next);
}
Expand Down
3 changes: 3 additions & 0 deletions src/generator_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@ void generator_code_head_meta_children(generator_t *generator,
string_t *generator_code_layout_block_item(generator_t *generator,
ast_layout_node_t *node);

// TODO
bool is_generator_code_head(ast_layout_attribute_t *attribute);

#endif

0 comments on commit 1848bce

Please sign in to comment.