README.txt (4375B)
1 If this is your first time building the HTML5 parser, you need to execute the 2 following commands (from this directory) to bootstrap the translation: 3 4 make sync # fetch remote source files and licenses 5 make translate # perform the Java-to-C++ translation from the remote 6 # sources 7 make named_characters # Generate tables for named character tokenization 8 9 If you make changes to the translator or the javaparser, you can rebuild by 10 retyping 'make' in this directory. If you make changes to the HTML5 Java 11 implementation, you can retranslate the Java sources from the htmlparser 12 repository by retyping 'make translate' in this directory. 13 14 The makefile supports the following targets: 15 16 sync_htmlparser: 17 Retrieves the HTML parser and Java to C++ translator sources from GitHub. 18 sync_javaparser: 19 Retrieves the javaparser sources from GitHub. 20 sync: 21 Runs both sync_javaparser and sync_htmlparser. 22 javaparser: 23 Builds the javaparser library retrieved earlier by sync_javaparser. 24 translator: 25 Runs the javaparser target and then builds the Java to C++ translator from 26 sources retrieved earlier by sync_htmlparser. 27 libs: 28 The default target. Alias for translator 29 translate: 30 Runs the translator target and then translates the HTML parser sources 31 retrieved by sync_htmlparser copying the Java sources to ../javasrc. 32 translate_from_snapshot: 33 Runs the translator target and then translates the HTML parser sources 34 stored in ../javasrc. 35 named_characters: 36 Generates data tables for named character tokenization. 37 38 ## How to add an attribute 39 40 # starting from the root of a mozilla-central checkout 41 cd parser/html/java/ 42 make sync 43 # now you have a clone of https://github.com/validator/htmlparser/tree/master in parser/html/java/htmlparser/ 44 cd htmlparser/src/ 45 # Open the nu/validator/htmlparser/impl/AttributeName.java file and start editing it 46 $EDITOR nu/validator/htmlparser/impl/AttributeName.java 47 # Perform case-insensitive searches for "uncomment" and uncomment stuff according to the comments that talk about uncommenting 48 # Duplicate the declaration a normal attribute (nothings special in SVG mode, etc.). Let's use "alt", since it's the first one. 49 # In the duplicate, replace ALT with the new name in all caps and "alt" with the new name in quotes in lower case. 50 # Search for "ALT,", duplicate that line and change the duplicate to say the new name in all caps followed by comma. 51 # Save. 52 javac nu/validator/htmlparser/impl/AttributeName.java 53 java nu.validator.htmlparser.impl.AttributeName 54 # Copy and paste the output into nu/validator/htmlparser/impl/AttributeName.java replacing the text below the comment "START GENERATED CODE" and above the very last "}". 55 # Recomment the bits that you uncommented earlier. 56 # Save. 57 cd ../.. # Back to parser/html/java/ 58 make translate 59 cd ../../.. 60 ./mach clang-format 61 62 ## How to add an element 63 64 # First, add an entry to parser/htmlparser/nsHTMLTagList.h or dom/svg/SVGTagList.h! 65 # Then, starting from the root of a mozilla-central checkout 66 cd parser/html/java/ 67 make sync 68 # now you have a clone of https://github.com/validator/htmlparser/tree/master in parser/html/java/htmlparser/ 69 cd htmlparser/src/ 70 # Open the nu/validator/htmlparser/impl/ElementName.java file and start editing it 71 $EDITOR nu/validator/htmlparser/impl/ElementName.java 72 # Perform case-insensitive searches for "uncomment and uncomment stuff according to the comments that talk about uncommenting 73 # Duplicate the declaration a normal element. Let's use "bdo", since it's the first normal one. 74 # In the duplicate, replace BDO with the new name in all caps and "bdo" with the new name in quotes in lower case (twice). 75 # Search for "BDO,", duplicate that line and change the duplicate to say the new name in all caps followed by comma. 76 # Save. 77 javac nu/validator/htmlparser/impl/ElementName.java 78 java nu.validator.htmlparser.impl.ElementName ../../../../../parser/htmlparser/nsHTMLTagList.h ../../../../../dom/svg/SVGTagList.h 79 # Copy and paste the output into nu/validator/htmlparser/impl/ElementName.java replacing the text below the comment "START GENERATED CODE" and above the very last "}". 80 # Recomment the bits that you uncommented earlier. 81 # Save. 82 cd ../.. # Back to parser/html/java/ 83 make translate 84 cd ../../.. 85 ./mach clang-format 86 87 Ben Newman (23 September 2009) 88 Henri Sivonen (10 August 2017, 10 February 2020)