Coder Social home page Coder Social logo

jsprettify's People

Watchers

 avatar

jsprettify's Issues

prettifyHtml should operate in-place instead of cloning DOM subtrees

prettifyHtml currently operates by returning a prettified deep clone of the 
DOM subtree it's told to prettify. The theory is that this makes it more 
"functional" in the sense of referentially transparent---prettifyHtml has no 
side effects, making it easier to test, analyze, and reason about.

Unfortunately, this breaks down in practice since the common case is to 
simply replace the old subtree with the new one anyway, and this turns out to 
be a pretty huge side effect. In particular, only the DOM content is cloned, 
and not any event listeners (unverified), references to the originals 
(verified; causes problems, see issue 28), et cetera. So, prettifyHtml should 
be changed to operate in place; if the former behavior is for some reason 
desired, it can just be given a pre-cloned subtree anyway.

Original issue reported on code.google.com by mrdomino on 8 May 2010 at 4:12

  • Blocking: #28

test case "testPrettifiesQuotesAtStartOfLine" is broken

This issue was created by revision f81d190748.

The test for prettifying quotes at the start of the line is broken: it assumes
greedy replacement, so this revision causes it to fail.

Update issue 14
The test case specified now passes, but the issue is still outstanding, as
evidenced by the failure of testMatchesQuotesAcrossTags. This will probably
require some extra fiddling with prettifyHtml and prettifyStr alike.

Original issue reported on code.google.com by mrdomino on 6 Apr 2010 at 9:38

Double quotes inside single quotes are not prettified

This issue was created by revision a689788e57.

This string:
  '"Here I am", said Sam'
Should look like:
  ‘“Here I am”, said Sam’
But looks like:
  ‘"Here I am”, said Sam’

Original issue reported on code.google.com by mrdomino on 7 Apr 2010 at 5:23

Quote replacement is greedy

What steps will reproduce the problem?

1. Type a sentence containing a word with a contraction at the
   beginning, such as some Macbeth:

    If it were done when 'tis done, then 'twere well
    It were done quickly.

2. Use the bookmarklet.

What is the expected output? What do you see instead?

I expect:

    If it were done when ’tis done, then ’twere well
    It were done quickly.

I see:

    If it were done when ‘tis done, then ‘twere well
    It were done quickly.

Please provide any additional information below.

Pandoc does this properly when you pass --smart to it.

Original issue reported on code.google.com by [email protected] on 4 Mar 2010 at 3:07

Bookmarklet doesn't work in iframes

Buzz appears to use textareas for its input fields, but for some reason the 
bookmarklet can't fix typography inside of them. Note that the bookmarklet 
works fine with GTalk IM windows.

Original issue reported on code.google.com by mrdomino on 4 Mar 2010 at 7:39

  • Blocking: #5

Fails to prettify quotes in parentheses

This issue was created by revision 7fc65bdcc8.

The string:
  ("")
Should look like:
  (“”)
But looks like:
  ("")

And similar with single quotes.

Original issue reported on code.google.com by mrdomino on 8 Apr 2010 at 12:26

Make the bookmarklet use prettifyHtml on fields with contentEditable set

Right now, the bookmarklet is limited to text fields. It'd be nice if it also 
handled rich content. One way to do that is to find fields that have 
contentEditable set, and pass them through prettifyHtml. This is a reasonable 
stop-gap approach on the way to getting full dynamic prettification of rich 
content.

Original issue reported on code.google.com by mrdomino on 11 May 2010 at 2:26

Does not prettify quoted punctuation, e.g. slashes

This issue was created by revision 41b665ba49.

The string:
  "/"
Should look like:
  “/”
But looks like:
  ”/”

We sometimes want to quote punctuation characters, but we also don't
want them to interfere with other quoted phrases. This and the test
before it might together make the case for making the double quote
matcher non-greedy.

Original issue reported on code.google.com by mrdomino on 10 Apr 2010 at 12:02

The demo sucks

The example.html demo is boring and static. It should be a textarea that 
live-updates an output box containing the prettified version of the input 
text.

Original issue reported on code.google.com by mrdomino on 25 Mar 2010 at 4:36

Failure to prettify multilevel nested quotes

The string:
  'x "x 'x "x 'x "x" x' x" x' x" x'
Should look like:
  ’x “x ’x “x ’x “x” x’ x” x’ x” x’
But looks like:
  ‘x “x ‘x “x ’x “x” x’ x” x’ x” x’

Revision 374c3ed4f634 introduces a failing test for this. It takes 6 levels 
of nesting to trigger this.

Original issue reported on code.google.com by mrdomino on 7 Apr 2010 at 10:31

jsprettify doesn't play well with Hyphenator.js

When a site includes both jsprettify and Hyphenator.js 
<http://code.google.com/p/hyphenator>, hyphenated blocks will have their 
CSS visibility set to "hidden" after the page has finished loading -- that 
is, they won't be visible.

It looks like this is a problem with the currently recommended manner of 
calling jsprettify (assigning it as the onload function). As a workaround, 
remove this script block from the document head:
    <script>
      window.onload = window.prettify;
    </script>
And add this as the very last element in the document body:
    <script>
      window.prettify();
    </script>

This at least appears to work. Probably we should make jsprettify callable 
via window.jsprettify.run(); or something though.

Original issue reported on code.google.com by mrdomino on 7 May 2010 at 3:30

  • Blocked on: #30

LaTeX-style smart quotes

jsPrettify should support TeX-style quotes (``'') and should implement 
dumb-quote prettification in terms of a dumb-to-TeX conversion step.

The advantage here is that prettifyStr would get a lot simpler with quote 
matching factored into a different function---just simple string 
replacements without any advanced RegExp voodoo.

One possible problem: TeX quotes are sometimes ambiguous. Does ```''' mean 
“‘’” or ‘“”’? The obvious answer is to always assume 
double-in-single for 
cases like this, but it's uncertain if that will cause problems.

Pulling out the quote matching into its own function also means we can get 
fancier with it without cluttering prettifyStr. We can also be greedier 
with prettifyStr: we only ever need to track local context when prettifying 
e.g. a text input being typed into, whereas the current implementation 
needs the whole string---prohibitive if we're prettifying a large document 
as it's being edited.

Original issue reported on code.google.com by mrdomino on 10 Apr 2010 at 12:38

Bookmarklet is broken on Facebook

What steps will reproduce the problem?
1. Go to Facebook.com
2. Type some text.
3. Use the bookmarklet.

What is the expected output? What do you see instead?
Expected: your text is prettified.
Instead: nothing happens; on some pages, Facebook throws an alert at you.

Please use labels and text to provide additional information.
This appears to be a recent occurrence; my best guess is that some Facebook 
code isn't playing nicely with Closure.

Noticed in Chrome on Linux.

Original issue reported on code.google.com by mrdomino on 28 Mar 2010 at 12:21

There's no way to be sure that I'm not evil

This issue was created by revision a08b291721.

By having the bookmarklet grab a copy of prettify-comp.js from Google
Code, we could ensure that I wasn't doing anything malicious: any
modification made to the script would show up in the revision log. Now,
there's nothing stopping me from redirecting the script to evil.js which
harvests your credentials and sends profane emails to your boss.
Granted, I promise not to, but if you're paranoid, that might not bew
good enough.

Ideally, we could verify a hash or signature on the script file to
ensure it hadn't been tampered with. This is hard to do in a
bookmarklet, though, especially since XSS rules prevent us from
launching XMLHttpRequests to other domains (e.g. to grab the source
code).

Original issue reported on code.google.com by mrdomino on 22 Apr 2010 at 2:23

Modify make_bookmarklet.pl and remove bookmarklet.sh

bookmarklet.sh is doing things that could be trivially done in Perl instead. 
This makes it redundant; make_bookmarklet.pl should be modified and 
bookmarklet.sh removed.

Original issue reported on code.google.com by mrdomino on 4 Mar 2010 at 7:42

jsprettify doesn't prettify quoted contractions properly

This issue was created by revision d864a1da09.

When a contraction is surrounded by single quotes, jsprettify doesn't
catch the opening single quote.

Original issue reported on code.google.com by mrdomino on 7 Apr 2010 at 5:07

Some jsprettify code is deprecated

Historically, the way to call jsprettify functions was with window.foo for 
foo in jsprettify. This polluted the global namespace, meaning that anyone 
else who wanted to define window.prettifyStr (for instance) would get 
clobbered. The new way to call jsprettify functions is window.jsprettify.foo, 
and as of rev 66cefaa067, the old way will now throw up an alert box. At some 
point, the old functions will be removed completely.

Original issue reported on code.google.com by mrdomino on 8 May 2010 at 4:49

window.prettify is broken in IE 7+

jsPrettify's prettifyHtml doesn't work in IE 7, 8, or 9 preview. Looks like I 
got so caught up in excitement over it working in IE6 that I never bothered 
with anything else. hg bisect reveals that it's never worked in IE7+.

Original issue reported on code.google.com by mrdomino on 23 Apr 2010 at 11:52

Bookmarklet doesn't work with Google Docs

The bookmarklet currently just replaces text in textareas and input fields. 
This doesn't work in rich edit fields like Google Docs. We might need to use 
jsprettify.prettifyHtml instead, and examine the rich editing forms to see 
what they're doing.

Original issue reported on code.google.com by mrdomino on 4 Mar 2010 at 7:32

  • Blocked on: #6

Write prettifyHtml

prettifyHtml is a little tricky. Our main benchmark for comparison, 
Hyphenator.js, appears to injudiciously hyphenate the entire document, tags 
and links included (correct me if I'm wrong.) In our case, we can't, since 
we're mucking with quotes. Instead, we need to walk the DOM tree and 
prettify e.g. all children of the requested node who have nodeType Text. We 
may have to do something special if some text nodes are bad to prettify.

Original issue reported on code.google.com by mrdomino on 24 Feb 2010 at 4:28

Bookmarklet breaks Google Calendar's email form

What steps will reproduce the problem?
1. Go to the page of an event with multiple guests on Google Calendar.
2. Click the "Email Guests" link.
3. Use the jsPrettify bookmarklet on the form; now try to submit it.

What is the expected output? What do you see instead?
The form should submit normally, and the page should remain interactive. 
Instead, the links and buttons all stop working.

Please use labels and text to provide additional information.
Encountered in Google Chrome on Linux.

Original issue reported on code.google.com by mrdomino on 25 Mar 2010 at 8:41

prettifyHtml removes leading whitespace

This issue was created by revision d9fd3b8d78.

prettifyHtml strips leading whitespace from text nodes that follow HTML
tags. E.g. "a <em>b</em> c" becomes "a bc" instead of "a b c". This
might be a problem with our usage of goog.dom.(get|set)TextContent.

Original issue reported on code.google.com by mrdomino on 22 Apr 2010 at 7:19

contiguous single quote pairs are not properly prettified.

This issue was created by revision c10aabb1a9.

When contiguous single quote pairs, e.g. "'a' 'b' 'c'", are prettified, every
other one ("'b'" in this case) doesn't get matched as a quote pair. The
problem is that the regex eats the space character in the previous match, so
the rule doesn't get triggered if it's only run once.

Original issue reported on code.google.com by mrdomino on 6 Apr 2010 at 9:58

Nodes that are not direct descendants of document.body are not prettified.

When window.prettify is called with a document that contains a node with 
class 'prettify' that is not nested directly under document.body, prettify 
raises an exception: NOT_FOUND_ERR. This makes window.prettify totally 
useless for non-trivial HTML.

Original issue reported on code.google.com by mrdomino on 4 Mar 2010 at 6:54

The jsPrettify logo isn't prettified by jsPrettify

This issue was created by revision 33d832367e.


The string '"---"' should appear as '“—”'. Instead, it appears as 
'“—“'.

Original issue reported on code.google.com by mrdomino on 25 Mar 2010 at 9:48

Does not properly prettify quoted words between dashes

This issue was created by revision 2b0f50f2cd.

The string:
  With---'imaginary'---dashes.
Should look like:
  With—‘imaginary’—dashes.
But looks like:
  With—’imaginary’—dashes.

Original issue reported on code.google.com by mrdomino on 7 Apr 2010 at 5:30

Create an autoprettify bookmarklet

The current bookmarklet requires manual intervention every time you want to 
use it. This is no good; ideally, you'd be able to enable prettification 
once per page and then have text prettified manually. Such a bookmarklet 
shouldn't be too hard to write: just store original input in a buffer, and 
stick the prettified version into the input field.

Original issue reported on code.google.com by mrdomino on 29 Mar 2010 at 2:18

prettifyHtml isn't good about apostrophes and HTML tags

This issue was created by revision aa6e12c47e.

When prettifyHtml is given a quoted element inside of a tag, it doesn't
properly recognize apostrophes. Using LaTeX quote shorthand, "'<em>foo</em>'s"
becomes "`<em>foo</em>`s", but it should be "`<em>foo</em>'s".

Original issue reported on code.google.com by mrdomino on 6 Apr 2010 at 9:08

Single quotes before punctuation aren't properly prettified.

This issue was created by revision f73a0172e3.

The new quote matcher doesn't handle open quotes at the start of a line
properly, or close quotes before punctuation.

Original issue reported on code.google.com by mrdomino on 6 Apr 2010 at 9:46

bookmarklet-3 doesn't work in Firefox

The most recent version of the bookmarklet is broken in Firefox. The 
compiled code tries to redefine window (locally!), which Firefox thinks is a 
constant.

Original issue reported on code.google.com by mrdomino on 25 Mar 2010 at 3:00

Create jsprettify bookmarklet

This needs a bookmarklet to be useful in the broad sense. I'm thinking the 
most useful case is to prettify the contents of all textareas (and/or text 
inputs) on the page; that way things like status messages, blog posts, and 
tweets can be prettified with one click.

Original issue reported on code.google.com by mrdomino on 24 Feb 2010 at 4:24

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.