$def with (disk)

<div class="disk">
    $for partition in disk.get_partitions_with_free_spaces_and_extended():
        $if partition.type == "PRIMARY":
            <div class="partition primary" style="width:$(partition.size)%;">
                <div class="partition_border">
                    $(partition.size)
                </div>
            </div>

        $elif partition.type == "EXTENDED":
            <div class="partition extended" style="width:$(partition.size)%;">
                <div class="partition_border">
                    $for logic in disk.get_partitions_inside_extended():
                        $if logic.type == "LOGIC":
                            <div class="partition logic" style="width:$(100*logic.size/partition.size)%;">
                                <div class="partition_border pext">
                                    $(logic.size)
                                </div>
                            </div>
                        $elif logic.type == "FREE":
                            <div class="partition free" style="width:$(100*logic.size/partition.size)%;">
                                <div class="partition_border pext">
                                    $(logic.size)
                                </div>
                            </div>
                </div>
            </div>
        $elif partition.type == "FREE":
            <div class="partition free" style="width:$(partition.size)%;">
                <div class="partition_border">
                    $(partition.size)
                </div>
            </div>
</div>
<div class="clear"></div>
