mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-14 12:25:11 +00:00
Move counters toward unicode.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15418 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4f3033ff91
commit
2b01ca42d8
@ -386,11 +386,10 @@ void setLabel(Buffer const & buf, ParIterator & it)
|
|||||||
if (layout->toclevel <= buf.params().secnumdepth
|
if (layout->toclevel <= buf.params().secnumdepth
|
||||||
&& (layout->latextype != LATEX_ENVIRONMENT
|
&& (layout->latextype != LATEX_ENVIRONMENT
|
||||||
|| isFirstInSequence(it.pit(), it.plist()))) {
|
|| isFirstInSequence(it.pit(), it.plist()))) {
|
||||||
counters.step(layout->counter);
|
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
docstring label =
|
counters.step(lyx::from_ascii(layout->counter));
|
||||||
lyx::from_ascii(expandLabel(buf, layout,
|
docstring label = expandLabel(buf, layout,
|
||||||
par.params().appendix()));
|
par.params().appendix());
|
||||||
par.params().labelString(label);
|
par.params().labelString(label);
|
||||||
}
|
}
|
||||||
} else if (layout->labeltype == LABEL_ITEMIZE) {
|
} else if (layout->labeltype == LABEL_ITEMIZE) {
|
||||||
@ -420,7 +419,7 @@ void setLabel(Buffer const & buf, ParIterator & it)
|
|||||||
// FIXME
|
// FIXME
|
||||||
// Yes I know this is a really, really! bad solution
|
// Yes I know this is a really, really! bad solution
|
||||||
// (Lgb)
|
// (Lgb)
|
||||||
string enumcounter = "enum";
|
docstring enumcounter = lyx::from_ascii("enum");
|
||||||
|
|
||||||
switch (par.itemdepth) {
|
switch (par.itemdepth) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -464,11 +463,10 @@ void setLabel(Buffer const & buf, ParIterator & it)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME UNICODE
|
par.params().labelString(counters.counterLabel(buf.B_(format)));
|
||||||
par.params().labelString(lyx::from_utf8(counters.counterLabel(lyx::to_utf8(buf.B_(format)))));
|
|
||||||
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
|
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
|
||||||
counters.step("bibitem");
|
counters.step(lyx::from_ascii("bibitem"));
|
||||||
int number = counters.value("bibitem");
|
int number = counters.value(lyx::from_ascii("bibitem"));
|
||||||
if (par.bibitem())
|
if (par.bibitem())
|
||||||
par.bibitem()->setCounter(number);
|
par.bibitem()->setCounter(number);
|
||||||
par.params().labelString(buf.B_(layout->labelstring()));
|
par.params().labelString(buf.B_(layout->labelstring()));
|
||||||
@ -490,8 +488,8 @@ void setLabel(Buffer const & buf, ParIterator & it)
|
|||||||
docstring s;
|
docstring s;
|
||||||
if (!type.empty()) {
|
if (!type.empty()) {
|
||||||
Floating const & fl = textclass.floats().getType(type);
|
Floating const & fl = textclass.floats().getType(type);
|
||||||
|
// FIXME UNICODE
|
||||||
counters.step(fl.type());
|
counters.step(lyx::from_ascii(fl.type()));
|
||||||
|
|
||||||
// Doesn't work... yet.
|
// Doesn't work... yet.
|
||||||
s = bformat(_("%1$s #:"), buf.B_(fl.name()));
|
s = bformat(_("%1$s #:"), buf.B_(fl.name()));
|
||||||
@ -591,24 +589,24 @@ void updateLabels(Buffer const & buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string expandLabel(Buffer const & buf,
|
docstring expandLabel(Buffer const & buf,
|
||||||
LyXLayout_ptr const & layout, bool appendix)
|
LyXLayout_ptr const & layout, bool appendix)
|
||||||
{
|
{
|
||||||
LyXTextClass const & tclass = buf.params().getLyXTextClass();
|
LyXTextClass const & tclass = buf.params().getLyXTextClass();
|
||||||
|
|
||||||
// FIXME UNICODE
|
docstring fmt = buf.B_(appendix ? layout->labelstring_appendix()
|
||||||
string fmt = lyx::to_utf8(buf.B_(appendix ? layout->labelstring_appendix()
|
: layout->labelstring());
|
||||||
: layout->labelstring()));
|
|
||||||
|
|
||||||
// handle 'inherited level parts' in 'fmt',
|
// handle 'inherited level parts' in 'fmt',
|
||||||
// i.e. the stuff between '@' in '@Section@.\arabic{subsection}'
|
// i.e. the stuff between '@' in '@Section@.\arabic{subsection}'
|
||||||
size_t const i = fmt.find('@', 0);
|
size_t const i = fmt.find('@', 0);
|
||||||
if (i != string::npos) {
|
if (i != docstring::npos) {
|
||||||
size_t const j = fmt.find('@', i + 1);
|
size_t const j = fmt.find('@', i + 1);
|
||||||
if (j != string::npos) {
|
if (j != docstring::npos) {
|
||||||
string parent(fmt, i + 1, j - i - 1);
|
docstring parent(fmt, i + 1, j - i - 1);
|
||||||
string label = expandLabel(buf, tclass[parent], appendix);
|
// FIXME UNICODE
|
||||||
fmt = string(fmt, 0, i) + label + string(fmt, j + 1, string::npos);
|
docstring label = expandLabel(buf, tclass[lyx::to_utf8(parent)], appendix);
|
||||||
|
fmt = docstring(fmt, 0, i) + label + docstring(fmt, j + 1, docstring::npos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#define BUFFER_FUNCS_H
|
#define BUFFER_FUNCS_H
|
||||||
|
|
||||||
#include "lyxlayout_ptr_fwd.h"
|
#include "lyxlayout_ptr_fwd.h"
|
||||||
|
#include "support/docstring.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -45,8 +46,9 @@ void bufferErrors(Buffer const &, TeXErrors const &, ErrorList &);
|
|||||||
int countWords(DocIterator const & from, DocIterator const & to);
|
int countWords(DocIterator const & from, DocIterator const & to);
|
||||||
|
|
||||||
/// Expand the counters for the labelstring of \c layout
|
/// Expand the counters for the labelstring of \c layout
|
||||||
std::string expandLabel(Buffer const & buf, LyXLayout_ptr const & layout,
|
lyx::docstring expandLabel(Buffer const & buf,
|
||||||
bool appendix);
|
LyXLayout_ptr const & layout,
|
||||||
|
bool appendix);
|
||||||
|
|
||||||
|
|
||||||
/// update labels at "iter".
|
/// update labels at "iter".
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using lyx::docstring;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::ostringstream;
|
using std::ostringstream;
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -63,45 +65,52 @@ void Counter::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string Counter::master() const
|
docstring Counter::master() const
|
||||||
{
|
{
|
||||||
return master_;
|
return master_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counter::setMaster(string const & m)
|
void Counter::setMaster(docstring const & m)
|
||||||
{
|
{
|
||||||
master_ = m;
|
master_ = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::newCounter(string const & newc)
|
void Counters::newCounter(docstring const & newc)
|
||||||
{
|
{
|
||||||
// First check if newc already exist
|
// First check if newc already exist
|
||||||
CounterList::iterator const cit = counterList.find(newc);
|
CounterList::iterator const cit = counterList.find(newc);
|
||||||
// if already exist give warning and return
|
// if already exist give warning and return
|
||||||
if (cit != counterList.end()) {
|
if (cit != counterList.end()) {
|
||||||
lyxerr << "New counter already exists: " << newc << endl;
|
lyxerr << "New counter already exists: "
|
||||||
|
<< lyx::to_utf8(newc)
|
||||||
|
<< endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
counterList[newc];
|
counterList[newc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::newCounter(string const & newc, string const & masterc)
|
void Counters::newCounter(docstring const & newc,
|
||||||
|
docstring const & masterc)
|
||||||
{
|
{
|
||||||
// First check if newc already exists
|
// First check if newc already exists
|
||||||
CounterList::iterator const cit = counterList.find(newc);
|
CounterList::iterator const cit = counterList.find(newc);
|
||||||
// if already existant give warning and return
|
// if already existant give warning and return
|
||||||
if (cit != counterList.end()) {
|
if (cit != counterList.end()) {
|
||||||
lyxerr << "New counter already exists: " << newc << endl;
|
lyxerr << "New counter already exists: "
|
||||||
|
<< lyx::to_utf8(newc)
|
||||||
|
<< endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// then check if masterc exists
|
// then check if masterc exists
|
||||||
CounterList::iterator const it = counterList.find(masterc);
|
CounterList::iterator const it = counterList.find(masterc);
|
||||||
// if not give warning and return
|
// if not give warning and return
|
||||||
if (it == counterList.end()) {
|
if (it == counterList.end()) {
|
||||||
lyxerr << "Master counter does not exist: " << masterc << endl;
|
lyxerr << "Master counter does not exist: "
|
||||||
|
<< lyx::to_utf8(masterc)
|
||||||
|
<< endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,44 +118,48 @@ void Counters::newCounter(string const & newc, string const & masterc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::set(string const & ctr, int const val)
|
void Counters::set(docstring const & ctr, int const val)
|
||||||
{
|
{
|
||||||
CounterList::iterator const it = counterList.find(ctr);
|
CounterList::iterator const it = counterList.find(ctr);
|
||||||
if (it == counterList.end()) {
|
if (it == counterList.end()) {
|
||||||
lyxerr << "set: Counter does not exist: " << ctr << endl;
|
lyxerr << "set: Counter does not exist: "
|
||||||
|
<< lyx::to_utf8(ctr) << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
it->second.set(val);
|
it->second.set(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::addto(string const & ctr, int const val)
|
void Counters::addto(docstring const & ctr, int const val)
|
||||||
{
|
{
|
||||||
CounterList::iterator const it = counterList.find(ctr);
|
CounterList::iterator const it = counterList.find(ctr);
|
||||||
if (it == counterList.end()) {
|
if (it == counterList.end()) {
|
||||||
lyxerr << "addto: Counter does not exist: " << ctr << endl;
|
lyxerr << "addto: Counter does not exist: "
|
||||||
|
<< lyx::to_utf8(ctr) << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
it->second.addto(val);
|
it->second.addto(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Counters::value(string const & ctr) const
|
int Counters::value(docstring const & ctr) const
|
||||||
{
|
{
|
||||||
CounterList::const_iterator const cit = counterList.find(ctr);
|
CounterList::const_iterator const cit = counterList.find(ctr);
|
||||||
if (cit == counterList.end()) {
|
if (cit == counterList.end()) {
|
||||||
lyxerr << "value: Counter does not exist: " << ctr << endl;
|
lyxerr << "value: Counter does not exist: "
|
||||||
|
<< lyx::to_utf8(ctr) << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return cit->second.value();
|
return cit->second.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::step(string const & ctr)
|
void Counters::step(docstring const & ctr)
|
||||||
{
|
{
|
||||||
CounterList::iterator it = counterList.find(ctr);
|
CounterList::iterator it = counterList.find(ctr);
|
||||||
if (it == counterList.end()) {
|
if (it == counterList.end()) {
|
||||||
lyxerr << "step: Counter does not exist: " << ctr << endl;
|
lyxerr << "step: Counter does not exist: "
|
||||||
|
<< lyx::to_utf8(ctr) << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +184,7 @@ void Counters::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::reset(string const & match)
|
void Counters::reset(docstring const & match)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!match.empty());
|
BOOST_ASSERT(!match.empty());
|
||||||
|
|
||||||
@ -184,7 +197,7 @@ void Counters::reset(string const & match)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Counters::copy(Counters & from, Counters & to, string const & match)
|
void Counters::copy(Counters & from, Counters & to, docstring const & match)
|
||||||
{
|
{
|
||||||
CounterList::iterator it = counterList.begin();
|
CounterList::iterator it = counterList.begin();
|
||||||
CounterList::iterator end = counterList.end();
|
CounterList::iterator end = counterList.end();
|
||||||
@ -228,7 +241,7 @@ char hebrewCounter(int const n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const lowerromanCounter(int const n)
|
docstring const lowerromanCounter(int const n)
|
||||||
{
|
{
|
||||||
static char const * const roman[20] = {
|
static char const * const roman[20] = {
|
||||||
"i", "ii", "iii", "iv", "v",
|
"i", "ii", "iii", "iv", "v",
|
||||||
@ -238,12 +251,12 @@ string const lowerromanCounter(int const n)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (n < 1 || n > 20)
|
if (n < 1 || n > 20)
|
||||||
return "??";
|
return lyx::from_ascii("??");
|
||||||
return roman[n - 1];
|
return lyx::from_ascii(roman[n - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const romanCounter(int const n)
|
docstring const romanCounter(int const n)
|
||||||
{
|
{
|
||||||
static char const * const roman[20] = {
|
static char const * const roman[20] = {
|
||||||
"I", "II", "III", "IV", "V",
|
"I", "II", "III", "IV", "V",
|
||||||
@ -253,28 +266,31 @@ string const romanCounter(int const n)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (n < 1 || n > 20)
|
if (n < 1 || n > 20)
|
||||||
return "??";
|
return lyx::from_ascii("??");
|
||||||
return roman[n - 1];
|
return lyx::from_ascii(roman[n - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
string Counters::labelItem(string const & ctr, string const & numbertype)
|
docstring Counters::labelItem(docstring const & ctr,
|
||||||
|
docstring const & numbertype)
|
||||||
{
|
{
|
||||||
if (counterList.find(ctr) == counterList.end()) {
|
if (counterList.find(ctr) == counterList.end()) {
|
||||||
lyxerr << "Counter " << ctr << " does not exist." << endl;
|
lyxerr << "Counter "
|
||||||
return string();
|
<< lyx::to_utf8(ctr)
|
||||||
|
<< " does not exist." << endl;
|
||||||
|
return docstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numbertype == "hebrew")
|
if (numbertype == "hebrew")
|
||||||
return string(1, hebrewCounter(value(ctr)));
|
return docstring(1, hebrewCounter(value(ctr)));
|
||||||
|
|
||||||
if (numbertype == "alph")
|
if (numbertype == "alph")
|
||||||
return string(1, loweralphaCounter(value(ctr)));
|
return docstring(1, loweralphaCounter(value(ctr)));
|
||||||
|
|
||||||
if (numbertype == "Alph")
|
if (numbertype == "Alph")
|
||||||
return string(1, alphaCounter(value(ctr)));
|
return docstring(1, alphaCounter(value(ctr)));
|
||||||
|
|
||||||
if (numbertype == "roman")
|
if (numbertype == "roman")
|
||||||
return lowerromanCounter(value(ctr));
|
return lowerromanCounter(value(ctr));
|
||||||
@ -282,31 +298,31 @@ string Counters::labelItem(string const & ctr, string const & numbertype)
|
|||||||
if (numbertype == "Roman")
|
if (numbertype == "Roman")
|
||||||
return romanCounter(value(ctr));
|
return romanCounter(value(ctr));
|
||||||
|
|
||||||
return convert<string>(value(ctr));
|
return convert<docstring>(value(ctr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string Counters::counterLabel(string const & format)
|
docstring Counters::counterLabel(docstring const & format)
|
||||||
{
|
{
|
||||||
string label = format;
|
docstring label = format;
|
||||||
while (true) {
|
while (true) {
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning Using boost::regex or boost::spirit would make this code a lot simpler... (Lgb)
|
#warning Using boost::regex or boost::spirit would make this code a lot simpler... (Lgb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t const i = label.find('\\', 0);
|
size_t const i = label.find('\\', 0);
|
||||||
if (i == string::npos)
|
if (i == docstring::npos)
|
||||||
break;
|
break;
|
||||||
size_t const j = label.find('{', i + 1);
|
size_t const j = label.find('{', i + 1);
|
||||||
if (j == string::npos)
|
if (j == docstring::npos)
|
||||||
break;
|
break;
|
||||||
size_t const k = label.find('}', j + 1);
|
size_t const k = label.find('}', j + 1);
|
||||||
if (k == string::npos)
|
if (k == string::npos)
|
||||||
break;
|
break;
|
||||||
string const numbertype(label, i + 1, j - i - 1);
|
docstring const numbertype(label, i + 1, j - i - 1);
|
||||||
string const counter(label, j + 1, k - j - 1);
|
docstring const counter(label, j + 1, k - j - 1);
|
||||||
string const rep = labelItem(counter, numbertype);
|
docstring const rep = labelItem(counter, numbertype);
|
||||||
label = string(label, 0, i) + rep + string(label, k + 1, string::npos);
|
label = docstring(label, 0, i) + rep + docstring(label, k + 1, string::npos);
|
||||||
//lyxerr << " : " << " (" << counter << ","
|
//lyxerr << " : " << " (" << counter << ","
|
||||||
// << numbertype << ") -> " << label << endl;
|
// << numbertype << ") -> " << label << endl;
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
#ifndef COUNTERS_H
|
#ifndef COUNTERS_H
|
||||||
#define COUNTERS_H
|
#define COUNTERS_H
|
||||||
|
|
||||||
|
#include "support/docstring.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
/// This represents a single counter.
|
/// This represents a single counter.
|
||||||
class Counter {
|
class Counter {
|
||||||
@ -34,16 +35,16 @@ public:
|
|||||||
///
|
///
|
||||||
void reset();
|
void reset();
|
||||||
/// Returns the master counter of this counter
|
/// Returns the master counter of this counter
|
||||||
std::string master() const;
|
lyx::docstring master() const;
|
||||||
/// sets the master counter for this counter
|
/// sets the master counter for this counter
|
||||||
void setMaster(std::string const & m);
|
void setMaster(lyx::docstring const & m);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int value_;
|
int value_;
|
||||||
/// contains master counter name; master counter is the counter
|
/// contains master counter name; master counter is the counter
|
||||||
/// that, if stepped (incremented) zeroes this counter. E.g.
|
/// that, if stepped (incremented) zeroes this counter. E.g.
|
||||||
/// "subparagraph"'s master is "paragraph".
|
/// "subparagraph"'s master is "paragraph".
|
||||||
std::string master_;
|
lyx::docstring master_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -52,36 +53,39 @@ private:
|
|||||||
class Counters {
|
class Counters {
|
||||||
public:
|
public:
|
||||||
/// Add a new counter to array.
|
/// Add a new counter to array.
|
||||||
void newCounter(std::string const & newc);
|
void newCounter(lyx::docstring const & newc);
|
||||||
/// Add new counter having oldc as its master.
|
/// Add new counter having oldc as its master.
|
||||||
void newCounter(std::string const & newc, std::string const & oldc);
|
void newCounter(lyx::docstring const & newc,
|
||||||
|
lyx::docstring const & oldc);
|
||||||
///
|
///
|
||||||
void set(std::string const & ctr, int val);
|
void set(lyx::docstring const & ctr, int val);
|
||||||
///
|
///
|
||||||
void addto(std::string const & ctr, int val);
|
void addto(lyx::docstring const & ctr, int val);
|
||||||
///
|
///
|
||||||
int value(std::string const & ctr) const;
|
int value(lyx::docstring const & ctr) const;
|
||||||
/// Step (increment by one) counter named by arg, and
|
/// Step (increment by one) counter named by arg, and
|
||||||
/// zeroes slave counter(s) for which it is the master.
|
/// zeroes slave counter(s) for which it is the master.
|
||||||
/// NOTE sub-slaves not zeroed! That happens at slave's
|
/// NOTE sub-slaves not zeroed! That happens at slave's
|
||||||
/// first step 0->1. Seems to be sufficient.
|
/// first step 0->1. Seems to be sufficient.
|
||||||
void step(std::string const & ctr);
|
void step(lyx::docstring const & ctr);
|
||||||
/// Reset all counters.
|
/// Reset all counters.
|
||||||
void reset();
|
void reset();
|
||||||
/// Reset counters matched by match string.
|
/// Reset counters matched by match string.
|
||||||
void reset(std::string const & match);
|
void reset(lyx::docstring const & match);
|
||||||
/// Copy counters whose name matches match from the &from to
|
/// Copy counters whose name matches match from the &from to
|
||||||
/// the &to array of counters. Empty string matches all.
|
/// the &to array of counters. Empty string matches all.
|
||||||
void copy(Counters & from, Counters & to, std::string const & match = std::string());
|
void copy(Counters & from, Counters & to,
|
||||||
|
lyx::docstring const & match = lyx::docstring());
|
||||||
/// A complete expanded label, like 2.1.4 for a subsubsection
|
/// A complete expanded label, like 2.1.4 for a subsubsection
|
||||||
/// according to the given format
|
/// according to the given format
|
||||||
std::string counterLabel(std::string const & format);
|
lyx::docstring counterLabel(lyx::docstring const & format);
|
||||||
private:
|
private:
|
||||||
/// A counter label's single item, 1 for subsection number in
|
/// A counter label's single item, 1 for subsection number in
|
||||||
/// the 2.1.4 subsubsection number label.
|
/// the 2.1.4 subsubsection number label.
|
||||||
std::string labelItem(std::string const & ctr, std::string const & numbertype);
|
lyx::docstring labelItem(lyx::docstring const & ctr,
|
||||||
|
lyx::docstring const & numbertype);
|
||||||
/// Maps counter (layout) names to actual counters.
|
/// Maps counter (layout) names to actual counters.
|
||||||
typedef std::map<std::string, Counter> CounterList;
|
typedef std::map<lyx::docstring, Counter> CounterList;
|
||||||
/// Instantiate.
|
/// Instantiate.
|
||||||
CounterList counterList;
|
CounterList counterList;
|
||||||
|
|
||||||
|
@ -835,10 +835,12 @@ void LyXTextClass::readCounter(LyXLex & lexrc)
|
|||||||
|
|
||||||
// Here if have a full counter if getout == true
|
// Here if have a full counter if getout == true
|
||||||
if (getout) {
|
if (getout) {
|
||||||
|
// FIXME UNICODE
|
||||||
if (within.empty()) {
|
if (within.empty()) {
|
||||||
ctrs_->newCounter(name);
|
ctrs_->newCounter(lyx::from_ascii(name));
|
||||||
} else {
|
} else {
|
||||||
ctrs_->newCounter(name, within);
|
ctrs_->newCounter(lyx::from_ascii(name),
|
||||||
|
lyx::from_ascii(within));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +235,7 @@ ParagraphList::const_iterator makeCommand(Buffer const & buf,
|
|||||||
// Label around sectioning number:
|
// Label around sectioning number:
|
||||||
if (!bstyle->labeltag().empty()) {
|
if (!bstyle->labeltag().empty()) {
|
||||||
sgml::openTag(os, bstyle->labeltag());
|
sgml::openTag(os, bstyle->labeltag());
|
||||||
// FIXME UNICODE
|
os << expandLabel(buf, bstyle, false);
|
||||||
os << lyx::from_ascii(expandLabel(buf, bstyle, false));
|
|
||||||
sgml::closeTag(os, bstyle->labeltag());
|
sgml::closeTag(os, bstyle->labeltag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,11 +227,12 @@ void sgml::openTag(Buffer const & buf, odocstream & os, OutputParams const & run
|
|||||||
attribute = id + ' ' + param;
|
attribute = id + ' ' + param;
|
||||||
} else {
|
} else {
|
||||||
if (param.find('#') != string::npos) {
|
if (param.find('#') != string::npos) {
|
||||||
|
// FIXME UNICODE
|
||||||
if(!style->counter.empty())
|
if(!style->counter.empty())
|
||||||
counters.step(style->counter);
|
counters.step(lyx::from_ascii(style->counter));
|
||||||
else
|
else
|
||||||
counters.step(style->latexname());
|
counters.step(lyx::from_ascii(style->latexname()));
|
||||||
int i = counters.value(name);
|
int i = counters.value(lyx::from_ascii(name));
|
||||||
attribute = subst(param, "#", convert<string>(i));
|
attribute = subst(param, "#", convert<string>(i));
|
||||||
} else {
|
} else {
|
||||||
attribute = param;
|
attribute = param;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user