Comments (12)
Edit. Sorry, wrong pr linked
from markor.
from markor.
testbuilsa of prs are at the github actions tab.
👍 Wow. Much CI. Such technology.
So I tested apk from #2307 and it indeed restored zim format handling
from markor.
Also solved in #2088
That PR is closed a year ago but the issue is a recent regression. I suppose it was introduced about a month or two ago
from markor.
I can confirm that with the latest version Zim files are not detected as Zim any more, just as plaintext.
Zim pages are in fact *.txt, but they start with the "header" lines e.g.
Content-Type: text/x-zim-wiki Wiki-Format: zim 0.6 Creation-Date: 2019-01-14T23:41:51+01:00
Probably this file content check for *.txt was broken somehow, so Markor just treats them as plain text files due to the ending.
If #2307 fixes the issue already, nice! :)
from markor.
@harshad1 I just took a look into #2307 , and if I didn't overlook something, I think it won't fix the issue, unfortunately.
I analyzed the problem a bit (just looked at the Github code via Octodroid on the smartphone, so I didn't test anything), and I think I found the reason for the problem.
It seems that this commit introduced the bug:
f35383a
In Document.java, you removed the if-elseif-Statements with a loop iteration over the newly introduced FormatRegistry.FORMATS:
The problem here is: Just using the lower-case filename fnlower
in isFileOutOfThisFormat(fnlower)
in a generic way is not feasible. In the original code most calls used fnlower
as the argument, but Zim, Embedbinary and Orgmode used getPath()
: isFileOutOfThisFormat(getPath())
. And using the full path of the file is important, because Markor needs it to open the file, look into the content and decide if it contains a Zim header (don't know about the other two formats, but probably they need to be checked somehow too - so there could be similar bugs).
Moreover, the order of the file format checks is important: Originally, plaintext format was only used as fallback if no other format matches before. With the changed code, plaintext is at position 2 and Zim at position 4, so Zim files (ending *.txt just as plaintext) don't have any chance of being matched as Zim.
But like I said, it is necessary to also look into the file contents in addition to checking the line ending to decide if a file is Zim or just an "ordinary" plaintext file, so changing the order is not enough.
from markor.
Ah. You're right. I will fix this today
from markor.
I have this fixed and pushed up in #2307
Please test.
from markor.
@harshad1 Ah I saw that you already changed the order of the formats in a previous commit. 👍
Could work now with the change to the file path instead of just the lower case filename.
I just have my smartphone right now and cannot build the APK for testing, however, and I don't even have an Android dev environment set up on my computer at this time... ^^
But there's a valid Zim page under samples/Zim-Sample-Notebook/Root_Page.txt, so you could check if highlighting works if you open this file.
Maybe also @Self-Perfection could do a test if it works now.
Additionally I found a suspicious line in WikitextTextConverter - but this seems to have been there before in a similar form, so probably not exactly related to the issue here:
return Arrays.asList(new String[]{".wikitext"}).contains(ext);
I don't know what this ".wikitext" string could be - if it is supposed to be a file ending, then it's wrong, there is no such file ending as ".wikitext" in Zim, just ".txt". (The term "Wikitext" in general is not related to Zim in any way and not a good naming for the specific format IMO, but that's a different story.)
from markor.
Sorry, I can not test. Compiling from source code is beyond my capabilities now.
from markor.
Nice to know that the CI pipelines includes test apks. 👍
I tried it out as well and can confirm: the zim format detection works.
from markor.
Marking this done as the fix is in #2307
from markor.
Related Issues (20)
- Automatic backup, encryption of backup files and gui improvement HOT 1
- Swiping on "Move Text Up/Down" buttons triggers them HOT 2
- Support for e-ink devices - disable animation HOT 2
- Crash after creating files with certain extensions HOT 4
- Calendar support with Markwhen or Almanac HOT 5
- File creator no longer remembers the previous file extension HOT 5
- unable to attach/link camera pics HOT 4
- Markdown: Mermaid chart dark mode? HOT 2
- Back button should return to the previous directory instead of the parent directory HOT 4
- Plain text files are interpreted as Markdown by default HOT 1
- View-Mode: Make search match scrolling instant instead of smooth scrolling to it HOT 6
- Crash when creating new note with `zim-wiki-empty.txt` template HOT 3
- Highlight in-search results HOT 2
- Add ability to rename file from inside edit screen HOT 1
- Add Vim Motions HOT 4
- Android SDK/API 34 support, Google denies updates without it HOT 1
- Restore virtual directories for filesystem browsing HOT 2
- Save Inject->Head to file instead SharedPreferences HOT 2
- File browser: Wrong icons and secondary text while scrolling HOT 2
- Crash when tapping new file FAB HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markor.