r92773 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92772‎ | r92773 | r92774 >
Date:19:03, 21 July 2011
Author:inez
Status:deferred
Tags:
Comment:
Change the way how Document and Blocks are initialized. Implement many static class constructors.
Modified paths:
  • /trunk/parsers/wikidom/demos/es/index.html (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/demos/es/index.html
@@ -65,46 +65,52 @@
6666 <!-- Demo -->
6767 <script>
6868 $(document).ready( function() {
69 - var doc = new es.Document([
70 - new es.ParagraphBlock([
71 - {
72 - 'text': "In text display, line wrap is the feature of continuing on a new line when a line is full, such that each line fits in the viewable window, allowing text to be read from top to bottom without any horizontal scrolling.",
73 - 'annotations': [
74 - // "In text display" should be bold
75 - { 'type': 'bold', 'range': { 'start': 0, 'end': 15 } },
76 - // "line wrap" should be italic
77 - { 'type': 'italic', 'range': { 'start': 17, 'end': 26 } },
78 - // "wrap is" should be a link to "#"
79 - {
80 - 'type': 'link',
81 - 'data': { 'href': './' },
82 - 'range': { 'start': 22, 'end': 29 }
83 - },
84 - ]
85 - },
86 - { 'text': "Word wrap is the additional feature of most text editors, word processors, and web browsers, of breaking lines between and not within words, except when a single word is longer than a line." },
87 - {
88 - 'text': "It is usually done on the fly when viewing or printing a document, so no line break code is manually entered, or stored. If the user changes the margins, the editor will either automatically reposition the line breaks to ensure that all the text will \"flow\" within the margins and remain visible, or provide the typist some convenient way to reposition the line breaks.",
89 - 'annotations': [
90 - // "[citation needed]" should be super
91 - {
92 - 'type': 'template',
93 - 'data': {
94 - 'html': '<sup><small><a href="#">[citation needed]</a></small></sup>'
 69+ var doc = es.Document.newFromWikidom([
 70+ {
 71+ "type": "paragraph",
 72+ "lines": [
 73+ {
 74+ 'text': "In text display, line wrap is the feature of continuing on a new line when a line is full, such that each line fits in the viewable window, allowing text to be read from top to bottom without any horizontal scrolling.",
 75+ 'annotations': [
 76+ // "In text display" should be bold
 77+ { 'type': 'bold', 'range': { 'start': 0, 'end': 15 } },
 78+ // "line wrap" should be italic
 79+ { 'type': 'italic', 'range': { 'start': 17, 'end': 26 } },
 80+ // "wrap is" should be a link to "#"
 81+ {
 82+ 'type': 'link',
 83+ 'data': { 'href': './' },
 84+ 'range': { 'start': 22, 'end': 29 }
9585 },
96 - 'range': { 'start': 120, 'end': 121 }
97 - }
98 - ]
99 - },
100 - { 'text': "A soft return is the break resulting from line wrap or word wrap, whereas a hard return is an intentional break, creating a new paragraph." },
101 - ]),
102 - new es.ParagraphBlock([
103 - { 'text': "The soft returns are usually placed after the ends of complete words, or after the punctuation that follows complete words. However, word wrap may also occur following a hyphen." },
104 - { 'text': "Word wrap following hyphens is sometimes not desired, and can be avoided by using a so-called non-breaking hyphen instead of a regular hyphen. On the other hand, when using word processors, invisible hyphens, called soft hyphens, can also be inserted inside words so that word wrap can occur following the soft hyphens." },
105 - { 'text': "Sometimes, word wrap is not desirable between words. In such cases, word wrap can usually be avoided by using a hard space or non-breaking space between the words, instead of regular spaces." },
106 - { 'text': "OccasionallyThereAreWordsThatAreSoLongTheyExceedTheWidthOfTheLineAndEndUpWrappingBetweenMultipleLines." },
107 - { 'text': "Text might have\ttabs\tin it too. Not all text will end in a line breaking character" }
108 - ])
 86+ ]
 87+ },
 88+ { 'text': "Word wrap is the additional feature of most text editors, word processors, and web browsers, of breaking lines between and not within words, except when a single word is longer than a line." },
 89+ {
 90+ 'text': "It is usually done on the fly when viewing or printing a document, so no line break code is manually entered, or stored. If the user changes the margins, the editor will either automatically reposition the line breaks to ensure that all the text will \"flow\" within the margins and remain visible, or provide the typist some convenient way to reposition the line breaks.",
 91+ 'annotations': [
 92+ // "[citation needed]" should be super
 93+ {
 94+ 'type': 'template',
 95+ 'data': {
 96+ 'html': '<sup><small><a href="#">[citation needed]</a></small></sup>'
 97+ },
 98+ 'range': { 'start': 120, 'end': 121 }
 99+ }
 100+ ]
 101+ },
 102+ { 'text': "A soft return is the break resulting from line wrap or word wrap, whereas a hard return is an intentional break, creating a new paragraph." },
 103+ ]
 104+ },
 105+ {
 106+ "type": "paragraph",
 107+ "lines": [
 108+ { 'text': "The soft returns are usually placed after the ends of complete words, or after the punctuation that follows complete words. However, word wrap may also occur following a hyphen." },
 109+ { 'text': "Word wrap following hyphens is sometimes not desired, and can be avoided by using a so-called non-breaking hyphen instead of a regular hyphen. On the other hand, when using word processors, invisible hyphens, called soft hyphens, can also be inserted inside words so that word wrap can occur following the soft hyphens." },
 110+ { 'text': "Sometimes, word wrap is not desirable between words. In such cases, word wrap can usually be avoided by using a hard space or non-breaking space between the words, instead of regular spaces." },
 111+ { 'text': "OccasionallyThereAreWordsThatAreSoLongTheyExceedTheWidthOfTheLineAndEndUpWrappingBetweenMultipleLines." },
 112+ { 'text': "Text might have\ttabs\tin it too. Not all text will end in a line breaking character" }
 113+ ]
 114+ }
109115 ]);
110116 var surface = new es.Surface( $('#es-editor'), doc );
111117

Status & tagging log