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.
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.
-
@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.
-
@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
-
@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.
-
@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.