Giter VIP home page Giter VIP logo

beautifier-prettydiff's Introduction

beautifier-prettydiff

Build Status Test Coverage Greenkeeper badge

Pretty Diff beautifier for Unibeautify

Installation

npm install --global @unibeautify/beautifier-prettydiff

Usage

See unibeautify-cli for details.

beautifier-prettydiff's People

Contributors

dependabot[bot] avatar glavin001 avatar greenkeeper[bot] avatar prettydiff avatar renovate-bot avatar renovate[bot] avatar stevenzeck avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

beautifier-prettydiff's Issues

Twig endif tag removed

Describe the bug
The endif tag is removed by the formater when i press ctrl + shift + i to format on vs code.

To Reproduce
Steps to reproduce the behavior:
make a twig or html (configured as twig file) and put this in:

<a class="nav-link" {% if m.href is defined %} href="{{ m.href }}" {% endif %} {% if m.id is defined %} id="{{m.id}}" {% endif %}>
	<i class="fa fa-icon"></i>
	<p>{{ m.label }}</p>
</a> 

Expected behavior
to not make anything

Actual

<a class="nav-link" {% if m.href is defined %} href="{{ m.href }}" {% endif %} {% if m.id is defined %} id="{{m.id}}">
	<i class="fa fa-icon"></i>
	<p>{{ m.label }}</p>
</a>

Error/Stack Traces
it just removes the second endif tag

System (please complete the following information):

  • OS: Ubuntu
  • Version: 18.04.2 LTS

Additional context
.unibeautifyrc.json config file:

{
	"HTML": {
		"indent_size": 1,
		"indent_style": "tab"
	}
}

Spaces between quote and value in CFML attributes in real time product causing code errors - needs to not happen!

Unibeautify Playground link

Language: ColdFusion

Config:

{
  "ColdFusion": {
    "indent_comments": true,
    "indent_style": "tab",
    "indent_size": 1,
    "max_preserve_newlines": 1,
    "quotes": "none",
    "wrap_line_length": 60,
    "force_indentation": false,
    "beautifiers": [
      "Pretty Diff"
    ]
  }
}

Input:

	<cfform name="frm_coupon_list" method="post" action="/admin/coupons/">
      <table width="100%" cellspacing="1" cellpadding="2" border="0" class="hover row-border stripe cell-border" id="maintbl">
        <thead>
          <tr>
            <td>
              Name</td>
            <td>
              Code</td>
            <td>
              Expiration Date</td>
          </tr>
        </thead>
 <tbody><tr><td>hello</td><td>goodbye</td></tr></tbody></table></cfform>
   

Output: The example version is correct; that is, it is NOT putting a space in, but the actual product in VSCode does (e.g. name="frm_coupon_list" comes out as name=" frm_coupon_list ")

<cfform
	name="frm_coupon_list"
	method="post"
	action="/admin/coupons/">
	<table
		width="100%"
		cellspacing="1"
		cellpadding="2"
		border="0"
		class="hover row-border stripe cell-border"
		id="maintbl">
		<thead>
			<tr>
				<td>
					Name</td>
				<td>
					Code</td>
				<td>
					Expiration Date</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>hello</td>
				<td>goodbye</td>
			</tr>
		</tbody>
	</table>
</cfform>

Expected behavior:

Remove CSV support from Pretty Diff

Go to http://prettydiff.com/

value1,value2,value3,value4,value5,value6

image

And the tests:

Summary of all failing tests
 FAIL  test/languages/csv.spec.ts
  ● should successfully beautify CSV text

    TypeError: value.split is not a function

      at Diff.Object.<anonymous>.lineDiff.tokenize (node_modules/diff/src/diff/line.js:7:32)
      at Diff.diff (node_modules/diff/src/diff/base.js:28:39)
      at diffLines (node_modules/diff/src/diff/line.js:31:71)
      at structuredPatch (node_modules/diff/src/patch/create.js:11:16)
      at Object.createTwoFilesPatch (node_modules/diff/src/patch/create.js:101:16)
      at InlineFlagManager.get rawPatch [as rawPatch] (node_modules/unibeautify/src/InlineFlagManager.ts:56:7)
      at InlineFlagManager.get patch [as patch] (node_modules/unibeautify/src/InlineFlagManager.ts:39:13)
      at InlineFlagManager.get text [as text] (node_modules/unibeautify/src/InlineFlagManager.ts:17:13)
      at beautifier.beautify.then.newText (node_modules/unibeautify/src/beautifier.ts:371:29)

Support Liquid

Prettydiff does a much better job at beautifying Liquid than JS Beautify.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • read-pkg-up ^7.0.0
  • @types/node 12.20.55
  • @types/jest 24.9.1
  • jest 24.9.0
  • npm-run-all2 5.0.2
  • prettydiff 101.2.6
  • rimraf 3.0.2
  • ts-jest 24.3.0
  • tslint 5.20.1
  • tslint-clean-code 0.2.10
  • tslint-microsoft-contrib 6.2.0
  • typescript 3.9.10
  • unibeautify 0.17.1
  • unibeautify >= 0.11.2
  • prettydiff ^101.0.6
travis
.travis.yml
  • node 8
  • node 10

  • Check this box to trigger a request for Renovate to run again on this repository

Space after @

A space is added after the @. The Code is not working after formatting and i don't see a configuration to disable adding the space.

Unibeautify Playground link

Language: C#

Config:

{
  "C#": {
    "indent_comments": true,
    "indent_style": "space",
    "indent_size": 2,
    "max_preserve_newlines": 10,
    "quotes": "none",
    "wrap_line_length": 80,
    "break_chained_methods": false,
    "multiline_ternary": "always",
    "align_assignments": false,
    "beautifiers": [
      "Pretty Diff"
    ]
  }
}

Input:


public test()
{
        //Script wird gestartet
        Process.Start(@"\\ATHENE\Users\frottmann\Desktop\testPolicy\PolicyTest.bat");

        return null;
}

Output:

public test() {
  //Script wird gestartet
  **Process.Start(@ "\\ATHENE\Users\frottmann\Desktop\testPolicy\PolicyTest.bat");**

  return null;
}

Expected behavior:

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

HTML table tr td get more and more indented when prettified (Coldfusion)

Just starting to use Unibeauty for very chaotic old Coldfusion code that I got from a client. The code is complex and the existing formatting is quite chaotic so I really hope that this tool will help.
I just pasted a small piece of code into the Unibeautify Playground and find that the result gets indented more and more - it seems that HTML table cells aren't aligned under each other but each td gets indented so the indentation builds up. The same applies for tr rows.
Is there something I can do about it? Is there a way to configure the behaviour of 'Pretty Diff'? sorry if this is a stupid beginner question.

Here is more or less original code that shows what I mean. It contains Coldfusion but is mostly HTML, I called it ".htm" to make it visible.

-Michael

http://www.mpeters.de/temp/CF_Unibeautify_Test.htm

[HTML Formatting] Typescript input values un-camelcased when using wrap_attributes: force.

Take the following snippet for example:
<form id="searchFormContainer" [formGroup]="searchForm" class="flex-column"></form>
When running this through the playground, you can see that it ends up changing the case in [formGroup], resulting in:
<form id="searchFormContainer" [formgroup]="searchForm" class="flex-column"></form>

This completely breaks the compiler.
YAML:
HTML: beautifiers: - Pretty Diff - JS-Beautify wrap_attributes: force

the number 0L shouldn't have a space inserted between the "0" and the "L"

Unibeautify Playground link

Language: Java

Config:

{
  "Java": {
    "indent_comments": true,
    "end_with_comma": false,
    "indent_style": "space",
    "indent_size": 2,
    "break_chained_methods": false,
    "max_preserve_newlines": 10,
    "quotes": "none",
    "space_after_anon_function": false,
    "multiline_ternary": "never",
    "align_assignments": false,
    "wrap_line_length": 80,
    "beautifiers": [
      "Pretty Diff"
    ]
  }
}

Input:

public class AA {
  public static void main(String[] args) {
    System.out.println(0L);
  }
}

Output:

public class AA {
  public static void main(String[] args) {
    System.out.println(0 L);
  }
}

Expected behavior:
the long 0L shouldn't be touched by the code beautifier, but instead, there is a forbidden space inserted between the "0" and the "L". Examples: the playground linked above, as well as a commit in my project thing (its a really small project i know), as well as the Travis CI build that failed for that commit

The config file used in my project is slightly different, here it is.

Other longs are also affected (like here).

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.