Hi Joshua, thanks for your reply.

I tried out your suggestion for node.js and although the tiddlers for the 
text-files do get created, the text still won't display.

I created the file tiddlers/text-files/tiddlywiki.files a directory as you 
described, and put the file Text file.txt into the same directory.

Here is the contents of tiddlywiki.files:

{
    "directories": [
        {
            "path": "",
            "filesRegExp": "^.*\\.txt$",
            "isTiddlerFile": false,
            "fields": {
                "title": {"source": "basename-uri-decoded"},
                "created": {"source": "created"},
                "modified": {"source": "modified"},
                "type": "text/plain",
                "tags": ["$:/tags/AttachedFile"],
                "text": "",
                "_canonical_uri": {"source": "filename", "prefix": ""}
            }
        }
    ]
}


The result is that a tiddler for "Text file" does appear in my wiki, but 
still no text is displayed. See here <https://imgur.com/a/U3yKfVK>.

I also tried the same thing but with PDFs and still could not get the 
content to display.

Any idea what I'm doing wrong?


On Monday, 9 November 2020 04:44:49 UTC, Joshua Fontany wrote:
>
> This is possible if you are running your wiki on Node.js. If it is a 
> single-file standalone HTML wiki your best bet is to import the text files 
> by drag'n'drop.
>
> If you are running on Node.js, you can use a "tiddlywiki.files" file 
> (documentation 
> here <https://tiddlywiki.com/#tiddlywiki.files%20Files>), to include a 
> whole folder full of files at once into tiddlywiki. The config file defines 
> the other "meta-data fields" like "type", etc. The folder in question has 
> to be inside said wiki's "tiddlers" folder (where "tiddlers is parallel to 
> a "tiddlywiki.info" config file). Your structure would be similar to:
>
> WikiDir
> |- "tiddlywiki.info" (json file for wiki config)
> |- "tiddlers" dir
>         |- "text-files" dir
>                 |- "tiddlywiki.files" (json file for text-file import 
> config)
>                 |-  all the files to import 
>         |- "other" dirs (in the "tiddlers" dir)
>         |- tiddlers.tid(s) (text tiddlers in the "tiddlers" dir)  
> |- "files" dir (outside "tidders" to serve images and such)
>
>
>
> On Sunday, November 8, 2020 at 5:34:46 PM UTC-8 TW Tones wrote:
>
>> Si,
>>
>> Understood. I have tried to encourage others with more knowledge on this 
>> to help us make such included content interact more within tiddlywiki. I 
>> understand the problem may relate to the object being included in the 
>> standard DOM, but tiddlywiki manages its own DOM tree to preform all it's 
>> magic.
>>
>> keep in mind I am not expert here.
>>
>> A higher level of interaction with html and the standard DOM including 
>> between the DOM and Tiddlywikis own one would be nice, For example an 
>> action that will populate a local tiddler with the content displayed by the 
>> object.
>>
>> I have actually installed full featured html pages within tiddlywiki, and 
>> by providing the additional files, css and scripts in the same directory as 
>> the single file tiddlywiki, have got them working. So I am confident we can 
>> create ways to interact with external resources.
>>
>> Simply being able to save the output of something like;
>> <object width="100%" height="930" data=
>> "file:///C:\Data\batches\networkcheck.txt"></object> 
>> into a tiddler, variable or on wikification would be great.
>>
>> However you would be applying dynannotate to a copy.
>>
>> Regards
>> Tones
>>
>>
>> On Sunday, 8 November 2020 23:58:58 UTC+11, si wrote:
>>>
>>> Hi Tones,
>>>
>>> The HTML object method does display the file, but I can't add 
>>> annotations to with dynannotate.I realize I was not clear about what I 
>>> wanted to use the file for in my original post.
>>>
>>> I'm trying to get the text file to display just as though it were a 
>>> plain text tiddler stored in the wiki. I know I won't be able to edit it 
>>> from the wiki, but I was hoping that I would be able to add annotations 
>>> with dynannotate.
>>>
>>> On Friday, 6 November 2020 22:11:40 UTC, TW Tones wrote:
>>>>
>>>> Si,
>>>>
>>>> Have you tried the html object tag?
>>>>
>>>> I have a newtworkcheck batch that I launch from a TiddlyDesktop wiki, 
>>>> that returns the result in a text file.
>>>>
>>>>
>>>> <a title={{!!tooltip}} href=
>>>> "file:///C:\Data\batches\runnetworkcheck.cmd" > Go</a>
>>>>
>>>> <$button set="Networkcheck!!last-refresh" setTo=<<now "0hh:0mm">> >
>>>> Refresh {{Networkcheck!!last-refresh}}
>>>> </$button>
>>>>
>>>> <object width="100%" height="930" data=
>>>> "file:///C:\Data\batches\networkcheck.txt"></object> 
>>>>
>>>> It also has a button that sets a field to cause a refresh and time 
>>>> stamps it.
>>>>
>>>> Tones
>>>>
>>>>
>>>> On Saturday, 7 November 2020 05:21:09 UTC+11, si wrote:
>>>>>
>>>>> I have some external source-code files that I would like to add to my 
>>>>> wiki as plain text so that I can make notes on them.
>>>>>
>>>>> Rather than making another copy of the text, I thought I would be able 
>>>>> to embed the file as I would a PDF or HTML file.
>>>>>
>>>>> I set _canonical_uri to ./folder/code.py and changed the type to 
>>>>> text/plain. This didn't work.
>>>>>
>>>>> I noticed that if I change the type to text/html, the text does get 
>>>>> embedded as though it were an html file.
>>>>>
>>>>> Is there any way to embed text and have it appear as regular plain 
>>>>> text?
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/55878545-2746-4ec3-942c-a8c05b083c49o%40googlegroups.com.

Reply via email to