* NEW: Some cosmetic fixes.
* NEW: Implement the read-only view mode.
* BUG: Correctly handle current language in links.

[GB.MARKDOWN]
* NEW: The [[ ... ]] syntax now uses the "table" class by default for the 
  <table> markup.


git-svn-id: svn://localhost/gambas/trunk@6170 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-02-21 23:33:07 +00:00
parent 5caf76d001
commit 960ddb4c14
8 changed files with 66 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

View file

@ -58,7 +58,7 @@ PRE HR {
border-top: solid #C0C0C0 1px; border-top: solid #C0C0C0 1px;
} }
TABLE { TABLE.table {
border-bottom: solid #A0A0A0 1px; border-bottom: solid #A0A0A0 1px;
border-right: solid #A0A0A0 1px; border-right: solid #A0A0A0 1px;
padding: 0px; padding: 0px;
@ -67,14 +67,14 @@ TABLE {
empty-cells: show; empty-cells: show;
} }
TABLE TD { TABLE.table > TBODY > TR > TD {
border-top: solid #A0A0A0 1px; border-top: solid #A0A0A0 1px;
border-left: solid #A0A0A0 1px; border-left: solid #A0A0A0 1px;
padding: 3px 6px; padding: 3px 6px;
vertical-align: top; vertical-align: top;
} }
TABLE TH { TABLE.table > TBODY > TR > TH {
border-top: solid #A0A0A0 1px; border-top: solid #A0A0A0 1px;
border-left: solid #A0A0A0 1px; border-left: solid #A0A0A0 1px;
padding: 3px 6px; padding: 3px 6px;
@ -120,6 +120,14 @@ TABLE.example TH {
color: white; color: white;
} }
.title-v {
font-size: 75%;
}
.title-v A {
color: gray;
}
.login { .login {
position: absolute; position: absolute;
display: inline-table; display: inline-table;
@ -138,6 +146,10 @@ TABLE.example TH {
padding-top: 24px; padding-top: 24px;
} }
.page-v {
padding: 4px 8px;
}
.unknown { .unknown {
color: red; color: red;
font-style: italic; font-style: italic;
@ -264,8 +276,11 @@ DIV.syntax {
white-space: pre; white-space: pre;
} }
DIV.syntax > P { DIV.syntax > P:first-child {
margin-top: -1em; margin-top: -1em;
}
DIV.syntax > P:last-child {
margin-bottom: -1em; margin-bottom: -1em;
} }
@ -317,3 +332,7 @@ DIV.index {
padding-right: 32px; padding-right: 32px;
margin-top: 1em; margin-top: 1em;
} }
.symbol {
color: black;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

View file

@ -16,17 +16,31 @@ Public Path As String
Public Exist As Boolean Public Exist As Boolean
Public Edit As Boolean Public Edit As Boolean
Public Image As Boolean Public Image As Boolean
Public LinkSuffix As String
Public Component As String Public Component As String
Public Class As String Public Class As String
Public Symbol As String Public Symbol As String
Private Sub AddLinkSuffix(sReq As String)
If LinkSuffix Then
LinkSuffix &= "&"
Else
LinkSuffix = "?"
Endif
LinkSuffix &= sReq
End
Public Sub SetLanguage(sLang As String) Public Sub SetLanguage(sLang As String)
Dim iLang As Integer Dim iLang As Integer
Lang = sLang Lang = sLang
If Not Lang Then Lang = DEFAULT_LANG
If Not Lang Then Lang = DEFAULT_LANG
iLang = Languages.Find(Lang) iLang = Languages.Find(Lang)
If iLang >= 0 Then If iLang >= 0 Then
System.Language = SystemLanguages[iLang] System.Language = SystemLanguages[iLang]
@ -34,6 +48,8 @@ Public Sub SetLanguage(sLang As String)
Lang = DEFAULT_LANG Lang = DEFAULT_LANG
Endif Endif
If Lang <> DEFAULT_LANG Then AddLinkSuffix("l=" & sLang)
End End
Public Sub GetPagePath(Optional bSuffix As Boolean) As String Public Sub GetPagePath(Optional bSuffix As Boolean) As String
@ -161,6 +177,7 @@ Public Sub Main()
Endif Endif
SetLanguage(Request["l"]) SetLanguage(Request["l"])
If Request.Exist("v") Then AddLinkSuffix("v")
If Request.Exist("logout") Then If Request.Exist("logout") Then

View file

@ -19,7 +19,7 @@ Private Sub _PrintLink()
aPath = Split(Main.Path, "/", "", True) aPath = Split(Main.Path, "/", "", True)
For Each sElt In aPath For Each sElt In aPath
sPath &= "/" & sElt sPath &= "/" & sElt
Print "<a href=\""; Application.Root &/ sPath; "\">"; "/"; sElt; "</a>"; Print "<a href=\""; Application.Root &/ sPath; Main.LinkSuffix; "\">"; "/"; sElt; "</a>";
Next Next
End End
@ -59,7 +59,8 @@ Private Sub _PrintPage()
If iPos = 0 Then iPos = Len(sData) If iPos = 0 Then iPos = Len(sData)
sData = Mid$(sData, iPos + 1) sData = Mid$(sData, iPos + 1)
Endif Endif
sData = "# " & Main.GetSymbolTitle() & sData 'sData = "# <a href=\"" & Application.Root &/ File.Dir(Main.Path) & "\" class=\"symbol\">" & Html(Main.GetSymbolTitle()) & "</a>\n" & sData
sData = "# " & Main.GetSymbolTitle() & "\n" & sData
Endif Endif
Print WikiMarkdown.ToHTML(sData); Print WikiMarkdown.ToHTML(sData);
@ -71,12 +72,12 @@ End
Private Sub _PrintParent() Private Sub _PrintParent()
Dim sPath As String 'Dim sPath As String
sPath = Request.Path 'sPath = Request.Path
If sPath Then sPath = File.Dir(sPath) 'If sPath Then sPath = File.Dir(sPath)
Print Application.Root &/ sPath; 'Print Application.Root &/ sPath; Main.LinkSuffix;
If Main.Lang <> Main.DEFAULT_LANG Then Print "?l="; Main.Lang; Print Application.Root; Main.LinkSuffix;
End End

View file

@ -13,6 +13,17 @@
<form name="form" method="post" enctype="multipart/form-data"> <form name="form" method="post" enctype="multipart/form-data">
<%If Request.Exist("v") Then%>
<div class="page-v">
<table border="0" cellpadding="0" cellspacing="0" style="margin-bottom:-1em;">
<tr valign="center"><td><a href="<%_PrintParent()%>"><img src="<%/%>/up-gray.png"></a>&nbsp;</td>
<td><div class="title-v"><%_PrintLink%></div></td></tr>
</table>
<%Else%>
<div class="header"> <div class="header">
<div class="up"> <div class="up">
<%If Main.Edit%> <%If Main.Edit%>
@ -63,6 +74,9 @@
<%Endif%> <%Endif%>
<div class="page"> <div class="page">
<%Endif%>
<%If Main.Edit Then%> <%If Main.Edit Then%>
<%If Main.Image Then%> <%If Main.Image Then%>
<div style="margin-top:32px;"></div> <div style="margin-top:32px;"></div>

View file

@ -8,7 +8,7 @@ Public Sub Link(hLink As MarkdownLink)
Dim sLink As String = hLink.Link Dim sLink As String = hLink.Link
Dim iPos As Integer Dim iPos As Integer
If Main.Lang <> Main.DEFAULT_LANG Then hLink.Query = "l=" & Main.Lang hLink.Query = Mid$(Main.LinkSuffix, 2)
If sLink Begins "/" Then If sLink Begins "/" Then
sPath = sLink sPath = sLink
@ -31,7 +31,7 @@ Public Sub Link(hLink As MarkdownLink)
If Not hLink.Text Or If hLink.Text = hLink.Link Then If Not hLink.Text Or If hLink.Text = hLink.Link Then
If Main.IsImage(sPath) Then If Main.IsImage(sPath) Then
hLink.Html = "<img src=\"" & Application.Root &/ sPath & "?v" & If(Main.Lang <> Main.DEFAULT_LANG, "&l=" & Main.Lang, "") & "\" />" hLink.Html = "<img src=\"" & Application.Root &/ sPath & "?v" & "\" />"
Return Return
Endif Endif

View file

@ -292,7 +292,7 @@ Private Sub ConvertMarkup(aLine As String[], Optional bDoNotSetLine As Boolean)
If aCommand Then aResult.Insert(aCommand) If aCommand Then aResult.Insert(aCommand)
aResult.Add("<table class=\"" & sLine & "\">") aResult.Add("<table class=\"" & sLine & "\">")
Else Else
aResult.Add("<table>") aResult.Add("<table class=\"table\">")
Endif Endif
aResult.Add("<tr><th>") aResult.Add("<tr><th>")
bIgnorePar = False bIgnorePar = False