Minor HTML language def problem

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by Kasper
Avatar
Hi,

I'm still using version 3 of SyntaxEditor, and I've noticed a small problem with the HTML language def, which I'm not quite sure how to fix. Have a look at this example:
 <div style='font-color: #ffffff;'> 
The space in the attribute value apparently ends the value, which is not correct. It works just fine when using double quotes, like this:

<div style="font-color: #ffffff;">
How is this best fixed? :)

Edit: Ah, I see my problem is shown right here on the board, since the codehighlightning uses the same engine :)

[Modified at 10/12/2006 07:45 AM]

Comments (5)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Just look at the ActiproSoftware.HTML.xml file in the C# sample project. It defines string attribute values as double quote delimited only. You can clone that and add a single quote delimited string attribute state as well. The reference it in the ChildStates of the DefaultState.


Actipro Software Support

Posted 17 years ago by Kasper
Avatar
Wow, you're going a bit fast now hehe :). Is it the entire StartTagAttributeStringValueState that you think I should clone, and give it a new name, or what? An example here would be great :)
Posted 17 years ago by Kasper
Avatar
Okay, I've tried doing what you're describing, and I have made the following changes: I have added this large block:

    <!-- Start Tag Attribute Single Quote String Values -->
    <State Key="StartTagAttributeSingleQuoteStringValueState" TokenKey="StartTagAttributeStringValueDefaultToken" Style="TagAttributeValueStyle">
      <!-- Scopes -->
      <Scopes>
        <Scope>
          <RegexPatternGroup Type="StartScope" TokenKey="StartTagAttributeStringValueStartToken" Style="TagAttributeValueStyle" PatternValue="= {LineTerminatorWhitespaceMacro}* \'" />
          <RegexPatternGroup Type="EndScope" TokenKey="StartTagAttributeStringValueEndToken" Style="TagAttributeValueStyle" PatternValue="\'" />
        </Scope>
      </Scopes>
      <!-- Patterns Groups -->
      <PatternGroups>
        <RegexPatternGroup TokenKey="StartTagAttributeStringValueDefaultToken" PatternValue="[^'&gt;&lt;]+" />
      </PatternGroups>
      <!-- Child States -->
      <ChildStates>
        <ChildState Key="PHPDirectiveCodeState" />
      </ChildStates>
    </State>   
And then I have added this to the ChildStates of the StartTagAttributeState:
<ChildState Key="StartTagAttributeSingleQuoteStringValueState" />
This seems to work, but is it correct? And do I really need to add this much? :)
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That is one way to do it. The other would have been to add the Scope your
defined in your code to the existing State as a second scope. Then in the
StartTagAttributeStringValueDefaultToken PatternValue, add the ' char
to the list of chars to break on.


Actipro Software Support

Posted 17 years ago by Kasper
Avatar
Ah yes, that seems much simpler, and it works as well :). Thank you!
The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.