From: Łukasz Rekucki Date: Fri, 12 Mar 2010 12:52:36 +0000 (+0100) Subject: * Fixed infinite loop in HTMLSerializer. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/f8d11c06c7084e9016cad67d70307c62f1265e51?ds=sidebyside * Fixed infinite loop in HTMLSerializer. * Added styles for indented verses, notes and new annotation styles. --- diff --git a/platforma/static/css/html.css b/platforma/static/css/html.css index fc8988f5..e3d9a4a1 100644 --- a/platforma/static/css/html.css +++ b/platforma/static/css/html.css @@ -15,6 +15,7 @@ .htmlview * { position: relative; + overflow: visibl; } .htmlview div { @@ -136,6 +137,46 @@ margin: 1.5em 0 0 auto; } +/* wersy */ +.htmlview .strofa .wers_wciety, .htmlview .strofa .wers_wciety[data-wlf-typ='1'] { + margin-left: 1em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='2'] { + margin-left: 2em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='3'] { + margin-left: 3em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='4'] { + margin-left: 4em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='5'] { + margin-left: 5em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='6'] { + margin-left: 6em; +} + +/* błędne wersy */ +.htmlview *:not(.strofa) > *[x-verse]::after { + content: "Ten wers znajduje się poza strofą."; + display: inline; + background: red; + font-size: 8pt; + border: 1px solid black; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + padding: 1px 1em; + margin-left: 1em; + vertical-align: super; +} + + .htmlview .kwestia .strofa { margin: 0; } @@ -145,7 +186,7 @@ margin: 1.5em 0 0; } -.htmlview p.motto { +.htmlview .motto { text-align: justify; font-style: italic; margin: 1.5em 0 0; @@ -221,6 +262,36 @@ font-weight: bold; } +/* Uwaga/Extra */ + +.htmlview .uwaga { + background-color: #96e0e4; + border: 1px solid black; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + display: block; + font-size: 10pt; + line-height: 12pt; + padding: 2px 1em; + float: right; + max-width: 20%; + max-height: 24pt; + margin-left: 0.5em; + overflow: hidden; +} + +.utwor > .uwaga { + float: none; + padding: 0.5em 1em; + margin: 1em; + max-width: 100%; + max-height: 100%; +} + +.htmlview .uwaga:hover { + max-height: 100%; +} + /* Motywy */ /* ======================== */ @@ -284,7 +355,7 @@ } .htmlview .annotation:hover { - background-color: #dfdfdf; + background-color: #96e0e4; } *.htmlview *.annotation-inline-box { @@ -299,20 +370,25 @@ display: none; position: absolute; - max-width: 36em; + width: 300px; - font-size: 8pt; + font-size: 10pt; line-height: 12pt; font-weight: normal; font-style: normal; - background: white; - border-color: gray; - border-width: 2px; - border-style: outset; + background: #fffe93; + border-color: black; + border-width: 1px; + border-style: solid; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + padding: 3px 5px; text-decoration: none; + z-index: 1000; } @@ -459,15 +535,32 @@ /* background-color: ivory;*/ } -.out-of-flow-text { - border: 1px solid #BEBEBE; - background-color: #E2E2E1; - white-space: pre-line; - font-family: monospace; -} - -.out-of-flow-text[x-editable] { - background-color: #E2E2E1; +.htmlview .out-of-flow-text { + display: block; + font-face: monospace; + border: 2px solid red !important; + white-space: pre-line; +} + +.htmlview .out-of-flow-text::before { + content: "Tekst w tej ramce nie jest otagowany!"; + background-color: #ff6c6c; + color: black; + + font-size: 10pt; + line-height: 12pt; + border: 1px solid black; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + padding: 5px 1em; + margin: 0em; + margin-left: 1em; + + text-align: justify; + + display: inline; + float: right; + max-width: 25%; } .unknown-tag { diff --git a/platforma/static/js/main.js b/platforma/static/js/main.js index b98e1c20..270e3cc0 100644 --- a/platforma/static/js/main.js +++ b/platforma/static/js/main.js @@ -661,7 +661,7 @@ function html(element) { } if (editable.is('.annotation-inline-box')) { $('*[x-annotation-box]', editable) - .css({width: 300, position: 'absolute', left: event.clientX - editable.offset().left + 5, top: event.clientY - editable.offset().top + 5}) + .css({position: 'absolute', left: event.clientX - editable.offset().left + 5, top: event.clientY - editable.offset().top + 5}) .show(); } else { $('*[x-annotation-box]').hide(); diff --git a/platforma/static/js/xslt.js b/platforma/static/js/xslt.js index 6cc545a5..f5af909b 100644 --- a/platforma/static/js/xslt.js +++ b/platforma/static/js/xslt.js @@ -124,10 +124,10 @@ const PADDING = { lista_osoba: 1, "podpis": 1, - "wers": 1, - "wers_cd": 1, - "wers_akap": 1, - "wers_wciety": 1, + "wers": 0, + "wers_cd": 0, + "wers_akap": 0, + "wers_wciety": 0, "rdf:RDF": 3, "rdf:Description": 1, @@ -182,12 +182,11 @@ HTMLSerializer.prototype._pushTagEnd = function(tagName) { HTMLSerializer.prototype._verseBefore = function(node) { var prev = node.previousSibling; - while(prev) { - if(prev.nodeType == ELEMENT_NODE && prev.hasAttribute('x-verse')) - return true; - } - - return false; + while((prev !== null) && (prev.nodeType != ELEMENT_NODE)) { + prev = prev.previousSibling; + } + + return (prev !== null) && prev.hasAttribute('x-verse'); } HTMLSerializer.prototype.serialize = function(rootElement, stripOuter) diff --git a/platforma/static/xsl/wl2html_client.xsl b/platforma/static/xsl/wl2html_client.xsl index 2326d266..c65eabf1 100644 --- a/platforma/static/xsl/wl2html_client.xsl +++ b/platforma/static/xsl/wl2html_client.xsl @@ -559,12 +559,16 @@ -

- - - - -

+ +

+ + + + +

+
/ @@ -666,7 +670,9 @@ - + + + @@ -716,20 +722,31 @@ -
+ -
+
+ + + + + + + + -
+ -
+
@@ -757,9 +774,15 @@ - + + - + + + + + +