Search code examples
razorquotation-marks

quotation marks unmatched when "->" is on the second line


I a writing data-content for bootstrap popover and I want to preserve line breaks in formatting. so I used

.popover {
    white-space: pre-wrap;  
     max-width: 100%;  
}

But I get a warning as soon as I write "->" on the second line.

This is OK

<div class="panel panel-primary">
        <div class="panel-heading panel-head">Factors selection<a href="#" data-placement="left" data-toggle="popover" title="Info" 
             data-content='Select desired pair of factors. 
             Selection goes in this direction: XGroup YGroup, XFactor, YFactor' style="float:right" data-trigger="hover"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a></div>
        <div class="panel-body">

This is OK

<div class="panel panel-primary">
        <div class="panel-heading panel-head">Factors selection<a href="#" data-placement="left" data-toggle="popover" title="Info" 
             data-content='Select desired pair of factors.-> 
             Selection goes in this direction: XGroup YGroup, XFactor, YFactor' style="float:right" data-trigger="hover"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a></div>
        <div class="panel-body">   

Warning, Quotation marks unmatches

<div class="panel panel-primary">
        <div class="panel-heading panel-head">Factors selection<a href="#" data-placement="left" data-toggle="popover" title="Info" 
             data-content='Select desired pair of factors. 
             ->Selection goes in this direction: XGroup YGroup, XFactor, YFactor' style="float:right" data-trigger="hover"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a></div>
        <div class="panel-body">

Solution

  • The '->' causes an error because by itself it would normally imply an end of comment as '<!--' implies the beginning of a comment.Because it appears on a new line, html treats it as the comment and not as a continuation of the text above. For best practice I recommend using &#10\; and &#13\; (ignore the \) like

    'Select desired pair of factors.&#10;&#13;->Selection goes in this direction: XGroup YGroup, XFactor, YFactor'
    

    It reads easier and the next programmer will understand your intentions more clearly than just an open amount of whitespace.