Code Monkey home page Code Monkey logo

colorer-library's People

Contributors

ctapmex avatar elfmz avatar platima avatar yacoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colorer-library's Issues

vcpkg Package

This would be easier to use and update if there were a package on vcpkg. Would you consider it?

Система логирования

Переделать систему логирования

  • динамическое переключение уровня логирования
  • асинхронность

crash on invalid jar location

If location of filetype set to invalid path , load scheme crashed.

example, auto/empty.hrc

  <prototype name="markdown" group="scripts" description="markdown">
    <filename>/\.(text|md|markdown)$/i</filename>
    <location link="jar:common.jar!misc/markdown.hrc"/>
  </prototype>

логирование

Попробовал новую версию colorer.exe . Заметил, это он пишет лог файлы типа consoletools.20160124-005747.log в текущие директории. Это так и задумано? Не хотелось бы, чтобы он по умолчанию вообще что-либо писал на диск.

По умолчанию лог не хотелось бы, особенно если при каждом запуске новый файл создается, и логи плодятся повсюду, где запускаешь, пока не заметишь случайно. Не ожидаешь такую фичу по умолчанию, словом.

А не по умолчанию - как пользователю, мне не особо важно, как оно включается и куда пишется, пусть будет, как удобно разработчику. Мне логи только для поиска проблем могут понадобится. Разберусь как включать и куда писать, раз проблемы. Это не то же самое, что разбираться, как избавиться от ненужного.
@nightroman

Announce migration to GitHub

Nobody knows that Colorer now lives on GitHub.

  • colorer.sf.net
  • google group
  • google group en
  • sourceforge project page

error: no matching function for call to 'equals'

I am not able to build colorer 1.3.1 on macOS 12.7.2 with xercesc 3.2.4:

src/colorer/handlers/StyledHRDMapper.cpp:32:18: error: no matching function for call to 'equals'
  if (!hbase || !xercesc::XMLString::equals(hbase->getNodeName(), hrdTagHrd)) {
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/xercesc/util/XMLString.hpp:1523:24: note: candidate function not viable: no known conversion from 'const char16_t [5]' to 'const XMLCh *' (aka 'const unsigned short *') for 2nd argument
inline bool XMLString::equals(   const XMLCh* str1
                       ^
/opt/local/include/xercesc/util/XMLString.hpp:1557:24: note: candidate function not viable: no known conversion from 'const XMLCh *' (aka 'const unsigned short *') to 'const char *' for 1st argument
inline bool XMLString::equals(   const char* str1
                       ^
src/colorer/handlers/StyledHRDMapper.cpp:39:9: error: no matching function for call to 'equals'
        xercesc::XMLString::equals(curel->getNodeName(), hrdTagAssign))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/xercesc/util/XMLString.hpp:1523:24: note: candidate function not viable: no known conversion from 'const char16_t [8]' to 'const XMLCh *' (aka 'const unsigned short *') for 2nd argument
inline bool XMLString::equals(   const XMLCh* str1
                       ^
/opt/local/include/xercesc/util/XMLString.hpp:1557:24: note: candidate function not viable: no known conversion from 'const XMLCh *' (aka 'const unsigned short *') to 'const char *' for 1st argument
inline bool XMLString::equals(   const char* str1
                       ^
src/colorer/handlers/StyledHRDMapper.cpp:42:52: error: cannot initialize a parameter of type 'const XMLCh *' (aka 'const unsigned short *') with an lvalue of type 'const char16_t [6]'
        const XMLCh* xname = subelem->getAttribute(hrdAssignAttrName);
                                                   ^~~~~~~~~~~~~~~~~
/opt/local/include/xercesc/dom/DOMElement.hpp:126:61: note: passing argument to parameter 'name' here
    virtual const XMLCh *         getAttribute(const XMLCh *name) const = 0;
                                                            ^
src/colorer/handlers/StyledHRDMapper.cpp:57:51: error: cannot initialize a parameter of type 'const XMLCh *' (aka 'const unsigned short *') with an lvalue of type 'const char16_t [6]'
        const XMLCh* sval = subelem->getAttribute(hrdAssignAttrFore);
                                                  ^~~~~~~~~~~~~~~~~
/opt/local/include/xercesc/dom/DOMElement.hpp:126:61: note: passing argument to parameter 'name' here
    virtual const XMLCh *         getAttribute(const XMLCh *name) const = 0;
                                                            ^
src/colorer/handlers/StyledHRDMapper.cpp:64:38: error: cannot initialize a parameter of type 'const XMLCh *' (aka 'const unsigned short *') with an lvalue of type 'const char16_t [6]'
        sval = subelem->getAttribute(hrdAssignAttrBack);
                                     ^~~~~~~~~~~~~~~~~
/opt/local/include/xercesc/dom/DOMElement.hpp:126:61: note: passing argument to parameter 'name' here
    virtual const XMLCh *         getAttribute(const XMLCh *name) const = 0;
                                                            ^
src/colorer/handlers/StyledHRDMapper.cpp:70:38: error: cannot initialize a parameter of type 'const XMLCh *' (aka 'const unsigned short *') with an lvalue of type 'const char16_t [7]'
        sval = subelem->getAttribute(hrdAssignAttrStyle);
                                     ^~~~~~~~~~~~~~~~~~
/opt/local/include/xercesc/dom/DOMElement.hpp:126:61: note: passing argument to parameter 'name' here
    virtual const XMLCh *         getAttribute(const XMLCh *name) const = 0;
                                                            ^
6 errors generated.
make[2]: *** [src/CMakeFiles/colorer_lib.dir/colorer/handlers/StyledHRDMapper.cpp.o] Error 1

Colorer.exe not producing correct UTF-8 as output

I'm using v1.0.2 colorer.exe when testing and I discovered that if viewing a UTF-8 file it works fine, but if outputting it to a file its not properly utf-8 formatted.

After awhile I was able to decode the result and figured what I need to do (using Python)

  • First I need to decode the output from utf-8.
  • Then I need to encode to cp1251.
  • And lastly I need to decode from utf-8 again even though it's encoded to cp1251.

So basically non-ASCII characters are double encoded to cp1251 and then utf-8.

I made a small Python script that demonstrates it:

# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import subprocess

Format = "python"
ColorerCommand = ['colorer.exe', '-ht', '-dc', '-dh', '-db', '-eiutf-8', '-eoutf-8', '-t{0}'.format(Format)]

source = u'éåäö'
proc = subprocess.Popen(ColorerCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
output = proc.communicate(('"%s"' % source).encode('utf-8'))[0].split(b'"')[1]

print("Test text:", repr(source))
print("Colorer output:", repr(output))
Unicode = output.decode('utf-8')
print("utf-8 decoded text:", repr(Unicode))
cp1251 = Unicode.encode('cp1251')
print("cp1251 encoded text:", repr(cp1251))
Unicode = cp1251.decode('utf-8')
print("utf-8 decoded text:", repr(Unicode))
print()

if source == Unicode:
    print("Source and decoded text are the same!")
else:
    print("Source and decoded text don't match!")

jonib

поиск схем идет по всем файлам

Поиск схем идет по всем файлам указанной папки. Что приводит к ошибкам, когда там лежат временные файлы.
Необходимо работать только с файлами с расширением hrc

Falling on BSD

When running on FreeBSD + clang, the library crashes.

Autodetect issues

Hey I've found a few issues with autodetect, and wondering if I am doing something wrong or if there are limitations I don't understand? Primarily, many many things autodetect as 'C'.

Eg
WITH employee_ranking AS ( SELECT employee_id, last_name, RANK() OVER (ORDER BY salary DESC) as ranking FROM employee ) SELECT employee_id, last_name, FROM employee_ranking WHERE ranking <= 5 ORDER BY ranking

I'd expect to very clearly be SQL, and then
<meta property="og:description" content="One of the best ways to learn advanced SQL is by reading examples of queries. Check 25 advanced queries that will help you build your SQL skills." /> <meta property="og:type" content="article" /> <meta property="og:url" content="https://learnsql.com/blog/25-advanced-sql-query-examples/" /><meta property="article:published_time" content="2023-02-28T18:00:00&#43;02:00"/> <meta property="article:modified_time" content="2023-02-28T18:00:00&#43;02:00"/><meta property="og:site_name" content="LearnSQL.com" /> <meta property="article:publisher" content="https://www.facebook.com/groups/welearnsql/" /> <meta property="article:section" content="blog" /> <meta property="article:tag" content="sql" /> <meta property="article:tag" content="learn sql" /> <meta property="article:tag" content="online practice" /> <meta property="article:tag" content="advanced sql" />
is quite clearly HTML.

Both auto-detect as 'C' though. Tested with a few releases, same result. Putting at the start obviously works, but is not always how it'll be used.

Any ideas?

Мысли вслух - консольный colorer.exe и поиск catalog.xml по относительным путям или симлинками

В текущей реализации (Git 70a2ebe ) ключ -c позволяет указать только абсолютный путь, но симлинки или относительные пути не обрабатывает, а было бы не плохо и их разбирать. С относительными путями вроде понятно - указаны относительно текущей директории, только смотрим нет ли в начале "..", если есть поднялись по дереву выше, отбросили первые три байта строки смотрим дальше, если надо повторим переход, если нет, то просто идём вниз по дереву до N-1 уровня и ищем catalog.xml на N. То с симлинками проще - переходим по нему и GetCurentDir() - адрес наш, смотрим есть ли тут база.

Почему бы нам не снять себе данное ограничение? Кстати аналогичная "бяда" имеет место и у Wget -если указываешь путь к файлу сертификатов то надо указать абсолютный или "Путь не найден", но там сиё правится, а нам зачем абсолютные пути? Искать где ошибся при их вводе?

Colorer.exe v1.0.5 Git-2cf327d - утилита не подхватывает схемы

Проверка простейшая схемы взяты из подкаталога FarColorer/base и положены рядом с утилитой, затем она запущена с ключом -v. Что я вижу:

в коммите Git 2cf327d

2

в коммите Git b18867c

1

собираю простейшим скриптом:

@echo off
if "%1" == "-u" (git pull -f && git submodule update --recursive)
if exist ./bin rd /s/q bin
if exist ./build rd /s/q build
mkdir build Colorer\x64 Colorer\x86
cd build
cmake -G "Visual Studio 15 2017" -Tv141_xp ..
cmd /c "%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86 && "%VS150COMNTOOLS%\..\IDE\devenv.exe" colorer.sln /Build "Release|Win32" /Project "ALL_BUILD"
cd ..
move /y bin\vc\Release\colorer.exe Colorer\x86\colorer.exe
rd /s/q build > nul
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -Tv141_xp ..
cmd /c "%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 && "%VS150COMNTOOLS%\..\IDE\devenv.exe" colorer.sln /Build "Release|x64" /Project "ALL_BUILD"
cd ..
move /y bin\vc\Release\colorer.exe Colorer\x64\colorer.exe
rd /s/q bin
rd /s/q build
exit

build.zip

error: taking the address of a temporary object of type 'DString'

Colorer library does not build on OS X with the clang compiler:

/opt/local/var/macports/build/_Users_rschmidt_macports_dports_textproc_colorer/colorer/work/Colorer-library-a15e2f6f76330323b6bb74251a3c2d766ed5f2f3/src/colorer/editor/BaseEditor.cpp:43:35: error: taking the address of a temporary object of type 'DString' [-Waddress-of-temporary]
  def_Text = hrcParser->getRegion(&DString("def:Text"));
                                  ^~~~~~~~~~~~~~~~~~~~

review innerRegion scheme attribute

Could you please review schemeNode->innerRegion conditions in the following places/functions:

I am not a c/c++ guru, but to me it looks like schemeNode->innerRegion is completely ignored and schema entry/exit happens regardless of this variable.

I think this regression was added in scope of these changes: 43f7281?diff=unified&w=0#diff-50a86708447d5ad2ca3acf2d709777ee561bb27b12d91252c318efd783982797

Prior to these changes, colorer first tried to add regions if innerRegion was set to true.

colorer 1.1.0 misses parameters -ei and -eo

colorer 1.1.0 misses parameters -ei and -eo

colorer 1.0.4 parameters include:

  -ei<name>  Use input file encoding <name>
  -eo<name>  Use output stream encoding <name>, also viewer encoding in w9x

colorer 1.1.0 does not have these parameters.

Is this change intended? Release notes do not mention this change:
https://github.com/colorer/Colorer-library/releases/tag/v1.1.0

If this change is intended, what is the behaviour now?

  • Automatic recognition of input format?
  • Fixed output format, which one?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.