Commit graph

867 commits

Author SHA1 Message Date
Gabriel Wicke af03eb4f29 Improve generic attribute expansion before external link processing, and make
wgUploadPath configurable. Also change the hard-coded fall-back image sizes to
sensible defaults. This breaks three parser tests until image size retrieval
from the wiki is implemented.
2012-03-06 18:02:35 +00:00
Gabriel Wicke 227103e12c Accept empty table cell attribute sections, and consider percent-encoded %2525
valid. 270 tests passing.
2012-03-06 14:32:45 +00:00
Gabriel Wicke 2efcd3cd57 Reworked percent encoding handling for URIs to get closer to the 'url
construction' part of the HTML5 spec:
http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#url-manipulation-and-creation

Removed a few whitelisted test cases that are now passing directly.

The encoding canonicalization could also be moved to the Sanitizer. Doing this
early in token stream processing however has the advantage of providing further
transformations uniform data to work with. We could even consider to move this
even further into the tokenizer.
2012-03-06 13:49:37 +00:00
Rob Moen 809df81282 enable CE demo toolbar, added annnotation and renderDomNode methods 2012-03-05 22:08:35 +00:00
Gabriel Wicke 19fe9726a2 Fix invalid external link representation. 268 tests passing. 2012-03-05 18:06:29 +00:00
Rob Moen da5a148f9c prevent insert for stand alone command key. 2012-03-05 17:57:54 +00:00
Gabriel Wicke a9ebc1d986 Support external images wrapped in a clickable link using bracketed external
link syntax. 265 tests passing.
2012-03-05 16:23:00 +00:00
Gabriel Wicke 7f7202e89c A few improvements to external link and image handling. 264 tests passing. 2012-03-05 15:34:27 +00:00
Gabriel Wicke 7b0c807710 Change wikilink tokenization strategy to split on pipes. This makes it
possible to support template / template argument expansion in image options,
and causes little trouble for wikilinks. Non-image wikilinks with multiple
text pipes are quite rare in the dumps, and concatenating description tokens
with a plain '|' is quite easy. 261 parser tests passing.
2012-03-05 12:00:38 +00:00
Rob Moen 714f15cef7 minor changes: remove whitespace and add semicolons 2012-03-03 00:17:15 +00:00
Gabriel Wicke 3e6f1b6bea Use some options primitively. 2012-03-02 14:19:33 +00:00
Gabriel Wicke 167dbdb0fa Parse image options. 2012-03-02 13:36:37 +00:00
Inez Korczynski 01e84a558c Improvements to changes polling mechanism 2012-03-02 02:07:55 +00:00
Inez Korczynski 90cfb62cb6 Added basic support for enter key 2012-03-02 01:35:34 +00:00
christian 923e9380cd event binding cleanup 2012-03-02 01:12:18 +00:00
christian 3a1ee7e5b9 adding paste fixes to cut handler 2012-03-02 00:37:01 +00:00
Inez Korczynski b16a1c3899 Fix bug in Chrome when moving cursor with left/right arrow in between <table> and textnode 2012-03-02 00:34:31 +00:00
christian 5ec5fb77e6 better cut-copy-paste support 2012-03-02 00:27:04 +00:00
Inez Korczynski 7de9e98583 Fix couple of poll interval bugs in Surface and add new parameter called 'byref' to method getAnnotationsFromOffset which makes it return array references instead of copy of arrays. 2012-03-02 00:10:08 +00:00
christian 3f1ed0be6d adding cut-copy-paste 2012-03-01 22:27:23 +00:00
Inez Korczynski 8120b0b624 Cleanup for JSLint 2012-03-01 22:14:14 +00:00
Inez Korczynski 45cd5a11d0 Explicitly pass parameter global=true to getOffset method 2012-03-01 20:52:22 +00:00
Inez Korczynski 5dc284efaf Added getSelection method to Surface 2012-03-01 20:49:21 +00:00
Gabriel Wicke 8b7ba9051b Add productions for image option tokenization, and prepare to call those from
the LinkHandler token stream transformer.
2012-03-01 18:07:20 +00:00
Gabriel Wicke b1a7119a46 Hack up some rudimentary image rendering. Using jshashes for the md5, and
a few hard-coded image image sizes ;) 262 tests passing.
2012-03-01 13:51:53 +00:00
Gabriel Wicke d4faf9eaf4 More work on wiki link rendering and general wiki title / namespace
functionality.
2012-03-01 12:47:05 +00:00
Inez Korczynski 3bb7f81714 Migreate text input method from playground to ce and ce demo 2012-03-01 01:28:39 +00:00
Sam Reed fc49422e1d More image compression of extensions with WMF interest 2012-02-29 22:02:03 +00:00
Gabriel Wicke 4b9bd45b82 Start to move wikilink expansion to a separate async token transformer. 2012-02-29 13:56:29 +00:00
christian 13fe37193a re-enabling native browser spellcheck 2012-02-28 23:43:38 +00:00
Gabriel Wicke b8bb503199 Actually commit onlyinclude, as already announced in r112592. 2012-02-28 13:24:35 +00:00
Rob Moen f6f05241c7 fixed my typo follow up r112555 2012-02-28 01:37:38 +00:00
Rob Moen 78eedb8c74 cleanup previous commit. follow up r112552 2012-02-28 00:46:23 +00:00
Rob Moen 37ffc61c19 prototype RTL text mode cursor handling. Need to complete the unicode regular expression, and make helper methods for RTL boundary 2012-02-28 00:35:17 +00:00
christian 7053e0517c prevent dragging and dropping text - can be removed later if operation supported via model 2012-02-27 21:56:56 +00:00
Rob Moen 0575db24f7 added a left positioning to input to properly position ime context menu 2012-02-27 19:44:02 +00:00
Rob Moen ed35395ba2 fix typo which prevented readInterval from stopping onBlur 2012-02-24 17:41:22 +00:00
Rob Moen dab0396b54 minor fixes: removed whitespace, added semicolon 2012-02-24 00:49:28 +00:00
Rob Moen 8cf2fe9f33 follow up to r112276, fixed bug which prevented word selection 2012-02-24 00:32:44 +00:00
Trevor Parscal 7baae71363 very minor fixes 2012-02-24 00:05:29 +00:00
Rob Moen 26ab5f7408 Fixed bug when moving cursor with click. Calling showCursor after input regains focus prevents browser from freakishly scrolling 2012-02-24 00:04:21 +00:00
Rob Moen 297d41bb63 Rework general input to no longer clear during IME. Polling interval for non keyDown text comparison. Chunked text insertion for all normal keys which makes nice transactions and clears input. 2012-02-23 23:20:47 +00:00
Trevor Parscal 7366a22046 Added support for respecting new lines in pre-formatted blocks - using Shift+Enter will show this in action! 2012-02-23 01:18:01 +00:00
Trevor Parscal 696f5cb2a0 Replaced "set" and "clear" method for attribute transactions with "replace" method, which allows correct reversion. Also fixed list item tools to correctly use the new function signature. 2012-02-22 21:23:28 +00:00
Gabriel Wicke 3227903d48 Follow-up to r112116, accidentally committed from subdirectory. 2012-02-22 16:41:01 +00:00
Gabriel Wicke 3568dfee14 Add some support for functionhooks in test parser and parserTests.js, and
tweak a few parser functions.
2012-02-22 15:59:11 +00:00
Gabriel Wicke d7da324272 Basic fall-through support for #switch parser function 2012-02-22 14:57:50 +00:00
Gabriel Wicke 491ad5ffef Cleanup and commenting. 2012-02-22 13:13:18 +00:00
Gabriel Wicke 9b3313d923 Speed up flatten slightly by avoiding garbage for already flat arrays. Also,
use simple string concatenation instead of arrays as the strings tend to be
few and short.
2012-02-22 11:25:44 +00:00
Gabriel Wicke 8dde1f77b4 Reduce debug print overhead, roughly a 10% speed-up on parserTests. 2012-02-21 18:49:43 +00:00
Gabriel Wicke 058c4213a4 Remove some more unused code and tidy up some more. 2012-02-21 18:26:40 +00:00
Gabriel Wicke 416126c041 Fix the bug in the inline_breaks replacement, and write another switch-based
version, which is slightly faster and shorter. Performance is improved by
about 5% for parserTests.
2012-02-21 17:57:30 +00:00
Gabriel Wicke 18a04f7581 Tidy up and comment the tokenizer a bit more. Start to move code into
mediawiki.tokenizer.js module, and pass a reference to parse(). Faster
inline_breaks production using a JS function which seems to be generally
correct, but still breaks five tests when enabled. Seems to be some weird
interaction with peg.js, possibly something to do with caching.
2012-02-21 17:21:42 +00:00
Gabriel Wicke 8718bd65bc Add list of HTML5 and deprecated HTML3/4 elements in preparation for
end-of-potential-extension rules; Support indented tag-wrapped pre blocks.
2012-02-21 14:44:56 +00:00
Gabriel Wicke ffec77273a Comment and minor code tweaks. 2012-02-21 11:24:20 +00:00
au ea15bffb27 Revert "* Always sort attributes (+1 test pass)."
This reverts commit 45ca281da8eef8030bdd1986418cb914fc9a717c.
2012-02-20 22:26:12 +00:00
Gabriel Wicke 5806705733 Push transformer setup a bit further into the attribute pipeline. 2012-02-20 12:56:00 +00:00
Gabriel Wicke 8eddb4ec6b Add some comments to the Sanitizer 2012-02-20 11:14:53 +00:00
Gabriel Wicke 71e95bd54b Set up token stream transformers from a map of phases per input content type.
Not yet applied to attribute pipeline creation. 249 tests passing.
2012-02-20 11:07:21 +00:00
au 9c55f5e8b7 * Always sort attributes (+1 test pass).
The performance impact for .sort is quite small (12.079s => 12.158s)
  and Sanitizer is probably one of the more accessible places to do this.
2012-02-18 21:01:07 +00:00
au aa589d989b * Rudimentary CSS validation; +4 tests pass. (Bug 2304, 3244). 2012-02-18 20:16:23 +00:00
Gabriel Wicke 4d80b8daa8 Detail comments about next steps and divide parser functions in those that
need more information from the wiki and readily implementable items.
2012-02-17 10:23:14 +00:00
Gabriel Wicke 059ff94bc4 Reject match for invalid urlencoded code points. 2012-02-16 13:57:56 +00:00
christian 8b3bc2e439 turning off native spellcheck for now 2012-02-15 23:42:43 +00:00
Gabriel Wicke dc1d30fcb5 Tweaked template parameters a bit further, and made the self-closing tag
protection a bit less trigger-happy.
2012-02-15 15:56:11 +00:00
Gabriel Wicke 089413298c Protect self-closing tags in generic attribute production. 2012-02-15 13:23:50 +00:00
Gabriel Wicke 5e94a238fc Prepare for the support of tables (and later generally block-level elements)
in template parameters. 244 tests passing.
2012-02-15 11:51:29 +00:00
Gabriel Wicke 774a3189c8 Improve support for generic attribute names coming from
templates/templateargs.
2012-02-15 10:19:39 +00:00
Gabriel Wicke 1ce6f5a3c4 Improve support for single-line attributes with preprocessor support. 243
tests passing.
2012-02-14 21:25:52 +00:00
Gabriel Wicke f02b3d91c6 Port urlencoded char support to preprocessor-supporting link target
production, and remove old link_target production.
2012-02-14 21:08:25 +00:00
Gabriel Wicke 001194b140 Replace console.log with console.warn in all debug statements 2012-02-14 20:56:14 +00:00
Trevor Parscal 5f033c9bfe Changed the way widths are calculated when rendering lines of text. Now we let the browser do it's normal layout thing, and use a set of floated divs to figure out the effective line width. Using this technique, we pretty much support floating content from a rendering perspective. Interaction is still a problem however. 2012-02-14 20:30:40 +00:00
Gabriel Wicke f42b379e52 Fix named wikilink options (image options really) in template arguments, and
speed up template parameter parsing by eliminating some backtracking. 238
tests passing (unchanged).
2012-02-14 15:45:18 +00:00
Gabriel Wicke 64f63b3714 request is automatically installed by jsdom. Follow-up to r111459. Thanks
Hashar!
2012-02-14 14:15:50 +00:00
Gabriel Wicke 466e8e54ad Tweak comment about request module 2012-02-14 14:01:13 +00:00
Inez Korczynski d5ad9a9ad4 New approach to text input and IME (part I) 2012-02-13 22:45:18 +00:00
christian 0e6fe86a05 Commenting out fake cursor for now, fixing paste binding 2012-02-13 19:51:39 +00:00
christian c532488b40 creating showFakeCursorAt method and cleaning up code 2012-02-13 19:48:05 +00:00
Inez Korczynski 3ee4da941d Render real <b> and <i> tags insteaf of <span>s 2012-02-13 19:38:31 +00:00
Gabriel Wicke 0b8d1b0387 * Add custom toString methods for tokens to aid debugging
* Convert all attributes into strings in Sanitizer
* Use strict comparison against empty string in tokenizer
* Add very simple sitename parserfunction
* 138 tests passing
2012-02-13 17:02:23 +00:00
Gabriel Wicke 9945175416 Reformat Date.replaceChars 2012-02-13 14:23:48 +00:00
Gabriel Wicke 0b40741e1c Strip trailing newlines from included templates 2012-02-13 14:17:03 +00:00
Gabriel Wicke 025f9cddb3 Prefix all internal data- attributes with data-mw- and adjust the whitelist
and test output normalization accordingly. 235 tests passing.
2012-02-13 13:54:07 +00:00
Gabriel Wicke b1617b1d71 Add some support for ideographic spaces in external links, support the
int: namespace alias and perform some normalization on the MediaWiki namespace
prefix.
2012-02-13 13:35:46 +00:00
Gabriel Wicke 55ddb4fd66 Remove WikiDom default serialization and --html argument from parse.js
wrapper. HTML ist now the only supported format. The DOMConverter is now no
longer used. Roan, feel free to remove / butcher it for direct HTML to linear
model conversion.
2012-02-11 17:59:17 +00:00
Gabriel Wicke a122e51eec Move data-* annotations into separate object on tokens, that is then
serialized into a single data-mw-rt attribute if present. Update parserTests
to ignore this attribute for comparisons with expected parser output.

A few more tweaks and notes are thrown into this commit too. 233 tests are
passing now.
2012-02-11 16:43:25 +00:00
Inez Korczynski 0ce3c67872 Working prototype of insertion of the text with annotations 2012-02-11 01:04:14 +00:00
Inez Korczynski 001a432fa3 Get rid of console.logs 2012-02-10 22:27:17 +00:00
Inez Korczynski b3453dc71c Add new method: getDOMText 2012-02-10 22:19:12 +00:00
christian f0e60248fb fake cursor demo 2012-02-10 18:18:35 +00:00
Alexandre Emsenhuber bfa0a28968 svn:eol-style native 2012-02-10 16:57:02 +00:00
Inez Korczynski acd819b28b Fix showCursorAt method - missing "break;" 2012-02-10 05:39:28 +00:00
Gabriel Wicke aff30be131 Some comments and reshuffling in the grammar, and a typo in the
AttributeExpander.
2012-02-09 22:27:45 +00:00
christian ed7dc80db9 reorginization of event handlers 2012-02-09 22:11:33 +00:00
Brion Vibber d0abf39168 ve.js isn't the edit surface, that's es.js :) 2012-02-09 22:04:06 +00:00
Brion Vibber 9ffa60477e local variable 2012-02-09 21:56:48 +00:00
Brion Vibber 8eddf06713 bugzilla is on https only (though it will redirect) 2012-02-09 21:55:43 +00:00
Brion Vibber dd075b0f87 local variable 2012-02-09 21:48:20 +00:00
Gabriel Wicke 6e33255503 Improve support for preprocessor functionality in attributes; Support
multi-line xmlish tags with preprocessor stuff in attributes.
2012-02-09 16:36:29 +00:00
Gabriel Wicke 16ded7d955 Fix a bug in wikilink with trail tokenization. 2012-02-09 14:06:35 +00:00
Gabriel Wicke 6983481561 Move attribute expansion back to separate handler, as this makes it easier to
only expand used branches selected by parser functions. Template (and
-argument) expansion is simply registered before general expansion.

Additionally, a few more simple time-based magic words are added in
ParserFunctions.
2012-02-09 13:44:20 +00:00
christian ffad7ef3d8 removing beforepaste event for now. it was hyper 2012-02-09 08:41:36 +00:00
christian 6a23449ecb using transact 2012-02-09 07:39:43 +00:00
Inez Korczynski 3f843bb1a6 First implementation of IME for content editable 2012-02-09 00:51:59 +00:00
christian f84fc1cbf1 paste handler no longer causes fast viewport shift when pasting 2012-02-08 23:37:52 +00:00
christian 13921a0468 layout tweaks 2012-02-08 22:50:34 +00:00
christian e3e3150399 using execcommand to undo cut - model controls mutation 2012-02-08 18:06:03 +00:00
Gabriel Wicke 3f7c1499cd Enable support for general preprocessor functionality in attribute keys and
values. This includes comments, templates and template arguments.

This also replaces the specialized expansion logic in the TemplateHandler. The
removal of link validation lets one more parser test fail for now. External
link target validation will need to be implemented in the token stream handler
for links. This is noted as TODO in
https://www.mediawiki.org/wiki/Future/Parser_development#Token_stream_transforms.
2012-02-08 15:10:30 +00:00
christian cdbe9a7d13 fixing scroll after paste 2012-02-08 07:18:15 +00:00
christian df78da31ca removing offset override 2012-02-08 06:55:12 +00:00
christian 212d4d7559 adding overflow hidden to allow clicking on floated elements 2012-02-08 06:31:51 +00:00
christian 1dd6d8f2b5 working on getSelection and getOffset for triple click 2012-02-08 06:28:38 +00:00
christian 75bec9fba1 cut support 2012-02-08 02:12:21 +00:00
christian 2d058f7a4d copy and paste support 2012-02-08 00:47:51 +00:00
Inez Korczynski 746e603184 Implement: surfaceView.showCursorAt(int n) 2012-02-08 00:30:40 +00:00
Inez Korczynski beda113281 Delete scanBoundaries method from Content, as it does not make sense anymore for content editable approach 2012-02-08 00:26:18 +00:00
Inez Korczynski 2d531ed213 Get getSelection in contenteditable working 2012-02-08 00:02:08 +00:00
Inez Korczynski a046c0d2cf Cleanup Surface.js - only functionality that is needed for content editable 2012-02-07 22:59:30 +00:00
Inez Korczynski db0aea6965 Make paragraphs in content editable use real <p> tags 2012-02-07 22:22:49 +00:00
Inez Korczynski 0ced900973 Added missing CSS and PNG so ce demo does not complain anymore. 2012-02-07 22:03:39 +00:00
Inez Korczynski e0c10cdfff Cleanup ve.es.Content.js for ContentEditable and setup toolbar as empty (as there is no working functionality for now) 2012-02-07 22:02:11 +00:00
Alexandre Emsenhuber f162145298 svn:eol-style native 2012-02-07 19:13:19 +00:00
Gabriel Wicke 157c495a9e Normalize the title in localurl. 232 tests passing. 2012-02-07 12:26:00 +00:00
Gabriel Wicke b4892102a4 Clean up transform callback interface 2012-02-07 11:53:29 +00:00
Gabriel Wicke 1f6db903e9 Pluck a few low-hanging fruit in external link tokenization, and add a simple
localurl parser function implementation. 230 parser tests now passing.
2012-02-07 10:28:23 +00:00
Gabriel Wicke cf8b7bf45d External links don't nest. 2012-02-07 09:38:28 +00:00
christian 2a076da93a removing outline from contenteditable 2012-02-07 02:01:26 +00:00
christian be552732c0 tweaks to margins 2012-02-07 02:00:08 +00:00
Inez Korczynski 9173608afb Adapt ContentEditable code to new schema of directories and files 2012-02-07 01:43:49 +00:00
Trevor Parscal 8078b0f8a2 Fixed backspace - another issue related the r110805 (or as we are now calling it, "The Great Code Migration of 2012") 2012-02-07 01:11:32 +00:00
Trevor Parscal d172b220b7 Minor fixes (line length breaking, jshint nagging, etc) 2012-02-07 00:42:16 +00:00
Trevor Parscal fb09439ae6 Fixed image file links from sandbox.css to images supplied by es and ui packages 2012-02-06 23:55:58 +00:00
Trevor Parscal 6dcc39fe11 Migrated es.* to new ve.* namespace which is more structured, and will make it easier to keep data model, edit surface, user interface and content editable work separated cleanly 2012-02-06 23:50:56 +00:00
Gabriel Wicke 53bf4f2bd0 Temporarily disable the sanitizer and start to support preprocessor
functionality (comments, templates, template arguments) in arbitrary
attributes. The grammar for this is still quite rough, will need to
consolidate that area.
2012-02-06 19:15:44 +00:00
Gabriel Wicke c26243989e Improve toJSON handlers to include all properties 2012-02-06 19:12:29 +00:00
Gabriel Wicke 0bea9fdfbb Fix nowiki tokenization regression introduced r110495 2012-02-03 13:10:04 +00:00
Gabriel Wicke 26f2026cff Add custom JSON serializers for tokens that include a type attribute 2012-02-03 13:09:01 +00:00
Gabriel Wicke 8c75aa1a7a Remove type attribute for tag tokens. 2012-02-01 18:37:48 +00:00
Gabriel Wicke 689f697a93 Push token format conversion a bit further along, and add defines that were
missing in last commit.
2012-02-01 17:03:08 +00:00
Gabriel Wicke a5cc10a06b Change token format to plain strings for text tokens, and specific objects for
other tokens. This is only the first half of the conversion. The next step is
to drop the type attribute on most tokens and match on the constructor in the
token transform machinery.
2012-02-01 16:30:43 +00:00
Gabriel Wicke dd3707ded5 Remove some modules normally bundled with node.js from dependencies, and
remove some older ones that are only used in currently-dead code.
2012-02-01 10:32:33 +00:00
Gabriel Wicke e65c6502c0 Add source for #time implementation in comment 2012-02-01 10:14:01 +00:00
Roan Kattouw 935cae67c6 As promised, reorganize insert() so the order of cases makes more sense (from simple to complex) 2012-01-31 17:14:16 +00:00
Gabriel Wicke 14a8a13678 A few more debug helpers including a --trace mode for light debugging. Some
improvements to parser functions on the way to support the cite extensions.
Preparation for generic template and template arg in attribute support. 222
parser tests now passing.
2012-01-31 16:50:16 +00:00
Roan Kattouw 6832be68ed Fix test #30: was failing because getScope() was broken and insert() didn't account for the case of inserting something like </list><list> at a structural offset. All tests are now passing, yay!
* Fix getScope()
** Drop the -1 which caused the result to be off by one level
** Prevent JS errors from occurring if bad input causes the loop to try to traverse up above the root node
* insert()
** Detect the case where the input data tries to close the containing element; in that case, we'll get scope != node
** Move the getNodeFromOffset() and getScope() calls up and out of the conditionals
** Remove unnecessary parent==model conditional, no longer needed now that getScope() can safely handle things that try to traverse too far up
** Add some comments to explain what's going on. I'll restructure this function a bit more shortly
2012-01-31 16:43:21 +00:00
Neil Kandalgaonkar 2688f823ef added dependencies to README 2012-01-31 00:56:07 +00:00
Neil Kandalgaonkar f0b934ef2e first pass at an API method that returns wikidom. Shells out to node. Some issues with XML API result formatting but works fine in JSON 2012-01-31 00:02:48 +00:00
Gabriel Wicke 7cd94df47d A few minor tweaks to reduce memory usage 2012-01-27 13:32:44 +00:00
Trevor Parscal 94f7d79eb7 Skip traversal of leaf nodes if there aren't any children 2012-01-23 18:46:31 +00:00
Gabriel Wicke 4e6a54560a * Emit token chunks for top-level block elements by patching the source of the
tokenizer
* Fix a bug uncovered by this
* Increase the number of outstanding listeners on a single download to 10000
2012-01-22 23:21:53 +00:00