如何检查 Star Basic 中损坏的内部链接?

2024-02-16

我正在为 LibreOffice Writer 创建一个基本宏来检查损坏的内部链接。简而言之:

  • 生成所有锚点的列表
  • 循环浏览文档,查找内部超链接
  • 如果内部超链接不在锚点列表中,则打开它进行编辑(然后停止)

我的代码有一些未解决的问题:

  1. (within fnBuildAnchorList)我们如何获得每个标题的编号?例如,如果第一个 1 级标题文本是“Introduction”,则正确的锚点是#1.Introduction|outline我们正在录制Introduction|outline
  2. (within subInspectLink)我们如何正确测试标题的超链接?我注意到,当我手动点击标题链接时,当编号相同时就会成功,but also当文本相同时。
    例如如果有内部链接#1.My first heading|outline,可以通过超链接到达#1.Previous header name|outline but also与超链接#2.3.5.My first heading|outline
  3. (within subInspectLink)我们如何打开一个specific用于编辑的超链接?我们是否将参数传递给.uno:EditHyperlink?我们移动光标吗? (我发现的所有动作都是相对的,例如.uno:GoRight)我们使用文本部分吗?.Start and .End特性?
REM  *****  BASIC  *****
Option Explicit


' PrintArray displays a MsgBox with the whole array
' for DEBUG purposes only
Sub subPrintArray(sTitle as String, theArray() as String)
    Dim sArray
    sArray = sTitle & ":" & Chr(13) & Join(theArray,Chr(13))
    MsgBox(sArray, 64, "***DEBUG")
End sub

' auxiliary sub for BuildAnchorList
Sub subAddItemToAnchorList (oAnchors() as String, sTheAnchor as String, sType as String)
    Dim sAnchor
    Select Case sType
        Case "Heading":
            sAnchor = sTheAnchor + "|outline"
        Case "Table":
            sAnchor = sTheAnchor + "|table"
        Case "Text Frame":
            sAnchor = sTheAnchor + "|frame"
        Case "Image":
            sAnchor = sTheAnchor + "|graphic"
        Case "Object":
            sAnchor = sTheAnchor + "|ole"
        Case "Section":
            sAnchor = sTheAnchor + "|region"
        Case "Bookmark":
            sAnchor = sTheAnchor
    End Select
    ReDim Preserve oAnchors(UBound(oAnchors)+1) as String
    oAnchors(UBound(oAnchors)) = sAnchor
End Sub

' auxiliary sub for BuildAnchorList
Sub subAddArrayToAnchorList (oAnchors() as String, oNewAnchors() as String, sType as String)
    Dim i, iStart, iStop
    iStart = LBound(oNewAnchors)
    iStop = UBound(oNewAnchors)
    If iStop < iStart then Exit Sub ' empty array, nothing to do
    For i = iStart to iStop
        subAddItemToAnchorList (oAnchors, oNewAnchors(i), sType)
    Next
End Sub

Function fnBuildAnchorList()
    Dim oDoc as Object, oAnchors() as String
    oDoc = ThisComponent

    ' get the whole document outline
    Dim oParagraphs, thisPara, oTextPortions, thisPortion
    oParagraphs = oDoc.Text.createEnumeration ' all the paragraphs
    Do While oParagraphs.hasMoreElements
        thisPara = oParagraphs.nextElement
        If thisPara.ImplementationName = "SwXParagraph" then ' is a paragraph
            If thisPara.OutlineLevel>0 Then ' is a heading
                ' ***
                ' *** TO DO: How do we get the numbering for each heading?
                ' For example, if the first level 1 heading text is “Introduction”,
                ' the correct anchor is `#1.Introduction|outline`
                ' and we are recording `Introduction|outline`
                ' ***
                subAddItemToAnchorList (oAnchors, thisPara.String, "Heading")
            End if
        End if
    Loop
    ' text tables, text frames, images, objects, bookmarks and text sections
    subAddArrayToAnchorList(oAnchors, oDoc.getTextTables().ElementNames, "Table")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextFrames().ElementNames, "Text Frame")
    subAddArrayToAnchorList(oAnchors, oDoc.getGraphicObjects().ElementNames, "Image")
    subAddArrayToAnchorList(oAnchors, oDoc.getEmbeddedObjects().ElementNames, "Object")
    subAddArrayToAnchorList(oAnchors, oDoc.Bookmarks.ElementNames, "Bookmark")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextSections().ElementNames, "Section")

    fnBuildAnchorList = oAnchors
End Function

Function fnIsInArray( theString as String, theArray() as String )
    Dim i as Integer, iStart as Integer, iStop as Integer
    iStart = LBound(theArray)
    iStop = UBound(theArray)
    If iStart<=iStop then
        For i = iStart to iStop
            If theString = theArray(i) then
                fnIsInArray = True
                Exit function
            End if
        Next
    End if
    fnIsInArray = False
End function

Function fnIsOutlineInArray ( theString as String, theArray() as String )
    Dim i as Integer
    For i = LBound(theArray) to UBound(theArray)
        If theArray(i) = Right(theString,Len(theArray(i))) then
            fnIsOutlineInArray = True
            Exit function
        End if
    Next
    fnIsOutlineInArray = False
End function

' auxiliary function to FindBrokenInternalLinks
' inspects any links inside the current document fragment
' used to have an enumeration inside an enumeration, per OOo examples,
' but tables don't have .createEnumeration
Sub subInspectLinks( oAnchors as Object, oFragment as Object, iFragments as Integer, iLinks as Integer )
    Dim sMsg, sImplementation, thisPortion
    sImplementation = oFragment.implementationName
    Select Case sImplementation

        Case "SwXParagraph":
            ' paragraphs can be enumerated
            Dim oParaPortions, sLink, notFound
            oParaPortions = oFragment.createEnumeration
            ' go through all the text portions in current paragraph
            While oParaPortions.hasMoreElements
                thisPortion = oParaPortions.nextElement
                iFragments = iFragments + 1
                If Left(thisPortion.HyperLinkURL, 1) = "#" then
                    ' internal link found: get it all except initial # character
                    iLinks = iLinks + 1
                    sLink = right(thisPortion.HyperLinkURL, Len(thisPortion.HyperLinkURL)-1)
                    If Left(sLink,14) = "__RefHeading__" then
                        ' link inside a table of contents, no need to check
                        notFound = False
                    Elseif Right(sLink,8) = "|outline" then
                        ' special case for outline: since we don't know how to get the
                        ' outline numbering, we have to match the right most part of the
                        ' link only
                        notFound = not fnIsOutlineInArray(sLink, oAnchors)
                    Else
                        notFound = not fnIsInArray(sLink, oAnchors)
                    End if
                    If notFound then
                        ' anchor not found
                        ' *** DEBUG: code below up to MsgBox
                        sMsg = "Fragment #" & iFragments & ", internal link #" & iLinks & Chr(13) _
                            & "Bad link: [" & thisPortion.String & "] -> [" _
                            & thisPortion.HyperLinkURL & "] " & Chr(13) _
                            & "Paragraph:" & Chr(13) & oFragment.String & Chr(13) _
                            & "OK to continue, Cancel to stop"
                        Dim iChoice as Integer
                        iChoice = MsgBox (sMsg, 48+1, "Find broken internal link")
                        If iChoice = 2 Then End
                        ' ***
                        ' *** TO DO: How do we open a _specific_ hyperlink for editing?
                        ' Do we pass parameters to `.uno:EditHyperlink`?
                        ' Do we move the cursor? (Except all moves I found were relative,
                        ' e.g. `.uno:GoRight`)
                        ' Do we use the text portion’s `.Start` and `.End` properties?
                        ' ***
                    End If
                End if
            Wend
            ' *** END paragraph

        Case "SwXTextTable":
            ' text tables have cells
            Dim i, eCells, thisCell, oCellPortions
            eCells = oFragment.getCellNames()
            For i = LBound(eCells) to UBound(eCells)
                thisCell = oFragment.getCellByName(eCells(i))
                oCellPortions = thisCell.createEnumeration
                    While oCellPortions.hasMoreElements
                        thisPortion = oCellPortions.nextElement
                        iFragments = iFragments + 1
                        ' a table cell may contain a paragraph or another table,
                        ' so call recursively
                        subInspectLinks (oAnchors, thisPortion, iFragments, iLinks)
                    Wend
'               xray thisPortion
                'SwXCell has .String
            Next
            ' *** END text table

        Case Else
            sMsg = "Implementation method '" & sImplementation & "' not covered by regular code." _
                & "OK to continue, Cancel to stop"
            If 2 = MsgBox(sMsg, 48+1) then End
            ' uses xray for element inspection; if not available, comment the two following lines
            BasicLibraries.loadLibrary("XrayTool")
            xray oFragment
            ' *** END unknown case

    End Select
End sub

Sub FindBrokenInternalLinks
    ' Find the next broken internal link
    '
    ' Pseudocode:
    '
    ' * generate link of anchors - *** TO DO: prefix the outline numbering for headings
    ' * loop, searching for internal links
    '     - is the internal link in the anchor list?
    '         * Yes: continue to next link
    '         * No: (broken link found)
    '             - select that link text - *** TO DO: cannot select it
    '             - open link editor so user can fix this
    '             - stop
    ' * end loop
    ' * display message "No bad internal links found"

    Dim oDoc as Object, oFragments as Object, thisFragment as Object
    Dim iFragments as Integer, iLinks as Integer, sMsg as String
    Dim oAnchors() as String ' list of all anchors in the document
'   Dim sMsg ' for MsgBox

    oDoc = ThisComponent

    ' get all document anchors
    oAnchors = fnBuildAnchorList()
'   subPrintArray("Anchor list", oAnchors) ' *** DEBUG ***
'   MsgBox( UBound(oAnchors)-LBound(oAnchors)+1 & " anchors found – stand by for checking")

    ' find links    
    iFragments = 0 ' fragment counter
    iLinks = 0     ' internal link counter
    oFragments = oDoc.Text.createEnumeration ' has all the paragraphs
    While oFragments.hasMoreElements
        thisFragment = oFragments.nextElement
        iFragments = iFragments + 1
        subInspectLinks (oAnchors, thisFragment, iFragments, iLinks)
    Wend
    If iLinks then
        sMsg = iLinks & " internal links found, all good"
    Else
        sMsg = "This document has no internal links"
    End if
    MsgBox (sMsg, 64, "Find broken internal link")

End Sub

' *** END FindBrokenInternalLinks ***

您可以使用任何带有标题的文档来检查第一期 - 将弹出一个包含所有锚点的消息框,您将看到缺少的大纲编号。

第二个问题需要一个内部链接错误的文档。


查看cOOol http://free-electrons.com/blog/coool/。你可以使用这个 而不是创建宏, 或者从代码中借用一些概念。

测试链接(可能使用.uno:JumpToMark)似乎没有帮助, 因为内部链接总是会去某处即使目标不存在。 相反,按照您的建议构建有效目标的列表。

为了保存有效目标的列表,cOOol 代码使用 Python 集。 如果你想使用Basic,那么数据结构就受到更多限制。 但是,可以通过声明一个新的 a 来完成收藏 https://msdn.microsoft.com/en-us/library/aa231021(v=vs.60).aspx目的 或者通过使用基本数组,也许可以使用ReDim.

另请查看 cOOol 代码如何定义有效的目标字符串。例如:

internal_targets.add('0.' * heading_level + data + '|outline')            

要打开超链接对话框,请选择超链接文本,然后调用:

dispatcher.executeDispatch(document, ".uno:EditHyperlink", "", 0, Array())

EDIT:

好的,我为此工作了几个小时并得出了以下代码:

REM  *****  BASIC  *****
Option Explicit


' PrintArray displays a MsgBox with the whole array
' for DEBUG purposes only
Sub subPrintArray(sTitle as String, theArray() as String)
    Dim sArray
    sArray = sTitle & ":" & Chr(13) & Join(theArray,Chr(13))
    MsgBox(sArray, 64, "***DEBUG")
End sub

' auxiliary sub for BuildAnchorList
Sub subAddItemToAnchorList (oAnchors() as String, sTheAnchor as String, sType as String)
    Dim sAnchor
    Select Case sType
        Case "Heading":
            sAnchor = sTheAnchor + "|outline"
        Case "Table":
            sAnchor = sTheAnchor + "|table"
        Case "Text Frame":
            sAnchor = sTheAnchor + "|frame"
        Case "Image":
            sAnchor = sTheAnchor + "|graphic"
        Case "Object":
            sAnchor = sTheAnchor + "|ole"
        Case "Section":
            sAnchor = sTheAnchor + "|region"
        Case "Bookmark":
            sAnchor = sTheAnchor
    End Select
    ReDim Preserve oAnchors(UBound(oAnchors)+1) as String
    oAnchors(UBound(oAnchors)) = sAnchor
End Sub

' auxiliary sub for BuildAnchorList
Sub subAddArrayToAnchorList (oAnchors() as String, oNewAnchors() as String, sType as String)
    Dim i, iStart, iStop
    iStart = LBound(oNewAnchors)
    iStop = UBound(oNewAnchors)
    If iStop < iStart then Exit Sub ' empty array, nothing to do
    For i = iStart to iStop
        subAddItemToAnchorList (oAnchors, oNewAnchors(i), sType)
    Next
End Sub

' Updates outlineLevels for the current level.
' Returns a string like "1.2.3"
Function fnGetOutlinePrefix(outlineLevel as Integer, outlineLevels() as Integer)
    Dim level as Integer, prefix as String
    outlineLevels(outlineLevel) = outlineLevels(outlineLevel) + 1
    For level = outlineLevel + 1 to 9
        ' Reset all lower levels.
        outlineLevels(level) = 0
    Next
    prefix = ""
    For level = 0 To outlineLevel
        prefix = prefix & outlineLevels(level) & "."
    Next
    fnGetOutlinePrefix = prefix
End Function

Function fnBuildAnchorList()
    Dim oDoc as Object, oAnchors() as String, anchorName as String
    Dim level as Integer, levelCounter as Integer
    Dim outlineLevels(10) as Integer
    For level = 0 to 9
        outlineLevels(level) = 0
    Next
    oDoc = ThisComponent

    ' get the whole document outline
    Dim oParagraphs, thisPara, oTextPortions, thisPortion
    oParagraphs = oDoc.Text.createEnumeration ' all the paragraphs
    Do While oParagraphs.hasMoreElements
        thisPara = oParagraphs.nextElement
        If thisPara.ImplementationName = "SwXParagraph" then ' is a paragraph
            If thisPara.OutlineLevel>0 Then ' is a heading
                level = thisPara.OutlineLevel - 1
                anchorName = fnGetOutlinePrefix(level, outlineLevels) & thisPara.String
                subAddItemToAnchorList (oAnchors, anchorName, "Heading")
            End if
        End if
    Loop
    ' text tables, text frames, images, objects, bookmarks and text sections
    subAddArrayToAnchorList(oAnchors, oDoc.getTextTables().ElementNames, "Table")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextFrames().ElementNames, "Text Frame")
    subAddArrayToAnchorList(oAnchors, oDoc.getGraphicObjects().ElementNames, "Image")
    subAddArrayToAnchorList(oAnchors, oDoc.getEmbeddedObjects().ElementNames, "Object")
    subAddArrayToAnchorList(oAnchors, oDoc.Bookmarks.ElementNames, "Bookmark")
    subAddArrayToAnchorList(oAnchors, oDoc.getTextSections().ElementNames, "Section")

    fnBuildAnchorList = oAnchors
End Function

Function fnIsInArray( theString as String, theArray() as String )
    Dim i as Integer
    For i = LBound(theArray()) To UBound(theArray())
        If theString = theArray(i) Then
            fnIsInArray = True
            Exit function
        End if
    Next
    fnIsInArray = False
End function

' Open a _specific_ hyperlink for editing.
Sub subEditHyperlink(textRange as Object)
    Dim document As Object
    Dim dispatcher As Object
    Dim oVC As Object

    oVC = ThisComponent.getCurrentController().getViewCursor()
    oVC.gotoRange(textRange.getStart(), False)
    document = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    dispatcher.executeDispatch(document, ".uno:EditHyperlink", "", 0, Array())
End Sub

' auxiliary function to FindBrokenInternalLinks
' inspects any links inside the current document fragment
' used to have an enumeration inside an enumeration, per OOo examples,
' but tables don't have .createEnumeration
Sub subInspectLinks(oAnchors() as String, oFragment as Object, iFragments as Integer, iLinks as Integer, iBadLinks as Integer)
    Dim sMsg, sImplementation, thisPortion
    sImplementation = oFragment.implementationName
    Select Case sImplementation

        Case "SwXParagraph":
            ' paragraphs can be enumerated
            Dim oParaPortions, sLink, notFound
            oParaPortions = oFragment.createEnumeration
            ' go through all the text portions in current paragraph
            While oParaPortions.hasMoreElements
                thisPortion = oParaPortions.nextElement
                iFragments = iFragments + 1
                If Left(thisPortion.HyperLinkURL, 1) = "#" then
                    ' internal link found: get it all except initial # character
                    iLinks = iLinks + 1
                    sLink = right(thisPortion.HyperLinkURL, Len(thisPortion.HyperLinkURL)-1)
                    If Left(sLink,14) = "__RefHeading__" then
                        ' link inside a table of contents, no need to check
                        notFound = False
                    Else
                        notFound = not fnIsInArray(sLink, oAnchors)
                    End if
                    If notFound then
                        ' anchor not found
                        ' *** DEBUG: code below up to MsgBox
                        iBadLinks = iBadLinks + 1
                        sMsg = "Fragment #" & iFragments & ", internal link #" & iLinks & Chr(13) _
                            & "Bad link: [" & thisPortion.String & "] -> [" _
                            & thisPortion.HyperLinkURL & "] " & Chr(13) _
                            & "Paragraph:" & Chr(13) & oFragment.String & Chr(13) _
                            & "Yes to edit link, No to continue, Cancel to stop"
                        Dim iChoice as Integer
                        iChoice = MsgBox (sMsg, MB_YESNOCANCEL + MB_ICONEXCLAMATION, _
                            "Find broken internal link")
                        If iChoice = IDCANCEL Then
                            End
                        ElseIf iChoice = IDYES Then
                            subEditHyperlink(thisPortion)
                        End If
                    End If
                End if
            Wend
            ' *** END paragraph

        Case "SwXTextTable":
            ' text tables have cells
            Dim i, eCells, thisCell, oCellPortions
            eCells = oFragment.getCellNames()
            For i = LBound(eCells) to UBound(eCells)
                thisCell = oFragment.getCellByName(eCells(i))
                oCellPortions = thisCell.createEnumeration
                    While oCellPortions.hasMoreElements
                        thisPortion = oCellPortions.nextElement
                        iFragments = iFragments + 1
                        ' a table cell may contain a paragraph or another table,
                        ' so call recursively
                        subInspectLinks (oAnchors, thisPortion, iFragments, iLinks)
                    Wend
'               xray thisPortion
                'SwXCell has .String
            Next
            ' *** END text table

        Case Else
            sMsg = "Implementation method '" & sImplementation & "' not covered by regular code." _
                & "OK to continue, Cancel to stop"
            If 2 = MsgBox(sMsg, 48+1) then End
            ' uses xray for element inspection; if not available, comment the two following lines
            BasicLibraries.loadLibrary("XrayTool")
            xray oFragment
            ' *** END unknown case

    End Select
End sub

Sub FindBrokenInternalLinks
    ' Find the next broken internal link
    '
    ' Pseudocode:
    '
    ' * generate link of anchors - *** TO DO: prefix the outline numbering
    ' *  for headings loop, searching for internal links
    '     - is the internal link in the anchor list?
    '         * Yes: continue to next link
    '         * No: (broken link found)
    '             - select that link text - *** TO DO: cannot select it
    '             - open link editor so user can fix this
    '             - stop
    ' * end loop
    ' * display message "No bad internal links found"

    Dim oDoc as Object, oFragments as Object, thisFragment as Object
    Dim iFragments as Integer, iLinks as Integer, iBadLinks as Integer, sMsg as String
    Dim oAnchors() as String ' list of all anchors in the document

    oDoc = ThisComponent

    ' get all document anchors
    oAnchors = fnBuildAnchorList()
'   subPrintArray("Anchor list", oAnchors) ' *** DEBUG ***
'   MsgBox( UBound(oAnchors)-LBound(oAnchors)+1 & " anchors found – stand by for checking")

    ' find links    
    iFragments = 0 ' fragment counter
    iLinks = 0     ' internal link counter
    iBadLinks = 0
    oFragments = oDoc.Text.createEnumeration ' has all the paragraphs
    While oFragments.hasMoreElements
        thisFragment = oFragments.nextElement
        iFragments = iFragments + 1
        subInspectLinks (oAnchors, thisFragment, iFragments, iLinks, iBadLinks)
    Wend
    If iBadLinks > 0 Then
        sMsg = iBadLinks & " bad link(s), " & iLinks - iBadLinks & " good link(s)"
    ElseIf iLinks Then
        sMsg = iLinks & " internal link(s) found, all good"
    Else
        sMsg = "This document has no internal links"
    End if
    MsgBox (sMsg, 64, "Find broken internal link")

End Sub

' *** END FindBrokenInternalLinks ***

现在它检查大纲编号。也许它太严格了——也许有一个关闭大纲数字检查的选项会很好。

就问题 3 而言,此代码现在打开正确的编辑链接(只要在消息框中单击“是”)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何检查 Star Basic 中损坏的内部链接? 的相关文章

  • Facebook 分享“可点击”网址链接问题

    我在 Facebook 中遇到可点击 url 链接的问题 正如您所看到的 nr 1 不可点击 但 nr 2 和 3 可以点击 有时它是可点击的 有时则不可点击 随机 我想要的是所有共享链接都不像 nr 1 那样 可点击 我怎样才能解决这个问
  • 什么是 href="#" 以及为什么使用它?

    在许多网站上我看到链接href 这是什么意思 它是干什么用的 关于超链接 锚标签的主要用途 a a 是作为超链接 http www w3 org MarkUp html spec html spec 7 html 这基本上意味着他们会带你去
  • 在特定选项卡中打开链接 - 来自电子邮件

    我的网站上有一个注册系统 它使用常见的激活电子邮件技巧 这封电子邮件仅包含说明和我网站上激活页面的链接 因此 假设我在该网站上注册 打开一个新选项卡来检查我的电子邮件 然后单击该链接 该链接将在另一个新选项卡中打开 从而导致该网站上打开两个
  • 确定 onclick 时单击的链接是否要打开新窗口或选项卡

    大多数现代浏览器都支持这些命令ctrl click or command click或类似于在新选项卡或新窗口中打开链接 在应用程序中 我希望在单击时禁用链接 但前提是目标是同一个窗口 例如 如果它在新选项卡中打开 我不希望链接被禁用 因为
  • src 中访问不同目录中文件的路径

    我有一个名为projects其中我有一个game文件夹和一个engine文件夹 我有我的engine js文件内的engine文件夹 我想知道我是否可以用我的game html像这样从其他文件夹中获取文件 现在 显然上面的方法不起作用 但我
  • 链接到外部 css 文件

    我一直在尝试将我在本地计算机中创建的 css 文件链接到我的 html 代码 但它似乎不起作用 我们应该在 html 代码中保存想要链接的 css 文件 或者我们应该如何链接到该文件 作为一个例子 我发布了这个 html 代码
  • 为什么 CMake 被设计为在安装时删除运行时路径

    我自己构建了我的共享库 例如 我使用一个计算斐波那契数的库 并希望在我的另一个 C 项目中使用它CMake 假设共享库和标头位于 path to my lib 共享库libfib so is in path to my lib lib和标题
  • 如何在 JavaFx 中向标签添加 actionListener

    我正在尝试将 ActionListener 添加到标签中 每当用户输入错误的密码或登录时就会弹出该标签 这是我的登录控制器 public class LoginController implements Initializable FXML
  • 如何通过单击超链接打开文件

    我有这张桌子 我想单击链接 文件 无论什么文件 将在新的弹出窗口中打开 这是我的代码
  • 添加按键侦听器并使用 Javascript 单击 Greasemonkey 中的链接

    我想创建一个greasemonkey 脚本 它将在一个邮件站点中添加用于注销操作的快捷键 当前注销链接 注销 hl en 其中有一个id r5 我能够获取链接的节点 但无法调用单击它 我尝试了如下脚本 function key event
  • 消息 discord.py 中的可点击链接

    我希望我的机器人将消息发送到聊天中 如下所示 await ctx send This country is not supported you can ask me to add it here 但是为了使 这里 成为可点击的链接 在 HT
  • jQuery Mobile 断开链接。正确的使用方法是什么?

    我将 jQuery Mobile 添加到我的项目中 因为我希望滑动事件触发 Bootstrap 轮播滚动 用它编码一天左右后 我注意到内部链接不再起作用 我可以使用以下两个页面 test1 html 可靠地重现这一点 a href test
  • 如何编写javadoc链接?

    如何将链接写入 javadoc 目前 我有类似的东西 link java lang Math sqrt double Math sqrt 生成文本Math sqrt应该链接到java lang Math sqrt double 然而 API
  • PHP 中的 Javascript“unes​​cape”

    我的图像主机有一个 Google Chrome 扩展程序 它会向我的网站发送一个 URL 该网址得到encoded通过 JavaScript 的escape method 编码的 URLescape看起来像这样 http 253A 4 bp
  • 是否可以删除将鼠标悬停在链接上时出现的手形光标? (或将其设置为普通指针)

    我想删除当您将鼠标悬停在超链接上时出现的手形光标 我试过这个CSS a link cursor pointer 和这个 a link cursor pointer important 当我将鼠标悬停在链接上时 它仍然会变成手 有谁知道为什么
  • 使标签充当输入按钮

    我怎样才能做一个 a href http test com tag test Test a 就像表单按钮一样 通过充当表单按钮 我的意思是 当单击链接执行操作时method get 或 post 以便能够通过 get 或 post 捕获它
  • 当使用公式生成超链接时,VBA 打开 Excel 超链接不起作用

    使用公式生成的 Excel 超链接似乎存在错误 我使用的是 Excel 2010 我有一个电子表格 其中的单元格包含 URL 我的目标是执行以下两件事 将这些单元格变成超链接 创建一个键盘快捷键来打开这些超链接 这样我就不必使用鼠标了 为了
  • 电子邮件链接在 Android 上不起作用

    我有 HTML 格式的点击电子邮件链接的代码 它在我的电脑上运行良好 但在移动设备上不起作用 我只有 Android 所以我不知道问题是否仅在 Android 上或所有移动设备上 当我按下链接时 浏览器显示 网页无法显示 邮寄至 电子邮件受
  • 如何在asp.net mvc中创建弹出窗口?

    无需使用 javascript AJAX 单击超链接时 应该打开一个新的浏览器窗口 基本 HTML 锚元素 a href http www w3schools com target blank Visit W3Schools a ASP N
  • Jquery:将链接标记为已访问而不打开它们?

    我无意仅仅更改链接 我听说这是不可能的 但如果不是 我很想知道如何更改 如果需要的话 我可以将其添加到浏览器历史记录中 我想遍历所有 a 位于页面上并将其状态更改为已访问 例如 a each function mark as visited

随机推荐

  • 如何在 Visual Studio 代码上删除 git 存储库(laravel 项目)

    我有一个致力于 git 的小型 Laravel 项目 然后我通过手动成功删除了远程存储库 设置 gt 删除此存储库 它工作正常 但是一旦我尝试在 vs code 上创建新的存储库 然后我就得到了 git init Reinitialized
  • 使用 android.accounts 身份验证器时出现问题

    我是 android accounts api 的新手 现在我试图用它们做一些事情 但出现了一个看似虚拟的问题 我已经为我的应用程序创建了一个身份验证器 但尚未实现抽象方法 它的图标成功出现在系统 添加帐户 窗口中 我知道当我单击它时 将调
  • 关于 pthread_cond_signal 和 pthread_cond_wait

    我有以下问题pthread cond 信号 and pthread cond wait 例如 在下面的代码中 根据我的理解 当增量计数 calls pthread cond 信号 计数 125 in 观看次数只能在之后执行计数互斥体已解锁于
  • 二分查找计算平方根 (Java)

    我需要帮助编写一个程序 该程序使用二分搜索递归计算输入非负整数的平方根 向下舍入到最接近的整数 这是我到目前为止所拥有的 import java util Scanner public class Sqrt public static vo
  • xcode 4.2 位置模拟器和时区

    我在运行时注意到 xcode 模拟器中有一个漂亮的设置 我可以更改当前位置 从而模拟基于位置的测试 但是 当我尝试使用 NSDateFormatter 获取日期时 当地日期仍处于太平洋标准时间 我在太平洋时区 NSDateFormatter
  • 如何在 ios 中的联系人表视图中实现搜索栏 [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我在 viewdidload 中有以下代码 totalstring NSMutableArray alloc initWithObje
  • 比较 R 中的时间

    我有两列 例如 A 和 B 时间格式为 HH MM A B 00 00 06 00 str A 和 str B 给出 字符 我想做一个比较 例如 Comment lt ifelse hour part A lt hour part B De
  • Asp.Net System.Web.Routing 不会路由 URL,除非最后有 .aspx

    我的路由有一个奇怪的问题 我有一个现有网站 我正在尝试将其添加到其中 它有效 但前提是 aspx 位于 URL 末尾 如果我删除 aspx 则会出现错误 找不到资源 我创建了一个快速测试网站并将代码复制到其中 它工作得很好 两者之间的代码是
  • Photoshop 文本工具在文本开头添加标点符号[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我在使用 Photoshop 时遇到了一个奇怪的问题 当我使用文字工具时 我可以正常键入字母 但是当我键入任何标点符号时 它会添加到文本的
  • PG::ConnectionBad:致命:用户“用户名”错误的对等身份验证失败

    当我尝试使用 User connection 或 generic table connection 连接到我的 pg 数据库时 出现此错误 PG ConnectionBad 致命 用户 用户名 的对等身份验证失败 我仔细检查了我的datab
  • 我应该如何将 redux 与不会重用的嵌套子组件一起使用?

    我正在开发一个具有许多子组件的组件 其中一些子组件嵌套了五层 我对使用 redux 感兴趣 因为它的优点是在公共状态原子中拥有单一的事实来源 我不明白的是智能 愚蠢组件的推荐 并将提供者置于主要组件之上 并通过道具传递所有内容 如果我这样做
  • gae 样板文档

    在为 App Engine 寻找一个好的社交登录包时 我尝试了 gae boilerplate 但我发现除了自述文件之外没有任何文档 我认为这根本不够 我有很多问题 其中包括 样板文件应该用作库还是根据需要下载并修改 样板应该如何更新 每个
  • Python yaml:ModuleNotFoundError

    我在 conda 中创建了一个新环境并在那里安装了 yaml conda list grep yaml yaml 0 1 7 had09818 2 但我无法导入它 python c import yaml Traceback most re
  • 如何构建微服务前端

    Let s say I have a dozen microservices I am wondering where should the front end go Let s say front end is HTML Javascri
  • 迭代时修改 Java8 流中的对象

    在 Java8 流中 我可以修改 更新其中的对象吗 例如 List
  • 如何纠正错误“从创建它的线程以外的线程访问”?

    下面的代码给了我下面的错误 我想我需要 InvokeRequired 但我不明白我该如何使用 跨线程操作无效 从创建它的线程以外的线程访问控制 listBox1 代码 using System Collections Generic usi
  • Eclipse 中不同的断点图标有何含义?

    在 Eclipse 中使用断点时 我有时会注意到它们有不同的图标 注释 左侧栏上的标记 有时它只是一个蓝色的球 有时上面有一个复选标记 有时它是十字形的 所有这些注释是什么意思 蓝色球 常规断点 活动 可能设置了命中计数 空球 即白色 断点
  • 使用 QuickCheck 测试一元法则

    是否有用于测试的库或工具laws https wiki haskell org Monad laws自定义 monad 的 我目前的黑客尝试是这样的 Define Arbitrary1 如同Eq1 Show1 etc 定义一个包装的辅助类型
  • laravel 私有通道和 laravel-echo-server 的身份验证问题

    我在 Laravel 5 5 中使用 laravel echo server 以及 Redis 和 vuejs 通过 websockets 广播事件 通过公共渠道 它工作正常 并且事件可以正确广播到客户端 但是当我将其更改为私有通道时 即使
  • 如何检查 Star Basic 中损坏的内部链接?

    我正在为 LibreOffice Writer 创建一个基本宏来检查损坏的内部链接 简而言之 生成所有锚点的列表 循环浏览文档 查找内部超链接 如果内部超链接不在锚点列表中 则打开它进行编辑 然后停止 我的代码有一些未解决的问题 withi