★ wanayoo — archive 1999 https://github.com/livecode/livecode/pull/6329Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug 20897] Ensure htmlText with listStyle=skip roundtrips #6329

Open
wants to merge 4 commits into
base: develop-9.0
from

Conversation

@livecodepanos
Copy link
Contributor

@livecodepanos livecodepanos commented Feb 15, 2018

No description provided.

@livecodepanos livecodepanos added the bug label Feb 15, 2018
@livecodepanos livecodepanos added this to the 8.1.10-rc-1 milestone Feb 15, 2018
set the text of field "TestField" to "one" & CR & "two" & CR & "three"
set the listStyle of line 1 of field "TestField" to "skip"
set the listStyle of line 2 of field "TestField" to "disc"
TestAssert "htmlText roundtrips listStyle beginning with skip", the htmlText of field "TestField" is the htmlText of field "TestField"

This comment has been minimized.

@montegoulding

montegoulding Mar 4, 2018
Member

@livecodepanos I'm not sure I get this test. Isn't the htmlText of the field always going to equal the htmlText of the field?

This comment has been minimized.

@livecodepanos

livecodepanos Mar 5, 2018
Author Contributor

Lol, you are right, this was definitely not what I meant to write!

@@ -545,6 +551,10 @@ static void export_html_begin_lists(export_html_t& ctxt, uint32_t p_new_style, u
else
/* UNCHECKED */ MCStringAppendFormat(ctxt.m_text, "<li value=\"%d\">", p_index);
}

// listStyle = "skip" does need a <li> tag as well
if (p_new_style == kMCParagraphListStyleSkip)

This comment has been minimized.

@montegoulding

montegoulding Mar 4, 2018
Member

@livecodepanos is there a reason not to just drop the p_new_style != kMCParagraphListStyleSkip above?

This comment has been minimized.

@livecodepanos

livecodepanos Mar 6, 2018
Author Contributor

@montegoulding just dropping p_new_style != kMCParagraphListStyleSkip causes data loss in this use-case:

put "one" & cr & "two" & cr & "three" into field 1
set the listStyle of line 1 of field 1 to "skip"
set the listStyle of line 2 of field 1 to "disc"
set the htmltext of field 1 to the htmltext

as in the first pass ctxt . list_depth equals p_new_depth thus the code in the if block will not be executed, but we do need a <li> tag in this case anyway I think

This comment has been minimized.

@montegoulding

montegoulding Mar 6, 2018
Member

hmm... isn't that a general style of list changing but depth remaining the same issue? So style changes we should end the previous list and start a new list?

while(p_new_depth < ctxt . list_depth)
{
ctxt . list_depth -= 1;
MCStringAppendFormat(ctxt.m_text, ctxt.list_styles[ctxt.list_depth] < kMCParagraphListStyleNumeric ? "</ul>" : "</ol>");
// listStyle = "skip" is unordered, thus needs </ul> tag
MCStringAppendFormat(ctxt.m_text, (ctxt.list_styles[ctxt.list_depth] < kMCParagraphListStyleNumeric || ctxt.list_styles[ctxt.list_depth] == kMCParagraphListStyleSkip) ? "</ul>" : "</ol>");

This comment has been minimized.

@montegoulding

montegoulding Mar 4, 2018
Member

@livecodepanos these are now really long so perhaps a good opportunity to refactor out the ternary operator?

@livecodepanos livecodepanos added the WIP label Mar 5, 2018
@livecodepanos livecodepanos removed the WIP label Mar 6, 2018
@livecodeali livecodeali changed the base branch from develop-8.1 to develop-9.0 Apr 17, 2018
@livecodeali livecodeali modified the milestones: 8.1.10-rc-1, 9.0.1-rc-1 Apr 17, 2018
@livecodepanos livecodepanos added the WIP label May 9, 2018
@livecodepanos livecodepanos removed this from the 9.0.1-rc-1 milestone Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.