Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Missing <pre> on some preformatted text blocks #118

Closed
brennen opened this issue May 30, 2021 · 3 comments
Closed

Missing <pre> on some preformatted text blocks #118

brennen opened this issue May 30, 2021 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@brennen
Copy link

brennen commented May 30, 2021

At 5443ff1.

As a summary: I've got some scripting to execute shell inline and pull in the results.

{{{exec-raw echo foo
foo
}}}

This is kind of edge case - the docs just specify stuff after the {{{ as "extra information", and in practice the vimscript implementation just drops it into the HTML after escaping entities, while the vim plugin itself treats it (or the last word in it?) as a filetype hint for syntax highlighting. That is: This might be my problem to fix; I'm overloading ill-defined behavior to suit a customization.

Still, I'd probably expect a <pre> tag here, maybe just one with <pre class="exec-raw echo foo"> or something based on how it behaves for a simpler case like {{{php?

Input:

This sets up an index used by [[file:~/.vimrc]]'s `dictionary` option:

{{{exec-raw cd ~/notes && make indices
sqlite3 metadata.db 'SELECT page FROM pages WHERE page NOT LIKE "log/%" AND page NOT LIKE "diary/%"' > vimwiki-index
pinboard tags | sort > pinboard-tag-index
sort vimwiki-index pinboard-tag-index | uniq > tag-index
wc -l tag-index
5230 tag-index
}}}

Check:

{{{exec-raw cd ~/notes && sqlite3 ~/notes/metadata.db 'select count(*) from pages; select count(*) from links;'
4515
19540
}}}

vimwiki-rs output:

<p>This sets up an index used by <a href="~/.vimrc.html">file:~/.vimrc</a>&#x27;s <code>dictionary</code> option:</p>
<p>{{{exec-raw cd ~/notes &amp;&amp; make indices pinboard tags | sort &gt; pinboard-tag-index sort vimwiki-index pinboard-tag-index | uniq &gt; tag-index wc -l tag-index 5040 tag-index }}}</p>
<p>Check:</p>
<p>{{{exec-raw cd ~/notes &amp;&amp; sqlite3 ~/notes/metadata.db &#x27;select count(<span id="scripts-) from pages; select count("></span><strong>) from pages; select count(</strong>) from links;&#x27; 3926 16531 }}}</p>

vimscript output:

<p>
This sets up an index used by <a href="/home/brennen/.vimrc">file:~/.vimrc</a>'s <code>dictionary</code> option:
</p>

<pre exec-raw cd ~/notes &amp;&amp; make indices>
pinboard tags | sort &gt; pinboard-tag-index
sort vimwiki-index pinboard-tag-index | uniq &gt; tag-index
wc -l tag-index
5040 tag-index
</pre>

<p>
Check:
</p>

<pre exec-raw cd ~/notes &amp;&amp; sqlite3 ~/notes/metadata.db 'select count(*) from pages; select count(*) from links;'>
3926
16531
</pre>
@chipsenkbeil chipsenkbeil added the bug Something isn't working label May 30, 2021
@chipsenkbeil chipsenkbeil added this to To do in vimwiki-core via automation May 30, 2021
@chipsenkbeil chipsenkbeil added this to the 0.1 milestone May 30, 2021
@chipsenkbeil
Copy link
Owner

I wasn't aware that this was a format acceptable for vimwiki code blocks. The
reason it isn't outputting <pre> is because the parser doesn't recognize it
as such.

Not that this would make much sense to you, but this is the parser for the start of a code block. It assumes {{{lang?( key="value")*.

@brennen
Copy link
Author

brennen commented May 30, 2021

I wasn't aware that this was a format acceptable for vimwiki code blocks. The reason it isn't outputting <pre> is because the parser doesn't recognize it as such.

That's probably reasonable. The behavior could probably stand to be better defined in the plugin and docs, but I'm essentially just wedging something into a corner case of the implementation. (It's possible a few others are doing something similar following my example, but it's never been an official thing.) I wouldn't worry about this one much; I can adjust accordingly.

Anyway, something like

{{{language exec="foo"
}}}

...wouldn't be quite as concise, but it has the advantage of being more explicit.

@brennen brennen closed this as completed May 30, 2021
vimwiki-core automation moved this from To do to Done May 30, 2021
@chipsenkbeil
Copy link
Owner

@brennen you should be able to do it without a language as the language itself is optional.

{{{exec="foo"
}}}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
vimwiki-core
  
Done
Development

No branches or pull requests

2 participants