diff --git a/README.md b/README.md index cb4723782..4dae02d32 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,6 @@ libraries need to be available: (package libzim-dev on Ubuntu) * Pugixml ........................................ http://pugixml.org/ (package libpugixml-dev on Ubuntu) -* ctpp2 ........................................ http://ctpp.havoc.ru/ -(package libctpp2-dev on Ubuntu) * libaria2 .................................. https://aria2.github.io/ (no package on Ubuntu) @@ -47,10 +45,6 @@ version by hand. If you want to install these dependencies locally, then use the kiwix-lib directory as install prefix. -If you compile ctpp2 from source and want to compile the Kiwix library -statically then you will probably need to rename ctpp2 static library -from ctpp2-st.a to ctpp2.a. - Environment ------------- diff --git a/include/common/stringTools.h b/include/common/stringTools.h index ad04dc1a2..7b56a4c08 100644 --- a/include/common/stringTools.h +++ b/include/common/stringTools.h @@ -33,8 +33,6 @@ namespace kiwix { -#ifndef __ANDROID__ - std::string beautifyInteger(uint64_t number); std::string beautifyFileSize(uint64_t number); void printStringInHexadecimal(const char* s); @@ -44,8 +42,6 @@ void stringReplacement(std::string& str, const std::string& newStr); std::string encodeDiples(const std::string& str); -#endif - std::string removeAccents(const std::string& text); void loadICUExternalTables(); diff --git a/include/ctpp2/CTPP2VMStringLoader.hpp b/include/ctpp2/CTPP2VMStringLoader.hpp deleted file mode 100644 index 4ac38189b..000000000 --- a/include/ctpp2/CTPP2VMStringLoader.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2013 Renaud Gaudin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -#ifndef _CTPP2_VM_STRING_LOADER_HPP__ -#define _CTPP2_VM_STRING_LOADER_HPP__ 1 - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -/** - @file VMStringLoader.hpp - @brief Load program core from file -*/ - -namespace CTPP // C++ Template Engine -{ -// FWD -struct VMExecutable; - -/** - @class VMStringLoader CTPP2VMStringLoader.hpp - @brief Load program core from file -*/ -class CTPP2DECL VMStringLoader: - public VMLoader -{ -public: - /** - */ - VMStringLoader(CCHAR_P rawContent, size_t rawContentSize); - /** - @brief Get ready-to-run program - */ - const VMMemoryCore * GetCore() const; - - /** - @brief A destructor - */ - ~VMStringLoader() throw(); -private: - /** Program core */ - VMExecutable * oCore; - /** Ready-to-run program */ - VMMemoryCore * pVMMemoryCore; -}; - -} // namespace CTPP -#endif // _CTPP2_VM_STRING_LOADER_HPP__ -// End. diff --git a/include/meson.build b/include/meson.build index a278adf91..4ba3420cf 100644 --- a/include/meson.build +++ b/include/meson.build @@ -24,10 +24,3 @@ install_headers( subdir:'kiwix/common' ) -if has_ctpp2_dep - install_headers( - 'ctpp2/CTPP2VMStringLoader.hpp', - subdir:'kiwix/ctpp2' - ) -endif - diff --git a/include/searcher.h b/include/searcher.h index aa3eee966..a30b01136 100644 --- a/include/searcher.h +++ b/include/searcher.h @@ -163,12 +163,10 @@ class Searcher */ bool setSearchProtocolPrefix(const std::string prefix); -#ifdef ENABLE_CTPP2 /** * Generate the html page with the resutls of the search. */ string getHtml(); -#endif protected: std::string beautifyInteger(const unsigned int number); diff --git a/meson.build b/meson.build index 0a3e5e955..88b1d9836 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,6 @@ project('kiwix-lib', 'cpp', default_options : ['c_std=c11', 'cpp_std=c++11', 'werror=true']) compiler = meson.get_compiler('cpp') -find_library_in_compiler = meson.version().version_compare('>=0.31.0') static_deps = get_option('android') or get_option('default_library') == 'static' if get_option('android') @@ -19,81 +18,22 @@ libzim_dep = dependency('libzim', version : '>=4.0.0', static:static_deps) pugixml_dep = dependency('pugixml', static:static_deps) libcurl_dep = dependency('libcurl', static:static_deps) +if not compiler.has_header('mustache.hpp') + error('Cannot found header mustache.hpp') +endif + extra_cflags = '' if target_machine.system() == 'windows' and static_deps add_project_arguments('-DCURL_STATICLIB', language : 'cpp') extra_cflags += '-DCURL_STATICLIB' endif - - -ctpp2_include_path = '' -has_ctpp2_dep = false -ctpp2_prefix_install = get_option('ctpp2-install-prefix') -ctpp2_link_args = [] -if ctpp2_prefix_install == '' - if compiler.has_header('ctpp2/CTPP2Logger.hpp') - if find_library_in_compiler - ctpp2_lib = compiler.find_library('ctpp2') - else - ctpp2_lib = find_library('ctpp2') - endif - ctpp2_link_args = ['-lctpp2'] - if meson.is_cross_build() and host_machine.system() == 'windows' - if find_library_in_compiler - iconv_lib = compiler.find_library('iconv', required:false) - else - iconv_lib = find_library('iconv', required:false) - endif - if iconv_lib.found() - ctpp2_link_args += ['-liconv'] - endif - endif - has_ctpp2_dep = true - ctpp2_dep = declare_dependency(link_args:ctpp2_link_args) - else - message('ctpp2/CTPP2Logger.hpp not found. Compiling without CTPP2 support') - endif -else - if not find_library_in_compiler - error('For custom ctpp2_prefix_install you need a meson version >=0.31.0') - endif - ctpp2_include_path = ctpp2_prefix_install + '/include' - ctpp2_include_args = ['-I'+ctpp2_include_path] - if compiler.has_header('ctpp2/CTPP2Logger.hpp', args:ctpp2_include_args) - ctpp2_include_dir = include_directories(ctpp2_include_path, is_system:true) - ctpp2_lib_path = join_paths(ctpp2_prefix_install, get_option('libdir')) - message(ctpp2_lib_path) - ctpp2_lib = compiler.find_library('ctpp2', dirs:ctpp2_lib_path, required:false) - if not ctpp2_lib.found() - ctpp2_lib_path = join_paths(ctpp2_prefix_install, 'lib') - message(ctpp2_lib_path) - ctpp2_lib = compiler.find_library('ctpp2', dirs:ctpp2_lib_path) - endif - ctpp2_link_args = ['-L'+ctpp2_lib_path, '-lctpp2'] - if meson.is_cross_build() and host_machine.system() == 'windows' - iconv_lib = compiler.find_library('iconv', required:false) - if iconv_lib.found() - ctpp2_link_args += ['-liconv'] - endif - endif - has_ctpp2_dep = true - ctpp2_dep = declare_dependency(include_directories:ctpp2_include_dir, link_args:ctpp2_link_args) - else - message('ctpp2/CTPP2Logger.hpp not found. Compiling without CTPP2 support') - endif -endif - all_deps = [thread_dep, libicu_dep, libzim_dep, pugixml_dep, libcurl_dep] -if has_ctpp2_dep - all_deps += [ctpp2_dep] -endif inc = include_directories('include') conf = configuration_data() conf.set('VERSION', '"@0@"'.format(meson.project_version())) -conf.set('ENABLE_CTPP2', has_ctpp2_dep) if build_machine.system() == 'windows' extra_link_args = ['-lshlwapi', '-lwinmm'] @@ -109,13 +49,6 @@ subdir('test') pkg_requires = ['libzim', 'icu-i18n', 'pugixml', 'libcurl'] -if has_ctpp2_dep - extra_libs += ctpp2_link_args - if ctpp2_include_path != '' - extra_cflags = ' -I'+ctpp2_include_path - endif -endif - pkg_conf = configuration_data() pkg_conf.set('prefix', get_option('prefix')) pkg_conf.set('requires', ' '.join(pkg_requires)) diff --git a/meson_options.txt b/meson_options.txt index 518f4b378..cbcf49359 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,2 @@ -option('ctpp2-install-prefix', type : 'string', value : '', - description : 'Prefix where ctpp libs has been installed') option('android', type : 'boolean', value : false, description : 'Do we make a kiwix-lib for android') diff --git a/scripts/ctpp2c.sh b/scripts/ctpp2c.sh deleted file mode 100755 index 746ecccf5..000000000 --- a/scripts/ctpp2c.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - - -ctpp2c=$1 -SOURCE=$(pwd)/$2 -DEST=$3 - -$ctpp2c $SOURCE $DEST diff --git a/scripts/meson.build b/scripts/meson.build index 7e86f5b86..6c35c0945 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -1,5 +1,4 @@ res_compiler = find_program('kiwix-compile-resources') -intermediate_ctpp2c = find_program('ctpp2c.sh') install_data(res_compiler.path(), install_dir:get_option('bindir')) diff --git a/src/common/stringTools.cpp b/src/common/stringTools.cpp index 428733c29..ebd4bca49 100644 --- a/src/common/stringTools.cpp +++ b/src/common/stringTools.cpp @@ -57,8 +57,6 @@ std::string kiwix::removeAccents(const std::string& text) return unaccentedText; } -#ifndef __ANDROID__ - /* Prepare integer for display */ std::string kiwix::beautifyInteger(uint64_t number) { @@ -138,8 +136,6 @@ std::string kiwix::encodeDiples(const std::string& str) return result; } -#endif - /* urlEncode() based on javascript encodeURI() & encodeURIComponent(). Mostly code from rstudio/httpuv (GPLv3) */ diff --git a/src/config.h.in b/src/config.h.in index 713be9c12..fa3d131c7 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -1,4 +1,3 @@ #mesondefine VERSION -#mesondefine ENABLE_CTPP2 diff --git a/src/ctpp2/CTPP2VMStringLoader.cpp b/src/ctpp2/CTPP2VMStringLoader.cpp deleted file mode 100644 index 02da6f238..000000000 --- a/src/ctpp2/CTPP2VMStringLoader.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2013 Renaud Gaudin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -#include - -namespace CTPP // C++ Template Engine -{ - -// -// Convert byte order -// -static void ConvertExecutable(VMExecutable * oCore) -{ - // Code entry point - oCore -> entry_point = Swap32(oCore -> entry_point); - // Offset of code segment - oCore -> code_offset = Swap32(oCore -> code_offset); - - // Code segment size - oCore -> code_size = Swap32(oCore -> code_size); - - // Offset of static text segment - oCore -> syscalls_offset = Swap32(oCore -> syscalls_offset); - // Static text segment size - oCore -> syscalls_data_size = Swap32(oCore -> syscalls_data_size); - - // Offset of static text index segment - oCore -> syscalls_index_offset = Swap32(oCore -> syscalls_index_offset); - // Static text index segment size - oCore -> syscalls_index_size = Swap32(oCore -> syscalls_index_size); - - // Offset of static data segment - oCore -> static_data_offset = Swap32(oCore -> static_data_offset); - - // Static data segment size - oCore -> static_data_data_size = Swap32(oCore -> static_data_data_size); - - // Offset of static text segment - oCore -> static_text_offset = Swap32(oCore -> static_text_offset); - // Static text segment size - oCore -> static_text_data_size = Swap32(oCore -> static_text_data_size); - - // Offset of static text index segment - oCore -> static_text_index_offset = Swap32(oCore -> static_text_index_offset); - // Static text index segment size - oCore -> static_text_index_size = Swap32(oCore -> static_text_index_size); - - // Version 2.2+ - // Offset of static data bit index - oCore -> static_data_bit_index_offset = Swap32(oCore -> static_data_bit_index_offset); - /// Offset of static data bit index - oCore -> static_data_bit_index_size = Swap32(oCore -> static_data_bit_index_size); - - // Platform - oCore -> platform = Swap64(oCore -> platform); - - // Ugly-jolly hack! - // ... dereferencing type-punned pointer will break strict-aliasing rules ... - UINT_64 iTMP; - memcpy(&iTMP, &(oCore -> ieee754double), sizeof(UINT_64)); - iTMP = Swap64(iTMP); - memcpy(&(oCore -> ieee754double), &iTMP, sizeof(UINT_64)); - - // Cyclic Redundancy Check - oCore -> crc = 0; - - // Convert data structures - - // Convert code segment - VMInstruction * pInstructions = const_cast(VMExecutable::GetCodeSeg(oCore)); - UINT_32 iI = 0; - UINT_32 iSteps = oCore -> code_size / sizeof(VMInstruction); - for(iI = 0; iI < iSteps; ++iI) - { - pInstructions -> instruction = Swap32(pInstructions -> instruction); - pInstructions -> argument = Swap32(pInstructions -> argument); - pInstructions -> reserved = Swap64(pInstructions -> reserved); - ++pInstructions; - } - - // Convert syscalls index - TextDataIndex * pTextIndex = const_cast(VMExecutable::GetSyscallsIndexSeg(oCore)); - iSteps = oCore -> syscalls_index_size / sizeof(TextDataIndex); - for(iI = 0; iI < iSteps; ++iI) - { - pTextIndex -> offset = Swap32(pTextIndex -> offset); - pTextIndex -> length = Swap32(pTextIndex -> length); - ++pTextIndex; - } - - // Convert static text index - pTextIndex = const_cast(VMExecutable::GetStaticTextIndexSeg(oCore)); - iSteps = oCore -> static_text_index_size / sizeof(TextDataIndex); - for(iI = 0; iI < iSteps; ++iI) - { - pTextIndex -> offset = Swap32(pTextIndex -> offset); - pTextIndex -> length = Swap32(pTextIndex -> length); - ++pTextIndex; - } - - // Convert static data - StaticDataVar * pStaticDataVar = const_cast(VMExecutable::GetStaticDataSeg(oCore)); - iSteps = oCore -> static_data_data_size / sizeof(StaticDataVar); - for(iI = 0; iI < iSteps; ++iI) - { - (*pStaticDataVar).i_data = Swap64((*pStaticDataVar).i_data); - ++pStaticDataVar; - } -} - -// -// Constructor -// -VMStringLoader::VMStringLoader(CCHAR_P rawContent, size_t rawContentSize) -{ - oCore = (VMExecutable *)malloc(rawContentSize + 1); - memcpy(oCore, rawContent, rawContentSize); - - if (oCore -> magic[0] == 'C' && - oCore -> magic[1] == 'T' && - oCore -> magic[2] == 'P' && - oCore -> magic[3] == 'P') - { - // Check version - if (oCore -> version[0] >= 1) - { - // Platform-dependent data (byte order) - if (oCore -> platform == 0x4142434445464748ull) - { -#ifdef _DEBUG - fprintf(stderr, "Big/Little Endian conversion: Nothing to do\n"); -#endif - - // Nothing to do, only check crc - UINT_32 iCRC = oCore -> crc; - oCore -> crc = 0; - - // Calculate CRC of file - // KELSON: next line used to refer to oStat.st_size - // changed it to rawContentSize - if (iCRC != crc32((UCCHAR_P)oCore, rawContentSize)) - { - free(oCore); - throw CTPPLogicError("CRC checksum invalid"); - } - } - // Platform-dependent data (byte order) - else if (oCore -> platform == 0x4847464544434241ull) - { - // Need to reconvert data -#ifdef _DEBUG - fprintf(stderr, "Big/Little Endian conversion: Need to reconvert core\n"); -#endif - ConvertExecutable(oCore); - } - else - { - free(oCore); - throw CTPPLogicError("Conversion of middle-end architecture does not supported."); - } - - // Check IEEE 754 format - if (oCore -> ieee754double != 15839800103804824402926068484019465486336.0) - { - free(oCore); - throw CTPPLogicError("IEEE 754 format is broken, cannot convert file"); - } - } - - pVMMemoryCore = new VMMemoryCore(oCore); - } - else - { - free(oCore); - throw CTPPLogicError("Not an CTPP bytecode file."); - } -} - -// -// Get ready-to-run program -// -const VMMemoryCore * VMStringLoader::GetCore() const { return pVMMemoryCore; } - -// -// A destructor -// -VMStringLoader::~VMStringLoader() throw() -{ - delete pVMMemoryCore; - free(oCore); -} - -} // namespace CTPP -// End. diff --git a/src/meson.build b/src/meson.build index e51a9c33e..e7dba4715 100644 --- a/src/meson.build +++ b/src/meson.build @@ -33,11 +33,6 @@ else install_dir = get_option('libdir') endif - -if has_ctpp2_dep - kiwix_sources += ['ctpp2/CTPP2VMStringLoader.cpp'] -endif - config_h = configure_file(output : 'kiwix_config.h', configuration : conf, input : 'config.h.in') diff --git a/src/searcher.cpp b/src/searcher.cpp index dbd7dd939..04686fa8d 100644 --- a/src/searcher.cpp +++ b/src/searcher.cpp @@ -25,16 +25,9 @@ #include -#ifdef ENABLE_CTPP2 -#include -#include -#include -#include "ctpp2/CTPP2VMStringLoader.hpp" +#include #include "kiwixlib-resources.h" -using namespace CTPP; -#endif - #define MAX_SEARCH_LEN 140 namespace kiwix @@ -317,46 +310,30 @@ int _Result::get_readerIndex() { return iterator.get_fileIndex(); } -#ifdef ENABLE_CTPP2 string Searcher::getHtml() { - SimpleVM oSimpleVM( - 1024, //iIMaxFunctions (default value) - 4096, //iIMaxArgStackSize (default value) - 4096, //iIMaxCodeStackSize (default value) - 10240 * 2 //iIMaxSteps (default*2) - ); - - // Fill data - CDT oData; - CDT resultsCDT(CDT::ARRAY_VAL); + kainjow::mustache::data results{kainjow::mustache::data::type::list}; this->restart_search(); Result* p_result = NULL; while ((p_result = this->getNextResult())) { - CDT result; - result["title"] = p_result->get_title(); - result["url"] = p_result->get_url(); - result["snippet"] = p_result->get_snippet(); - result["contentId"] = humanReaderNames[p_result->get_readerIndex()]; - - if (p_result->get_size() >= 0) { - result["size"] = kiwix::beautifyInteger(p_result->get_size()); - } + kainjow::mustache::data result; + result.set("title", p_result->get_title()); + result.set("url", p_result->get_url()); + result.set("snippet", p_result->get_snippet()); + result.set("resultContentId", humanReaderNames[p_result->get_readerIndex()]); if (p_result->get_wordCount() >= 0) { - result["wordCount"] = kiwix::beautifyInteger(p_result->get_wordCount()); + result.set("wordCount", kiwix::beautifyInteger(p_result->get_wordCount())); } - resultsCDT.PushBack(result); + results.push_back(result); delete p_result; } - this->restart_search(); - oData["results"] = resultsCDT; // pages - CDT pagesCDT(CDT::ARRAY_VAL); + kainjow::mustache::data pages{kainjow::mustache::data::type::list}; unsigned int pageStart = this->resultStart / this->resultCountPerPage >= 5 @@ -372,48 +349,41 @@ string Searcher::getHtml() } for (unsigned int i = pageStart; i < pageStart + pageCount; i++) { - CDT page; - page["label"] = i + 1; - page["start"] = i * this->resultCountPerPage; - page["end"] = (i + 1) * this->resultCountPerPage; + kainjow::mustache::data page; + page.set("label", to_string(i + 1)); + page.set("start", to_string(i * this->resultCountPerPage)); + page.set("end", to_string((i + 1) * this->resultCountPerPage)); if (i * this->resultCountPerPage == this->resultStart) { - page["selected"] = true; + page.set("selected", true); } - - pagesCDT.PushBack(page); + pages.push_back(page); } - oData["pages"] = pagesCDT; - oData["count"] = kiwix::beautifyInteger(this->estimatedResultCount); - oData["searchPattern"] = kiwix::encodeDiples(this->searchPattern); - oData["searchPatternEncoded"] = urlEncode(this->searchPattern); - oData["resultStart"] = this->resultStart + 1; - oData["resultEnd"] = (this->resultEnd > this->estimatedResultCount - ? this->estimatedResultCount - : this->resultEnd); - oData["resultRange"] = this->resultCountPerPage; - oData["resultLastPageStart"] - = this->estimatedResultCount > this->resultCountPerPage - ? std::round(this->estimatedResultCount / this->resultCountPerPage) * this->resultCountPerPage - : 0; - oData["protocolPrefix"] = this->protocolPrefix; - oData["searchProtocolPrefix"] = this->searchProtocolPrefix; - oData["contentId"] = this->contentHumanReadableId; + std::string template_str = RESOURCE::search_result_tmpl; + kainjow::mustache::mustache tmpl(template_str); - std::string template_ct2 = RESOURCE::results_ct2; - VMStringLoader oLoader(template_ct2.c_str(), template_ct2.size()); + kainjow::mustache::data allData; + allData.set("results", results); + allData.set("pages", pages); + allData.set("hasResult", this->estimatedResultCount != 0); + allData.set("count", kiwix::beautifyInteger(this->estimatedResultCount)); + allData.set("searchPattern", kiwix::encodeDiples(this->searchPattern)); + allData.set("searchPatternEncoded", urlEncode(this->searchPattern)); + allData.set("resultStart", to_string(this->resultStart + 1)); + allData.set("resultEnd", to_string(min(this->resultEnd, this->estimatedResultCount))); + allData.set("resultRange", to_string(this->resultCountPerPage)); + allData.set("resultLastPageStart", to_string(this->estimatedResultCount > this->resultCountPerPage + ? round(this->estimatedResultCount / this->resultCountPerPage) * this->resultCountPerPage + : 0)); + allData.set("lastResult", to_string(this->estimatedResultCount)); + allData.set("protocolPrefix", this->protocolPrefix); + allData.set("searchProtocolPrefix", this->searchProtocolPrefix); + allData.set("contentId", this->contentHumanReadableId); - FileLogger oLogger(stderr); - - // DEBUG only (write output to stdout) - // oSimpleVM.Run(oData, oLoader, stdout, oLogger); - - std::string sResult; - oSimpleVM.Run(oData, oLoader, sResult, oLogger); - - return sResult; + std::stringstream ss; + tmpl.render(allData, [&ss](const std::string& str) { ss << str; }); + return ss.str(); } -#endif } diff --git a/static/meson.build b/static/meson.build index 2c251020b..2f40a2d14 100644 --- a/static/meson.build +++ b/static/meson.build @@ -1,15 +1,5 @@ - -ctpp2c = find_program('ctpp2c', required:false) - -if ctpp2c.found() - search_result_template = custom_target('result_template', - input: 'results.tmpl', - output: 'results.ct2', - command: [intermediate_ctpp2c, ctpp2c, '@INPUT@', '@OUTPUT@'] - ) - resources_list = 'resources_list_ctpp2.txt' - lib_resources = custom_target('resources', +lib_resources = custom_target('resources', input: 'resources_list.txt', output: ['kiwixlib-resources.cpp', 'kiwixlib-resources.h'], command:[res_compiler, @@ -17,8 +7,5 @@ if ctpp2c.found() '--hfile', '@OUTPUT1@', '--source_dir', '@OUTDIR@', '@INPUT@'], - depends: [search_result_template] - ) -else - lib_resources = [] -endif + depend_files: 'static/search_result.tmpl' +) diff --git a/static/resources_list.txt b/static/resources_list.txt index 9c165fa1e..0b64bf339 100644 --- a/static/resources_list.txt +++ b/static/resources_list.txt @@ -1 +1 @@ -results.ct2 +search_result.tmpl diff --git a/static/results.tmpl b/static/search_result.tmpl similarity index 54% rename from static/results.tmpl rename to static/search_result.tmpl index 8ace653f9..ebd61afb3 100644 --- a/static/results.tmpl +++ b/static/search_result.tmpl @@ -91,68 +91,67 @@ } - Search: <TMPL_var searchPattern> + Search: {{searchPattern}}
- + {{#hasResult}} Results - - + {{resultStart}}-{{resultEnd}} of - + {{count}} for - + {{searchPattern}} - - No results were found for - + {{/hasResult}} + {{^hasResult}} + No results were found for {{searchPattern}} + {{/hasResult}}
    - + {{#results}}
  • - - + + {{title}} - - - ... - - - -
    words
    -
    + {{#snippet}} + {{>snippet}}... + {{/snippet}} + {{#wordCount}} +
    {{wordCount}} words
    + {{/wordCount}}
  • -
    + {{/results}}
diff --git a/travis/compile.sh b/travis/compile.sh index 40aea11db..bf33f1c84 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -35,6 +35,7 @@ then else export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/x86_64-linux-gnu/pkgconfig fi -meson . build -Dctpp2-install-prefix=${INSTALL_DIR} ${MESON_OPTION} +export CPPFLAGS="-I${INSTALL_DIR}/include" +meson . build ${MESON_OPTION} cd build ninja