Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Automatically adding HTML comment after closing <div> element

New Here ,
Nov 24, 2012 Nov 24, 2012

Having looked around the exchange and trying a search on google I have yet to come across a solution that can do this.

Is there a possibility of letting Dreamweaver automatically add a HTML comment after the </div> tag which specifies which ID (and/or classes) it is closing? Could be a quick and easy way to keep track of where one is in the code.

Appreciate any tips!

TOPICS
Extensions
6.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 06, 2012 Dec 06, 2012
LATEST

I think you're asking:  can an extension be written to do this?

Full disclosure:  I'm not a DW extension developer, just an extension hacker with lots of general s/w hacking experience but little in DW -- and little in Javascript.  I hope someone with much more DW extension development experience joins in.

Until that happens:   I think your requirement divides into two issues:  1) Can a DW extension detect the matching div open tag and sniff out its parameters (probably wrong terminology, but hopeful still understandable) , and 2) When does this occur?

For 1),  I think the answer is yes, you can search the current page and locate each opening div, snip out the parameters, put  them into comment form as you require, and postpend the comment past the closing div.  I don't think this would be too difficult.

For 2), when can this happen?   I don't think it can be done dynamically, as you edit.  I've hacked existing extensions that do HTML clean-up to do different cleanup.  I invoke them from the bottom of the Commands menu.   I guess that you could invoke a "add HTML comment to Divs" command as needed.   Another possibliity is to trigger the function on file close/save, so the next time you open the file, the comments would be visible. That might be sufficient or not.

I'm assuming you are writing markup directly, in Code View.  Stepping back, I'm going to make a very old-fashioned suggestion: Why not simply add a brief comment yourself, without automation?   An comment generated by an extension is going to be very literal.  Your comment can specify both the literal information (the ID and/or classes being closed)  and any higher-level issues.   There's a way in DW to get help locating the opening tag, if that's the issue...

HTH

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines