Commit graph

608 commits

Author SHA1 Message Date
Subramanya Sastry 30aaf6574c DOMFragments: Use sealFragment instead of unwrapFragment
* unwrapFragment had a somewhat unusual behavior which could be
  a source of bugs while reasoning with it.

  If undefined, it's default value is true which is contrary
  to how we think of undefined.

* Flipping the polarity of the flag to sealFragment makes the
  semantics easier to reason with and where !empty(..) applies
  more naturally to it.

Change-Id: Ia50cba345f37e815e5f5f95abb452c8eefcf9011
2019-06-13 13:38:20 -05:00
C. Scott Ananian 320d045ee8 Update automatically-generated PHP files w/ latest js2php
Mostly comment formatting improvements, some significant code changes
to the JS side.

Change-Id: I7a8f2105173df74dc09f2024d68268f5dc6fa632
2019-06-05 17:13:34 -04:00
Arlo Breault 05cb13ddf9 Make extensions with post-processors return constructors
This allows us to finish the cleanup started in 0b3bb10 and inline
setupProcessors.

Change-Id: Ia7840091607e9a75153031b5db7600d5a0018da6
2019-04-03 18:44:21 +00:00
Arlo Breault 20c627e3f4 Convert cite extension to es6 class structure
Also, runs js2php on these files.

Change-Id: Id8ee13ad536d75f63e0045a21fdfdb667a0df65d
2019-04-03 12:20:41 -04:00
C. Scott Ananian eb70a83eb0 Audit uses of Node#getAttribute() + add missing file to PHP codebase
In PHP, DOMNode#getAttribute() return '' if the attribute is not present,
not null.  Audit our uses and try to either explicitly use `|| ''` (which
will ensure that PHP behaves the same was as JS) or use `hasAttribute`
to explicitly test for the presence of the attribute.

Changes have also been ported to PHP from JS.
Also added src/Wt2Html/PP/Processors/AddMediaInfo.php which was missing.

Change-Id: Ie1ae1df88e4fca70daf97b6f720f28014ebc99ed
2019-03-15 15:48:20 +00:00
C. Scott Ananian 25385a06e8 Apply recent JS changes to automatically-generated PHP port
This applies the JS changes from the following recently-merged patches:

6679c3bf Protect data-object-id attribute
d4e76d5b Fix new linter category to enable code work with templates
e567db8d Tweak storeDataAttribs to suppress DOM nodes in data-parsoid.tmp
16603953 Fix setting dsr on body for genTest
3a84a9dd Fix stashing data attributes for mw:StartTag
22c4a19a Remove redundant dataParsoid call
ed7b0ba0 Fix crasher in newly added linter category
505a357b Linter.js: Add new function to detect the use of links in links
8885b20e Move redlink updating into lib/parse.js
ccfce23d templatedepth is either an int or false
6d1571bd Move language conversion work into lib/parse.js
5a89c7de Avoid serialize/parse of data attributes when treebuilding
021d9958 Rename `document.env` to `document.bag`
c03ba494 Use XMLSerializer on both PHP & JS side in the DOM pass test script
e0c3cca9 Use env.createDocument in lib/api/apiUtils.js
550d3d71 Use a bag-on-the-side implementation for node data
f8de8b25 Add bin/inspectTokenizer.js
db704eea Add ability to splice a PHP transformer into the pipeline
a8be3ad6 Fix crasher in cite extension from accessing data after it's stored
2874f200 Simplify and clean up stops usage
6368265d Add some strategic isElt guards
5ae9553f DRY out transform test runners + tweak genTest to enable that
b0f2adc6 Assert that the .dataobject isn't touched after storing attrs on a node
1ce6a98d Skip separators when looking for the next th/td

Change-Id: I6a66ecb061e7ee7ed53feba1895dd315d9324715
2019-03-05 17:33:32 -05:00
C. Scott Ananian f2948cd170 Skeleton PHP files generated by automatic conversion from JS
Change-Id: I93dbbdb474d37f88e0bab1d810b3dd51304055fd
2019-02-13 12:34:44 -05:00
Subramanya Sastry bf21cf0ce9 Init src/ with .js files copied over with .php extensions
* This initialization lets us do a git log --follow and follow
  git history for that file across the js -> php port boundary.
  This works because git uses content hashes for objects and
  the copied code in the new .php file will have the same content
  hash as the .js file.

* The following directories were skipped
  - ./lib/config/baseconfig
  - ./tests

* The following JS files were skipped
  - ./lib/utils/promise.js
  - ./lib/config/wmf.sitematrix.json

  - ./tools/sync-baseconfig.js
  - ./tools/sync-parserTests.js
  - ./tools/fetch_ve_nowiki_edits.js
  - ./tools/fetch-parserTests.txt.js
  - ./tools/fetch-wmf-sitematrix.js
  - ./tools/compare.linter.results.js
  - ./tools/fetch-revision-data.js
  - ./tools/fetch-wt.js
  - ./tools/regression-testing.js
  - ./tools/build-langconv-fst.js

  - ./bin/server.js

Change-Id: I0b22057c23b72795aebbd66e3abcb627c6858ef3
2019-01-09 11:59:29 -06:00