void
xml_pcss_rename_func_to_html (xml_GNode* node, xml_GNode* rule, gpointer data)
{
gchar* mrkk = 0;
const gchar* mark = xml_node_attribute_lookup (rule, "mark");
if (! mark)
{
if (! mrkk)
mrkk = xml_pcss_prop_rule_attribute_strdup (rule, "html");
if (! mrkk)
mrkk = xml_pcss_prop_rule_attribute_strdup (rule, "into");
if (! mrkk)
mrkk = xml_pcss_prop_rule_attribute_strdup (rule, "mark");
if (mrkk) mark = mrkk;
} |
___ gchar* prop = xml_pcss_prop_rule_attribute_strdup (rule, "display");
if (prop)
{
if (! strcmp (prop, "block") || ! strcmp (prop, "div"))
{
if (! mark)
mark = "div";
else
xml_node_group_outer_alias (node, "div");
} |
else if (! strcmp (prop, "list-item") || ! strcmp (prop, "li"))
{
xml_node_attribute_add (
xml_node_group_outer_alias (node, "li"),
"class", node->name);
} |
else if (! strcmp (prop, "table-row") || ! strcmp (prop, "tr"))
{
if (! mark)
mark = "tr";
else
xml_node_group_outer_alias (node, "tr");
} |
else if (! strcmp (prop, "table-cell") || ! strcmp (prop, "td"))
{
if (! mark)
mark = "td";
else
xml_node_group_outer_alias (node, "td");
} |
else if (! strcmp (prop, "table"))
{
if (! mark)
mark = "table";
else
add_table_attributes (
xml_node_group_outer_alias (node, "table"), rule);
} |
else if (! strcmp (prop, "inline-table") || ! strcmp (prop, "li"))
{
xml_node_attribute_add (
add_table_attributes (
xml_node_group_outer_alias (node, "table"), rule),
"class", node->name);
xml_node_attribute_add (
xml_node_group_outer_alias (node, "tr"),
"class", node->name);
xml_node_attribute_add (
xml_node_group_outer_alias (node, "td"),
"class", node->name);
} |
} |
if (! mark) mark = "span";
if (!strcmp (mark, "a"))
{
if (prop) g_free (prop);
prop = xml_pcss_prop_rule_attribute_strdup (rule, "name");
if (prop)
{
gchar* key;
gchar* val = xml_node_attribute_lookup (node, prop);
if (val && ! xml_node_attribute_lookup (node, "name"))
{
val = g_strdup (val);
for (key = val ; *key ; key++)
{
if (g_ascii_isalnum (*key)) continue;
if (!strchr (":_-.", *key)) *key = ':';
if (key == val) continue;
if (key[0] == '.' && key[-1] == '.')
{ strcpy (key-1, key); key--; } |
if (key[0] == ':' && key[-1] == '.')
{ strcpy (key-1, key); key--; } |
} |
key = g_strdup ("name");
xml_node_attribute_insert (node, key, val);
} |
val = xml_node_attribute_lookup (node, "name");
if (val)
{
if (!xml_node_attribute_lookup (node, "id"))
xml_node_attribute_add (node, "id", val);
} |
} |
} |
else if (!strcmp (mark, "table"))
{
add_table_attributes (node, rule);
} |
if (prop) g_free (prop);
____;
if (! xml_node_hasname_eq_ (node, mark))
xml_node_attribute_add (node, "class", node->name);
xml_node_rename (node, mark);
if (mrkk) g_free (mrkk);
} |
|