npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@phoenix-plugin-registry/ampscript-beautifier

v1.0.16

Published

Make AMPscript beautiful again!

Downloads

16

Readme

ampscript-beautifier

Make AMPscript beautiful again!

This Brackets extension reformats AMPscript (from Salesforce.com Marketing Cloud/ExactTarget) for enhanced readability.

From this:

%%[
/* 4th level nested IF statement */

if @sk == "" AND @Debug != "" then
if @Version == "PROD" then
set @sk="00390000028vpjeAAA"
if @Test1 == "Test1" then
set @Test1 == "PASS"
if @Test2 == "Test2" then
set @Test2 == "PASS"
endif
endif
set @email = "[email protected]"
set @Job_ID = "2336090"
set @List_ID = "43"
elseif @Version == "PROD" then
set @sk="003p000000Fnl4JAAR"
set @email = "[email protected]"
set @Job_ID = "2343525"
set @List_ID = "43"
endif
endif
]%%

To this:

%%[
/* 4th level nested IF statement */

IF @sk == "" AND @Debug != "" THEN
	IF @Version == "PROD" THEN
		SET @sk= "00390000028vpjeAAA" 
		IF @Test1 == "Test1" THEN
			SET @Test1 == "PASS" 
			IF @Test2 == "Test2" THEN
				SET @Test2 == "PASS" 
			ENDIF
		ENDIF
		SET @email = "[email protected]" 
		SET @Job_ID = "2336090" 
		SET @List_ID = "43" 
	ELSEIF @Version == "PROD" THEN
		SET @sk= "003p000000Fnl4JAAR" 
		SET @email = "[email protected]" 
		SET @Job_ID = "2343525" 
		SET @List_ID = "43" 
	ENDIF
ENDIF
]%%

Features

  • Indents IF statements correctly (including nested IF statements)
  • Uppercases all controls and functions (IF, THEN, DO, UPSERTDATA etc.)
  • Standardized indenting by removing excessive whitespace (fixes bad user formatting)
  • Standardized string formatting
  • Standardized function formatting
  • Formatting can be applied to whole code or selected code only

Installation

Download Brackets here: http://brackets.io/

You may download and install this extension in one of three ways. Using Extension Manager to find it through the extension registry you always find the latest stable release conveniently within Brackets.

You can also get the latest work-in-progress version by downloading or installing the extension directly from the repository. This allows you to try new features that might not have been tested properly yet.

Install using Extension Manager (Recommended - Stable Release)

  • Open the the Extension Manager from the File menu.
  • Click the Available tab in upper left corner.
  • Find AMPscript Beautifier in list of extensions (use the search field to filter the list).
  • Click Install

Install from URL

  • Open the the Extension Manager from the File menu
  • Click on Install from URL...
  • Copy and paste following URL in the text field: https://github.com/ccarswell/ampscript-beautifier/
  • Click Install

Install from file system (latest version)

  • Download this extension using the ZIP button and unzip it
  • Copy it in Brackets' /extensions/user folder by selecting Show Extension Folder in the Help menu
  • Reload Brackets

Running

  • Run by pressing Ctrl+Shift+A or by going to Edit > AMPscript Beautifier

Todo

  • Improved error reporting (currently just errors to Brackets Console)
  • Integration with HTML

Bugs

  • Doesn't play well with other HTML just yet. If errors are occuring (or nothing happens), please select AMPscript block code only.
  • Double check all CONCAT strings after running - whitespace is automatically trimmed within double quotes.

Resources

  • Parser generated using https://pegjs.org/