Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTML element text processor commands (#feature-request #quest59) #1337

Closed
KVonGit opened this issue Jan 1, 2025 · 5 comments
Closed

Comments

@KVonGit
Copy link
Collaborator

KVonGit commented Jan 1, 2025

We've already got the code for this, and it was in the last available testing build.

CoreTypes (add to game.textprocessorcommands)

      <item key=":">
        game.textprocessorcommandresult = ProcessTextCommand_Element (section, data)
      </item>
      <item key="/">
        game.textprocessorcommandresult = ProcessTextCommand_Element (section, data)
      </item>
    </textprocessorcommands>

CoreOutput.xml

  <function name="ProcessTextCommand_Element" parameters="section, data" type="string"><![CDATA[
    if (IsRegexMatch(":?/?\\w+\\b((?<=\\s)\\w+\\b|(?<=\\s)\\w+=\\w+\\b|(?<=\\s)\\w+=\"[^\"]*\"|(?<=\\s)\\w+='[^']*')*/?\\s*", section)) {
      if (StartsWith (section, ":")) section = LTrim (Mid (section, 2))
      return("<" + section + ">")
    }
    else {
      return ("@@@open@@@" + ProcessTextSection (section, data) + "@@@close@@@")
    }
  ]]></function>

image


https://textadventures.co.uk/forum/quest/topic/ykouw7idaeytupcl3rmywa/isnt-there-an-easy-way-to-add-text-processor-commands-solved

@Pertex
Copy link
Collaborator

Pertex commented Jan 1, 2025

Does this also work with nested calls?

@KVonGit
Copy link
Collaborator Author

KVonGit commented Jan 1, 2025

Do you mean like this?

{:div id="test-div"}{:span id="test-span"}I am the text in the SPAN.{/span}{/div}

😮 I never tested that! Hold on...


Whew... Yep!

image

@Pertex
Copy link
Collaborator

Pertex commented Jan 1, 2025

And this feature is available in the actual Questversion?

@KVonGit
Copy link
Collaborator Author

KVonGit commented Jan 1, 2025

And this feature is available in the actual Questversion?

It's in the last available testing build, but I haven't created a PR yet.

(I really only created this particular issue to link to it from the PR. That seems to be how Alex does things.)

@KVonGit KVonGit changed the title Feature request: Add HTML element text processor commands Add HTML element text processor commands [feature request] Jan 1, 2025
@KVonGit KVonGit changed the title Add HTML element text processor commands [feature request] Add HTML element text processor commands (#feature-request #quest59) Jan 2, 2025
KVonGit added a commit to KVonGit/quest that referenced this issue Jan 15, 2025
Closes textadventures#1337

Allows things like this (for the WebEditor users, who can't always use `<`):
```
{:div id="test-div"}{:span id="test-span"}I am the text in the SPAN.{/span}{/div}
```

`<div id="test-div"><span id="test-span">Iam the text in the SPAN.</span></div>`
@KVonGit
Copy link
Collaborator Author

KVonGit commented Jan 20, 2025

This is technically a duplicate of #1231

@KVonGit KVonGit closed this as completed Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants