mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
DocBook/HTML: use XML entities for spaces.
This part should have been committed with bc73a857
in the first place.
This commit is contained in:
parent
90dab5d1e9
commit
21d1d917ba
@ -774,44 +774,36 @@ int InsetSpace::plaintext(odocstringstream & os,
|
||||
}
|
||||
|
||||
|
||||
void InsetSpace::docbook(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
switch (params_.kind) {
|
||||
namespace {
|
||||
std::string spaceToXMLEntity(InsetSpaceParams::Kind kind) {
|
||||
switch (kind) {
|
||||
case InsetSpaceParams::NORMAL:
|
||||
xs << XMLStream::ESCAPE_NONE << " ";
|
||||
break;
|
||||
return " ";
|
||||
case InsetSpaceParams::QUAD:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML:  
|
||||
break;
|
||||
return " "; // HTML:  
|
||||
case InsetSpaceParams::QQUAD:
|
||||
xs << XMLStream::ESCAPE_NONE << "  "; // HTML:   
|
||||
break;
|
||||
return "  "; // HTML:   
|
||||
case InsetSpaceParams::ENSKIP:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML:  
|
||||
break;
|
||||
case InsetSpaceParams::PROTECTED:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML:
|
||||
break;
|
||||
return " "; // HTML:  
|
||||
case InsetSpaceParams::VISIBLE:
|
||||
xs << XMLStream::ESCAPE_NONE << "␣";
|
||||
break;
|
||||
return "␣";
|
||||
case InsetSpaceParams::ENSPACE: // HTML: ⁠ ⁠ (word joiners)
|
||||
xs << XMLStream::ESCAPE_NONE << "⁠ ⁠";
|
||||
break;
|
||||
return "⁠ ⁠";
|
||||
case InsetSpaceParams::THIN:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML: &thinspace;
|
||||
break;
|
||||
return " "; // HTML: &thinspace;
|
||||
case InsetSpaceParams::MEDIUM:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML:  
|
||||
break;
|
||||
return " "; // HTML:  
|
||||
case InsetSpaceParams::THICK:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML:  
|
||||
break;
|
||||
return " "; // HTML:  
|
||||
case InsetSpaceParams::PROTECTED:
|
||||
case InsetSpaceParams::NEGTHIN:
|
||||
case InsetSpaceParams::NEGMEDIUM:
|
||||
case InsetSpaceParams::NEGTHICK:
|
||||
xs << XMLStream::ESCAPE_NONE << " "; // HTML:
|
||||
break;
|
||||
return " "; // HTML:
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||
// FIXME XHTML/DocBook
|
||||
// Probably we could do some sort of blank span?
|
||||
return " ";
|
||||
case InsetSpaceParams::HFILL:
|
||||
case InsetSpaceParams::HFILL_PROTECTED:
|
||||
case InsetSpaceParams::DOTFILL:
|
||||
@ -821,74 +813,24 @@ void InsetSpace::docbook(XMLStream & xs, OutputParams const &) const
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||
xs << '\n';
|
||||
break;
|
||||
// FIXME XHTML/DocBook
|
||||
// Can we do anything with those?
|
||||
return "\n";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetSpace::docbook(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(spaceToXMLEntity(params_.kind));
|
||||
}
|
||||
|
||||
|
||||
docstring InsetSpace::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
string output;
|
||||
switch (params_.kind) {
|
||||
case InsetSpaceParams::NORMAL:
|
||||
output = " ";
|
||||
break;
|
||||
case InsetSpaceParams::ENSKIP:
|
||||
output =" ";
|
||||
break;
|
||||
case InsetSpaceParams::ENSPACE:
|
||||
output ="⁠ ⁠";
|
||||
break;
|
||||
case InsetSpaceParams::QQUAD:
|
||||
output ="  ";
|
||||
break;
|
||||
case InsetSpaceParams::THICK:
|
||||
output =" ";
|
||||
break;
|
||||
case InsetSpaceParams::QUAD:
|
||||
output =" ";
|
||||
break;
|
||||
case InsetSpaceParams::MEDIUM:
|
||||
output =" ";
|
||||
break;
|
||||
case InsetSpaceParams::THIN:
|
||||
output =" ";
|
||||
break;
|
||||
case InsetSpaceParams::PROTECTED:
|
||||
case InsetSpaceParams::NEGTHIN:
|
||||
case InsetSpaceParams::NEGMEDIUM:
|
||||
case InsetSpaceParams::NEGTHICK:
|
||||
output =" ";
|
||||
break;
|
||||
// no XML entity, only Unicode code for space character exists
|
||||
case InsetSpaceParams::VISIBLE:
|
||||
output ="␣";
|
||||
break;
|
||||
case InsetSpaceParams::HFILL:
|
||||
case InsetSpaceParams::HFILL_PROTECTED:
|
||||
case InsetSpaceParams::DOTFILL:
|
||||
case InsetSpaceParams::HRULEFILL:
|
||||
case InsetSpaceParams::LEFTARROWFILL:
|
||||
case InsetSpaceParams::RIGHTARROWFILL:
|
||||
case InsetSpaceParams::UPBRACEFILL:
|
||||
case InsetSpaceParams::DOWNBRACEFILL:
|
||||
// FIXME XHTML
|
||||
// Can we do anything with those in HTML?
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM:
|
||||
// FIXME XHTML
|
||||
// Probably we could do some sort of blank span?
|
||||
break;
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||
// FIXME XHTML
|
||||
// Probably we could do some sort of blank span?
|
||||
output =" ";
|
||||
break;
|
||||
}
|
||||
// don't escape the entities!
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(output);
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(spaceToXMLEntity(params_.kind));
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user