Community
    • Login

    Functions list does not work for (X)HTML files

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 2 Posters 962 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jabcreationsJ Offline
      jabcreations
      last edited by

      The functions list is incredibly useful for me however it does not work in XHTML (and I presume HTML) files.

      I use XHTML files for quick standalone tests and for creating utilities that I need for internal development purposes.

      Here is a simple example of what the structure of the code looks like:

      **<?xml version=“1.0” encoding=“UTF-8”?>
      <!DOCTYPE html>
      <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en”>
      <head>
      <title>Example Application</title>
      <script type=“application/javascript”>
      //<![CDATA[
      function hello_world() {alert(‘Hello World’);}
      //]]>
      </script>
      </head>

      <body>

      <main><p>Hello world.</p></main>

      </body>
      </html>**

      Everything else has been working fine and I haven’t encountered any instability in Notepad++ for probably a good two years now, maybe longer.

      Michael VincentM 1 Reply Last reply Reply Quote 0
      • Michael VincentM Online
        Michael Vincent @jabcreations
        last edited by

        @jabcreations said in Functions list does not work for (X)HTML files:

        The functions list is incredibly useful for me however it does not work in XHTML (and I presume HTML) files.

        You can write your own. Here’s mine:

        <?xml version="1.0" encoding="UTF-8" ?>
        <!-- ==========================================================================\
        |
        |   To learn how to make your own language parser, please check the following
        |   link:
        |       https://npp-user-manual.org/docs/function-list/
        |
        \=========================================================================== -->
        <NotepadPlus>
        	<functionList>
        		<!-- ======================================================== [ Parser goes here ] -->
        
        		<parser
        			displayName="HTML"
        			id         ="html_headers"
        			commentExpr="(?x)                                               # Utilize inline comments (see `RegEx - Pattern Modifiers`)
        							(?:\x3C!--(?:[^\-]|-(?!-\x3E))*--\x3E)          # Multi Line Comment
        						"
        		>
        			<function
        				mainExpr="(?x)                                              # Utilize inline comments (see `RegEx - Pattern Modifiers`)
        						\x3C                                                # begin of node
        						(?:
        							[hH][1-6]
        						)
        						(?:                                                 # match attributes
        							\s+                                             # at least one whitespace before attribute-name
        							\w+
        							\h*=\h*                                         # name-value separator can be surrounded by blanks
        							(?:                                             # quoted attribute value, embedded escaped quotes allowed...
        								\x22(?:[^\x22\x5C]|\x5C.)*?\x22             # ...double quoted...
        							|	\x27(?:[^\x27\x5C]|\x5C.)*?\x27             # ...single quoted
        							)
        						)*
        						(?:
        							\s*
        							\x3E
        						)
        						\w+(\s+\w+)*
        						(?:\x3C/[hH][1-6]\x3E)
        					"
        			>
        				<functionName>
        					<nameExpr expr="(?:\x3C(?:[hH][1-6])(?:\s+\w+\h*=\h*(?:\x22(?:[^\x22\x5C]|\x5C.)*?\x22|\x27(?:[^\x27\x5C]|\x5C.)*?\x27))*(?:\s*\x3E))\K.*" />
        				</functionName>
        			</function>
        		</parser>
        	</functionList>
        </NotepadPlus>
        

        Cheers.

        jabcreationsJ 1 Reply Last reply Reply Quote 3
        • jabcreationsJ Offline
          jabcreations @Michael Vincent
          last edited by

          @michael-vincent Well, I’d thank you though I have no idea what to do with that. I just posted a bug report here:

          https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11235

          Michael VincentM 1 Reply Last reply Reply Quote 0
          • Michael VincentM Online
            Michael Vincent @jabcreations
            last edited by Michael Vincent

            @jabcreations said in Functions list does not work for (X)HTML files:

            I have no idea what to do with that.

            You put it in your Notepad++/functionList folder and restart Notepad++.

            It highlights all the header tags in HTML files. If you want something specific to functions and script tags, you can, as I said, write your own. It’s simple XML. Follow the instructions here https://npp-user-manual.org/docs/function-list/

            It certainly isn’t a bug.

            Cheers.

            jabcreationsJ 1 Reply Last reply Reply Quote 3
            • jabcreationsJ Offline
              jabcreations @Michael Vincent
              last edited by

              @michael-vincent I have mountains on top of my mountains of work; I just don’t have it. I’ve got more than half a dozen dumbshit browser bugs that are extremely difficult to reproduce to report on top of my normal overflow of work. It’s just not happening at my end.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors