Code Monkey home page Code Monkey logo

emmet-pascal's People

Contributors

alexey-t avatar rickard67 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

emmet-pascal's Issues

strange issue with #dd

In my app, #nn expands to <div id="nn"></div>

But, #dd expands to #<dd></dd>

Can you check it in RJ-TextEd?

7 equal fragments in code

  Result := StringReplace(Result, '\n', #13#10, [rfReplaceAll]);
  Result := StringReplace(Result, '\t', #9, [rfReplaceAll]);

occurs N times. DRY principle.

StringList.Sorted is reset and then we have exception

I pass Sorted stringlist. then you do:

procedure TEmmet.AddHTMLTagListForValidation(const AList: TStringList);
begin
  if not Assigned(AList) or (AList.Count = 0) then Exit;

  // Ignore and exit if list is already populated
  if Assigned(FHTMLTagList) then Exit;

  // Create a sorted list of added tags
  FHTMLTagList := TStringList.Create;
  FHTMLTagList.Assign(AList);
  FHTMLTagList.CaseSensitive := False;
  FHTMLTagList.Sort;

  if not FHTMLTagList.Sorted then //Alex added
    raise exception.create('dd'); //raised!!   
end;

Sorted is reset, then Find method gives the exception.
FPC 3.2.3.

Idea about new Pascal code part

Many apps need this code. So the idea.
Find URLs in the AnsiString and UnicodeString - without using RegEx.
By custom Pascal code.
First, search must find one of possible beginnings:

  • word boundary
  • one of words in lowercase: 'mailto:', 'http://', 'https://', 'ftp://' with the following word-char and with proper ending

If OK beginning exists, do the complex search for ending. Ending:

  • for 'mailto:' ending is set of word-chars, '@', dot, plus, minus, underscore
  • for http and https: ending is very complex, we must allow: port number after ":", "/" with following unix path, "?" with URL params, '#' with anchor-chars
  • for ftp: ending is much simpler than for http

Why the idea? Avoid slow search by RegEx. What do you think @rickard67 ?

GetLineCount

function TEmmet.GetLineCount(const s: string): Integer;
var
  n: Integer;
begin
  Result := 1;
  n := Pos(#10,s);
  while n > 0 do
  begin
    Inc(Result);
    n := PosEx(#10,s,n+1);
  end;
end;

Simpler code can be
using of S.CountChar(#10) + 1.

https://www.freepascal.org/docs-html/rtl/sysutils/tstringhelper.countchar.html (fpc) / https://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.TStringHelper.CountChar (delphi).

or using this simple func.

function CountOfChar(ch: Char; const S: string): Integer;
var
  i: Integer;
begin
  Result := 0;
  for i := 1 to Length(S) do
    if S[i] = ch then
      Inc(Result);
end; 

add pipe-char for one CSS snippet

[snippets-css]
!=!important

->

[snippets-css]
!=!important|

this pipe-char added, allows to put caret after !important so user don't have to press END each time!

Lorem - need to make it like in VS Code

VSCode allows this

lorem[tab]
->
lorem text with about 30 words

Currently Emmet-Pascal makes <lorem></lorem> - nonsense.

p*2>lorem[tab]
->

<p>
  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus
  molestiae vel beatae natus eveniet ratione temporibus aperiam harum alias
  officiis assumenda officia quibusdam deleniti eos cupiditate dolore doloribus!
</p>
<p>
  Ad dolore dignissimos asperiores dicta facere optio quod commodi nam tempore
  recusandae. Rerum sed nulla eum vero expedita ex delectus voluptates rem at
  neque quos facere sequi unde optio aliquam!
</p>

Please make like VS Code.

unneeded space char before the 'class='

img, and some other tags (2-4 tags, or all other tags?) give redundant space before class="nn"

img.nn ->

<img src="" alt=""  class="nn"/>

base.nn ->

<base href=""  class="nn"/>

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.