Skip to content

Instantly share code, notes, and snippets.

@0x4a
Created September 24, 2014 05:46
Show Gist options
  • Save 0x4a/67163211602eed8c6ad9 to your computer and use it in GitHub Desktop.
Save 0x4a/67163211602eed8c6ad9 to your computer and use it in GitHub Desktop.
tidy plentymarkets layout sources while preserving cms syntax - #work #regex #batch
@ECHO OFF & REM coding:oem;
:: Copyright (c) 2014, Daniel Jackel / Samenhaus Müller
:: licensed under the BSD-new license (samenhaus.de/layout/license.txt)
:: www.samenhaus.de / [email protected]
IF [%1] == [] ECHO usage: %0 ^<file^> & exit /b
IF NOT EXIST %1 ECHO file not found: %1 & exit /b
ECHO hide cms syntax
sed -e "s/\([^\x22]\|^\){%% /\1<!--{ %% /g" -e "s/ %%}\([^\x22]\|$\)/ %% }-->\1/g" %1 > %1.$$ && mv %1.$$ %1
rem pause
ECHO tidy...
tidy.exe -config tidy.cfg %1
rem pause
ECHO show cms syntax
sed -e "s/\([^\x22]\|^\)<!--{ %% /\1{%% /g" -e "s/ %% }-->\([^\x22]\|$\)/ %%}\1/g" %1 > %1.$$ && mv %1.$$ %1
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment