Hello!
I'm fairly new to Confluence and Velocity.
I was able to create a macro that removes table borders on a page.
Now I am attempting to create a macro that allows the user to set the table border between 0 and 2 pixels, unique for each table on the page! (The user will use a separate macro for each table).
At the moment, using a div and class, the last chunk CSS code affects every table on the page, as expected. So I would like to use an id instead, and generate the id to be unique using a time stamp.
However, the code is now ineffective.
Any thoughts?
CODE
## This macro takes a table and lets the user choose a border width limited to 0 (none), 1, or 2
## @param width:title=Width|type=enum|enumValues=0,1,2|desc=Set border width, limited to 0,1, or 2
##
#if (!$paramwidth)
#set ($border = "0px")
#else
#set($border = "${paramwidth}px")
#end
##
<style>
.tableWrapper th {
border: $border;
border-style: solid;
}
.tableWrapper td {
border: $border;
border-style: solid;
}
</style>
##
<div class=tableWrapper>
$body
</div>
PRODUCES
CODE
## This macro takes a table and lets the user choose a border width limited to 0 (none), 1, or 2
## @param width:title=Width|type=enum|enumValues=0,1,2|desc=Set border width, limited to 0,1, or 2
##
#if (!$paramwidth)
#set ($border = "0px")
#else
#set($border = "${paramwidth}px")
#end
#set($id = $content.getCurrentDate().getTime())
##
<style>
.$id th {
border: $border;
border-style: solid;
}
.$id td {
border: $border;
border-style: solid;
}
</style>
##
<div id=$id>
$body
</div>
PRODUCES