
import re

raw_text = """1. Road Construction Works

We undertake complete road infrastructure projects including:

• National & State Highways
• City Roads & Internal Roads
• Rural Roads & PMGSY Roads
• Bituminous (BT) Roads
• Cement Concrete (CC) Roads
• Interlocking Paver Block Roads
• WBM & WMM Roads
• Road Widening & Strengthening
• Resurfacing & Maintenance
• Drainage & Side Shoulder Works

Our road projects ensure smooth traffic flow, long life, and high load-bearing capacity.

2. Bridge & Structure Works

We construct safe and durable bridge structures including:

• RCC Bridges
• Minor & Major Bridges
• Flyovers & Overbridges
• Culverts & Box Culverts
• Underpasses
• Foot Over Bridges
• Retaining Walls
• Crash Barriers & Safety Structures

We use advanced engineering practices and quality materials to guarantee structural stability and safety.

3. Building Construction Works

We provide complete building construction services from foundation to finishing:

• Residential Buildings
• Government Offices
• Schools & Colleges
• Hospitals & Health Centers
• Commercial Complexes
• Industrial Buildings
• Warehouses & Godowns
• Hostels & Quarters
• Administrative Blocks
• Public Utility Buildings

Services include foundation, RCC framework, brickwork, plastering, flooring, electrical, plumbing, painting, and finishing.

4. Infrastructure & Site Development

Complete site development solutions including:

• Earthwork & Excavation
• Land Filling & Leveling
• Soil Compaction
• Drainage Systems
• Sewerage & Water Supply Lines
• Storm Water Drain
• Boundary Walls
• Pavements & Parking Areas
• Landscaping
• Utility Installations

We ensure proper planning and execution for sustainable infrastructure.

5. Government & PSU Projects

We actively participate in:

• Central Government Tenders
• State Government Tenders
• CPWD / PWD Works
• Railways
• MES / Defence Projects
• PSUs (NTPC, ONGC, SAIL, BHEL, etc.)
• Municipal Corporation Projects
• Smart City Projects

Our team is well-versed with tender documentation, BOQ, estimation, billing, and compliance procedures.

6. Private & Industrial Projects

We also serve private and industrial clients:

• Factory Construction
• Commercial Spaces
• Private Buildings
• Real Estate Projects
• Renovation & Repair Works
• Turnkey Projects
• Interior & Exterior Civil Works

We deliver customized solutions as per client requirements.

7. Renovation, Repair & Maintenance Works

We provide comprehensive renovation and maintenance solutions to restore, strengthen, and modernize existing structures. Our services help extend the life of buildings and infrastructure while improving safety and functionality.

• Building renovation & remodeling
• Structural repairs & retrofitting
• Crack treatment & waterproofing
• Road patch work & resurfacing
• Bridge maintenance
• Plumbing & drainage repairs
• Painting & finishing works
• Tile, flooring & ceiling replacement
• Annual Maintenance Contracts (AMC)

8. Water Supply & Sanitation Works

We execute complete water management and sanitation projects for urban and rural development, ensuring safe and reliable systems.

• Water supply pipelines
• Borewell & tube well installation
• Overhead tanks (OHT)
• Underground water tanks (UGT)
• Sewerage networks
• Drainage systems
• Septic tanks & soak pits
• STP (Sewage Treatment Plant)
• Rainwater harvesting systems

These services promote hygiene, sustainability, and efficient water usage.

9. Electrical & Utility Works

Along with civil works, we provide integrated electrical and utility services to deliver complete turnkey solutions.

• Internal & external electrification
• Street lighting
• HT/LT lines installation
• Transformer foundations
• Solar lighting systems
• Cable laying & trenching
• Earthing & lightning protection
• DG set foundations
• Utility ducting

10. Industrial & Factory Civil Works

We specialize in heavy-duty industrial construction projects designed to meet safety and operational requirements.

• Factory sheds & PEB structures
• Machine foundations
• Workshops & warehouses
• Storage yards
• Industrial flooring
• Chimney foundations
• Drainage & utility layouts
• Heavy load platforms

11. Interior & Finishing Works

We deliver high-quality interior finishing to enhance aesthetics and functionality.

• False ceiling
• Modular partitions
• Tile & marble flooring
• Painting & polishing
• Doors & windows
• Aluminum & glass works
• Furniture & fittings
• Decorative works

12. Landscaping & External Development

We improve the external appearance and usability of project sites.

• Garden development
• Pathways & walkways
• Paver blocks
• Compound walls & gates
• Parking areas
• Road marking & signage
• Green belt development
• Outdoor lighting

13. Turnkey & EPC Projects

We undertake complete projects on Engineering, Procurement, and Construction (EPC) basis.

• Planning & design
• Material procurement
• Construction & execution
• Quality testing
• Project management
• Handover with documentation

Clients get a single-point responsibility and hassle-free execution.

14. Consultancy & Project Management Services

Our expert team also provides professional support services:

• DPR preparation
• Cost estimation & BOQ
• Tender documentation
• Quantity surveying
• Site supervision
• Quality control
• Billing & measurement
• Project scheduling

15. Specialized Civil Works

We also handle customized and special projects:

• Railway platform works
• Bus terminal & depot construction
• Petrol pump civil works
• Parking structures
• Smart city works
• Boundary fencing
• Demolition works
• Disaster repair works

16. Foundation & Structural Works

We undertake strong and durable foundation works that ensure long-term stability and safety of structures.

• Pile foundation (Bored & Driven piles)
• Raft foundation
• Isolated & combined footing
• PCC & RCC works
• Column, beam & slab casting
• Retaining walls
• Structural strengthening
• Concrete repair works"""

# Images mapping based on existing files
images_map = {
    1: 'our servies image/Our Services/Development_road.jpeg',
    2: 'our servies image/Services php/d3/2 civil_work.jpg',
    3: 'our servies image/Our Services/Construction_of_Building.jpeg',
    4: 'our servies image/Services php/d3/1earth_work.png',
    5: 'our servies image/Our Services/BPCL.jpeg',
    6: 'our servies image/Our Services/fabrication_wor.jpeg',
    7: 'our servies image/Our Services/interior_work.jpeg',
    8: 'our servies image/Services php/d3/4 Pipeline Mechanical Works.jpg',
    9: 'our servies image/Services php/d3/5 Electrical & Utility Works.jpg',
    10: 'our servies image/Our Services/fabrication_wor.jpeg',
    11: 'our servies image/Our Services/interior_work.jpeg',
    12: 'our servies image/Services php/d1/151515151121215151.jpeg',
    13: 'our servies image/Our Services/engiring.png',
    14: 'our servies image/Our Services/tythygh.png',
    15: 'our servies image/Our Services/Petro-Pump-Retail-Outlet.jpeg',
    16: 'our servies image/Services php/d3/1earth_work.png'
}

blocks = re.split(r'\n(?=\d+\.)', raw_text.strip())

php_output = "<?php\n$civil_steps = [\n"

for block in blocks:
    if not block.strip():
        continue
    
    # Extract Number and Title
    match = re.match(r'(\d+)\.\s*(.+)', block)
    if not match:
        continue
    
    number = int(match.group(1))
    title = match.group(2).strip()
    
    # Remaining part is content
    # We need to separate the intro text (if any), the bullet list, and the conclusion text (if any)
    # The pattern typically is: Intro -> List -> Conclusion
    
    rest_of_text = block[match.end():].strip()
    
    # Find bullet list
    # Assuming bullets start with •
    
    # Split by lines
    lines = rest_of_text.split('\n')
    
    intro_lines = []
    bullet_lines = []
    conclusion_lines = []
    
    state = 'intro'
    
    for line in lines:
        line = line.strip()
        if not line:
            continue
        
        if line.startswith('•'):
            state = 'bullets'
            bullet_lines.append(line)
        elif state == 'bullets' and not line.startswith('•'):
            # This is conclusion or next part
            state = 'conclusion'
            conclusion_lines.append(line)
        elif state == 'intro':
            intro_lines.append(line)
        elif state == 'conclusion':
            conclusion_lines.append(line)
            
    # Build content HTML
    content_html = ""
    if intro_lines:
        content_html += f"{' '.join(intro_lines)} <br><br>"
    
    if bullet_lines:
        content_html += "<ul class=\"custom-list\">"
        for b in bullet_lines:
            content_html += f"<li>{b} <br><br></li>"
        content_html += "</ul>"
        
    if conclusion_lines:
        content_html += f"{' '.join(conclusion_lines)}"

    image_path = images_map.get(number, '')

    php_output += "    [\n"
    php_output += f"        'number' => {number},\n"
    php_output += f"        'title' => '{title}',\n"
    php_output += f"        'content' => '{content_html}',\n"
    php_output += f"        'image' => '{image_path}'\n"
    php_output += "    ],\n"

php_output += "];\n?>"

with open('civil_steps.php', 'w', encoding='utf-8') as f:
    f.write(php_output)
