Coder Social home page Coder Social logo

cfabrica46 / attrdet Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3 KB

The attrdet package provides tools to detect special attributes in HTML files. It includes two frameworks: AngularDetector and ThymeleafDetector, which implement the AttributeDetector interface. These frameworks allow the detection of attributes corresponding to Angular and Thymeleaf technologies, respectively.

Go 100.00%

attrdet's Introduction

๐Ÿ“ฆ Attrdet

Welcome to the Attrdet ๐Ÿš€ project! This package is all about empowering you to effortlessly detect special attributes in HTML files. With the help of two charming ๐ŸŒŸ detectives, AngularDetector and ThymeleafDetector, you'll uncover the secrets of Angular (๐Ÿ…ฐ๏ธ) and Thymeleaf (๐ŸŒฟ) attributes hidden within your web pages.

What's Inside?

๐Ÿ•ต๏ธโ€โ™‚๏ธ AngularDetector: ๐Ÿ…ฐ๏ธ

Discover the magic of Angular as the AngularDetector takes you on a thrilling journey through the DOM, revealing any attributes with the distinct "ng-" prefix. You'll be amazed at how simple and efficient it is to find Angular's hidden treasures!

๐Ÿ•ต๏ธโ€โ™€๏ธ ThymeleafDetector: ๐ŸŒฟ

Embrace the tranquility of Thymeleaf with the ThymeleafDetector. Watch in awe as it gracefully glides through the DOM, skillfully detecting any attributes adorned with the "th:" prefix. Let the enchanting beauty of Thymeleaf leave you spellbound!

How to Use?

It's as easy as 1-2-3! Just import the package and let the detectives do their magic:

package main

import (
	"fmt"
	"strings"

	"github.com/your_username/attribute_detector"
)

func main() {
	content := `<html><body><div ng-click="doSomething()" th:if="isVisible">Content</div></body></html>`

	doc, _ := html.Parse(strings.NewReader(content))

	// Angular Detector
	angularAttrs := make(map[string]int)
	angularDetector := &attribute_detector.AngularDetector{}
	angularDetector.DetectAttributes(doc, angularAttrs)
	printAttributes("Angular (ng) attributes:", angularAttrs)

	// Thymeleaf Detector
	thymeleafAttrs := make(map[string]int)
	thymeleafDetector := &attribute_detector.ThymeleafDetector{}
	thymeleafDetector.DetectAttributes(doc, thymeleafAttrs)
	printAttributes("Thymeleaf attributes:", thymeleafAttrs)
}

func printAttributes(title string, attrs map[string]int) {
	fmt.Println(title)
	for attr, count := range attrs {
		fmt.Printf("%s: %d occurrences\n", attr, count)
	}
}

Contributions ๐Ÿค

Contributions, bug reports, and suggestions are more than welcome! If you spot any issues or have ideas to make this package even better, please create an "issue" in the repository.

License ๐Ÿ“œ

This package is open-source and available under the MIT License. See the LICENSE file for more details.

Start the investigation now! ๐Ÿ•ต๏ธโ€โ™‚๏ธ๐Ÿ•ต๏ธโ€โ™€๏ธ Unveil the secrets of Angular (๐Ÿ…ฐ๏ธ) and Thymeleaf (๐ŸŒฟ) attributes with the Attribute Detector and enjoy the magic ๐ŸŽ‰ in your HTML files!

attrdet's People

Contributors

cfabrica46 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.