mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Improve translink macro, fixes 4877 (#7425)
* Improve translink macro Changes: - Change styles to adapt colours to the current palette, instead of hard-coded white inside black box with grey borders. - Simplify the design to a single div (inspired by the Community links on tiddlywiki.com), instead of two nested contrasting divs. Comments: - I found pre-border and pre-background to be the most consistently readable across the default palettes (better than relying on e.g. tiddler-border, tiddler-background, page-background, code-border, code-background). Cupertino Dark, Gruvbox Dark, Nord, Solar Flare, Spartan Day, Spartan Night, Spartan Day, and Twilight have same or very similar pre-border and pre-background colours, so if the macro is nested (translinking a tiddler that contains a translink), the inner frames are not distinguishable, but I think it's an acceptable edge case. - Padding is defined separately for block and inline modes of the macro to make it appear consistent. * Update translink macro Change the `<h1>` styling so that it is only applied to the transcluded tiddler's title and not to any potential `<h1>` in its text. * Update translink macro Change the class-constructing filter so that the empty message is displayed with consistent padding in block mode. * Update translink.tid * Add styles for translink macro to vanilla/base.tid Split `pre` element styling, to allow part of it be reused with `.tc-pre-border` (used by translink macro). Add `.tc-big-bold` class under Other utility classes (used by translink macro). * Update base.tid Add `.tc-big-bold` class under Other utility classes (used by translink macro). * Update translink.tid Update `tc-pre-border` class name to match the one in vanilla/base.tid * Update translink.tid Simplify by always wrapping transclusion in `<p>` element (adjusts padding when inline mode or tiddler missing). * Update translink.tid Localise missing tiddler message (`$:/language/MissingTiddler/Hint`) * Update vanilla/base.tid - Modify class `tc-pre-background`, so that it can be applied to elements other than `pre`. The styling of `pre` remains unchanged, it is only split into two parts, for one part to be reused in the `tc-pre-background` class (used e.g. in translink macro). - Add `tc-big-v-gap` and `tc-big-bold` in the *Other utility classes* section (used e.g. in translink macro). * Update translink.tid Improve styling to depend only on classes specified in vanilla/base.tid * Update base.tid Update class `tc-translink` and CSS selectors to make styling the translink macro easier * Update translink.tid Change the classes of elements, so that changing the style is possible by modifying the stylesheet only * Update base.tid Add selectors to support new inline mode in translink macro * Update translink.tid Change behaviour of the inline mode, now the whole macro is inline, not just the transcluded text. * Update base.tid Fix padding of tc-translink class to account for multiline inline content. * Update base.tid Remove pseudo-element parentheses from inline translink macro * Update translink.tid Add parentheses around inline macro
This commit is contained in:
parent
1af4324370
commit
db6b4f17e8
@ -3,14 +3,26 @@ tags: $:/tags/Macro
|
|||||||
|
|
||||||
\define translink(title,mode:"block")
|
\define translink(title,mode:"block")
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<div style="border:1px solid #ccc; padding: 0.5em; background: black; foreground; white;">
|
<$list filter="[<__mode__>match[block]]">
|
||||||
|
<div class="tc-translink">
|
||||||
|
<div>
|
||||||
<$link to="""$title$""">
|
<$link to="""$title$""">
|
||||||
<$text text="""$title$"""/>
|
<h1><$text text="""$title$"""/></h1>
|
||||||
</$link>
|
</$link>
|
||||||
<div style="border:1px solid #ccc; padding: 0.5em; background: white; foreground; black;">
|
<$transclude tiddler="""$title$""" mode="block">
|
||||||
<$transclude tiddler="""$title$""" mode="$mode$">
|
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
|
||||||
"<$text text="""$title$"""/>" is missing
|
|
||||||
</$transclude>
|
</$transclude>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</$list>
|
||||||
|
<$list filter="[<__mode__>match[inline]]">
|
||||||
|
<span class="tc-translink">
|
||||||
|
<$link to="""$title$""">
|
||||||
|
<$text text="""$title$"""/>
|
||||||
|
</$link>
|
||||||
|
 (<$transclude tiddler="""$title$""" mode="inline">
|
||||||
|
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
|
||||||
|
</$transclude>)
|
||||||
|
</span>
|
||||||
|
</$list>
|
||||||
\end
|
\end
|
||||||
|
@ -3118,6 +3118,30 @@ select {
|
|||||||
background: <<colour select-tag-background>>;
|
background: <<colour select-tag-background>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Translink macro
|
||||||
|
*/
|
||||||
|
|
||||||
|
.tc-translink {
|
||||||
|
background-color: <<colour pre-background>>;
|
||||||
|
border: 1px solid <<colour pre-border>>;
|
||||||
|
padding: 0 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.tc-translink > div {
|
||||||
|
margin: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.tc-translink > div > a:first-child > h1 {
|
||||||
|
font-size: 1.2em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.tc-translink > a:first-child {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Classes for displaying globals
|
** Classes for displaying globals
|
||||||
*/
|
*/
|
||||||
@ -3234,4 +3258,4 @@ select {
|
|||||||
|
|
||||||
.tc-tiny-v-gap-bottom {
|
.tc-tiny-v-gap-bottom {
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user