Klammertext runs natively on Windows; a Windows source-install guide; the bundled sh for @eval :shell
Assembled from klammertext-dev f344a37d772c. The commands, the library,
the Standard Klammer Set, the reflection klammerset and the Python
binding build and run natively on Windows (MSYS2 UCRT64 gcc, python.org
Python), and both test tiers pass there. doc/install/windows_source_install.md
is the fifth install guide: a source install parallel to the Linux and
macOS ones, verified by following it on a pristine Windows 11.
Behaviour on every system: paths Klammertext prints use forward slashes;
output is LF; the command line is UTF-8 on Windows; @eval :shell is a
POSIX shell command everywhere -- on Windows it runs the sh Klammertext
ships, BusyBox for Windows (win/busybox/, GPLv2, with its licence and the
source pointer). KLAMMERTEXT_FONTS and KLAMMERTEXT_KLAMMERSETS are lists in
the system's PATH convention (';' on Windows). On Linux and macOS nothing
observable changes.
This commit is contained in:
1 parent
f9af1ff869
commit
830b19394d
55 files changed
+1182
-153
No files matched your search
@@ -48,7 +48,7 @@ deps :
|
||||
# Shared object - link against libklammertext.so
|
||||
document.so : $(LOCAL_OBJECTS) $(SKS_OBJECTS) $(LIBRARY) document.cpp | deps
|
||||
$(CXX) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CXXFLAGS) $(DOC_LDFLAGS) $(LDFLAGS) \
|
||||
document.cpp -o $@ $(ALL_OBJECTS) -lklammertext $(LDLIBS)
|
||||
document.cpp -o $@ $(ALL_OBJECTS) $(KLAMMERTEXT_LIB) $(LDLIBS)
|
||||
|
||||
clean :
|
||||
rm -f $(LOCAL_OBJECTS) $(LOCAL_DEPFILES) *.so *~
|
||||
|
||||
@@ -178,7 +178,7 @@ fs::path parse_input_filename(const std::string& s, const std::string& input_dir
|
||||
Locator::none());
|
||||
}
|
||||
// The resolved path itself shows kt/ -- no label needed.
|
||||
(void)K::log(1, "Input file \"" + s + "\": " + in_kt.string());
|
||||
(void)K::log(1, "Input file \"" + s + "\": " + in_kt.generic_string());
|
||||
return in_kt;
|
||||
}
|
||||
if (p.extension() != ".kt") {
|
||||
@@ -188,7 +188,7 @@ fs::path parse_input_filename(const std::string& s, const std::string& input_dir
|
||||
return p;
|
||||
}
|
||||
fs::path in_input_dir = fs::path(input_dir) / p;
|
||||
(void)K::log(1, "Input file \"" + s + "\": " + in_input_dir.string());
|
||||
(void)K::log(1, "Input file \"" + s + "\": " + in_input_dir.generic_string());
|
||||
return in_input_dir;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ std::string insert_ids(const std::string& html_text)
|
||||
std::string Document_class::make_help_page()
|
||||
{
|
||||
(void)K::log(3);
|
||||
std::string kt_filename = klammertext_filename("doc/html_help.kt");
|
||||
std::string kt_filename = klammertext_filename("doc/html_help.kt").string();
|
||||
std::string basename = "help";
|
||||
std::string help_page;
|
||||
//if (!in_modification_order(kt_filename, output_filename, no_cache)) {
|
||||
@@ -306,14 +306,14 @@ void Document_class::process_input_files()
|
||||
size_t basename_width = 0;
|
||||
for (auto input_filename : m_files) {
|
||||
fs::path inpath = input_filename;
|
||||
if (!file_exists(inpath)) {
|
||||
if (!file_exists(inpath.string())) {
|
||||
inpath = parse_input_filename(input_filename, m_input_dir);
|
||||
}
|
||||
std::string basename = file_basename(input_filename);
|
||||
basename_width = std::max(basename_width, basename.size());
|
||||
std::string html_text;
|
||||
//if (true || !in_modification_order(inpath, cached_filename, m_no_cache)) {
|
||||
if (m_no_cache || cache_requires_update(m_cache_dir, inpath, basename)) {
|
||||
if (m_no_cache || cache_requires_update(m_cache_dir, inpath.string(), basename)) {
|
||||
Machine M = m_machine;
|
||||
M.read(inpath);
|
||||
html_text = trim(M.apply("html"));
|
||||
|
||||
@@ -36,7 +36,7 @@ std::string Document_class::tex()
|
||||
std::string cached_filename = m_cache_dir + "/" + basename;
|
||||
fs::path inpath = parse_input_filename(input_filename, m_input_dir);
|
||||
// if (!in_modification_order(input_filename, cached_filename, m_no_cache)) {
|
||||
if (m_no_cache || cache_requires_update(m_cache_dir, inpath, basename)) {
|
||||
if (m_no_cache || cache_requires_update(m_cache_dir, inpath.string(), basename)) {
|
||||
Machine M = m_machine;
|
||||
M.m_state.set("document_landscape", landscape ? "true" : "false"); // , "Landscape mode");
|
||||
M.read(inpath);
|
||||
|
||||
@@ -163,7 +163,7 @@ make_navigation_table_of_contents(std::vector<Heading> headings)
|
||||
void show_table_of_contents(
|
||||
const std::string& kt_root_filename, const std::string& title, std::vector<Heading> headings)
|
||||
{
|
||||
long unsigned int width = kt_root_filename.size();
|
||||
std::size_t width = kt_root_filename.size();
|
||||
for (Heading h : headings) {
|
||||
width = std::max(width, h.m_filename.size());
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void show_table_of_contents(
|
||||
std::string cache_table_of_contents(
|
||||
const std::string& kt_root_filename, const std::string& title, std::vector<Heading> headings)
|
||||
{
|
||||
long unsigned int width = kt_root_filename.size();
|
||||
std::size_t width = kt_root_filename.size();
|
||||
for (Heading h : headings) {
|
||||
width = std::max(width, h.m_filename.size());
|
||||
}
|
||||
|
||||
+3
-1
@@ -93,7 +93,9 @@ class Image(klammer_base.Klammer_base):
|
||||
|
||||
|
||||
def tex(self):
|
||||
source = os.path.abspath(self.source)
|
||||
# Forward slashes: this path is document text (\includegraphics, an
|
||||
# html src), where a Windows backslash is a TeX command or an escape.
|
||||
source = os.path.abspath(self.source).replace(os.sep, "/")
|
||||
width = kutil.parse_width("tex", self.width, self.rel_fraction)[0]
|
||||
width = re.sub("px", "pt", width)
|
||||
#result = f'\\includegraphics[width={width}]{{{source}}}'
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ std::vector<std::string> sks_files_of_type(const std::string& extension, const s
|
||||
std::string msg = "File " + ext_filename + " in " + list_filename + " does not exist";
|
||||
throw Internal_error(msg);
|
||||
}
|
||||
if (in_subset(fs::path(s).stem(), subset)) {
|
||||
if (in_subset(fs::path(s).stem().string(), subset)) {
|
||||
if (dbg) msg() << " Add: " << ext_filename << "\n";
|
||||
result.push_back(ext_filename);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ std::vector<std::string> sks_files_of_type(const std::string& extension, const s
|
||||
} else {
|
||||
for (auto f : get_files_in_directory(ext_dir)) {
|
||||
if (f[f.size()-1] != '~') {
|
||||
if (in_subset(fs::path(f).stem(), subset)) {
|
||||
if (in_subset(fs::path(f).stem().string(), subset)) {
|
||||
result.push_back(ext_dir + "/" + f);
|
||||
if (dbg) msg() << " Add: " << f << "\n";
|
||||
}
|
||||
|
||||
+3
-1
@@ -40,7 +40,9 @@ def klammertext_dir():
|
||||
return kdir
|
||||
|
||||
def cache_directory(relative_pathname, basename):
|
||||
directory = relative_pathname
|
||||
# Forward slashes: the path ends up in document text (\includegraphics,
|
||||
# an html src), where a Windows backslash is a TeX command or an escape.
|
||||
directory = relative_pathname.replace(os.sep, "/")
|
||||
if not os.path.isdir(directory):
|
||||
os.makedirs(directory)
|
||||
result = directory + "/_klammertext_cache/" + basename
|
||||
|
||||
@@ -302,9 +302,10 @@ namespace latex {
|
||||
|
||||
void check_for_xelatex()
|
||||
{
|
||||
std::string command = "which xelatex";
|
||||
std::string xelatex_path = trim(exec(command.c_str()));
|
||||
if (trim(xelatex_path).empty()) {
|
||||
// A PATH search, not "which" through a shell: on Windows popen() runs
|
||||
// cmd.exe, which has no which, and the answer would always be empty.
|
||||
std::string xelatex_path = find_in_path("xelatex");
|
||||
if (xelatex_path.empty()) {
|
||||
throw Environment_error(
|
||||
"The \"xelatex\" command required to make PDF files is not installed",
|
||||
Locator());
|
||||
|
||||
Reference in new issue
Block a user